PropertyDefinition#
- class astro_metadata_translator.PropertyDefinition(doc, *args)#
Bases:
objectDefinition 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
Python type of property as a string suitable for messages/docs.
Methods Summary
is_value_conformant(value)Compare the supplied value against the expected type as defined for this property.
Attributes Documentation
- str_type#
Python type of property as a string suitable for messages/docs.
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 beNone.- Returns:
is_ok –
Trueif the value is of an appropriate type.- Return type:
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.