PropertyDefinition#

class astro_metadata_translator.PropertyDefinition(doc, *args)#

Bases: object

Definition of an instrumental property.

Supports both signatures:

  • (doc, py_type, to_simple=None, from_simple=None)

  • (doc, legacy_str_type, py_type, to_simple=None, from_simple=None)

Modern preference is to not specify the string type since that can be derived directly from the python type.

Parameters:
  • doc (str) – Documentation string for the property.

  • *args (typing.Any) – Remaining constructor arguments in one of the supported signatures.

Attributes Summary

doc

from_simple

py_type

str_type

Python type of property as a string suitable for messages/docs.

to_simple

Methods Summary

is_value_conformant(value)

Compare the supplied value against the expected type as defined for this property.

Attributes Documentation

doc: str#
from_simple: Callable[[Any], Any] | None#
py_type: type#
str_type#

Python type of property as a string suitable for messages/docs.

to_simple: Callable[[Any], Any] | None#

Methods Documentation

is_value_conformant(value)#

Compare the supplied value against the expected type as defined for this property.

Parameters:

value (object) – Value of the property to validate. Can be None.

Returns:

is_okTrue if the value is of an appropriate type.

Return type:

bool

Notes

Currently only the type of the property is validated. There is no attempt to check bounds or determine that a Quantity is compatible with the property.