ccsds_ndm.model_quantity
Validation and quantity support for xsdata model classes.
Patches __setattr__ on container dataclasses so that:
Already-wrapped values (e.g.
LengthType) pass through unchanged.pint / astropy Quantity objects are converted to the correct wrapper type with unit conversion and dimensional validation.
Plain numbers, strings, and other invalid types raise
TypeError.Noneis allowed on optional fields.
Also patches a .q() method on wrapper types (dataclasses with value
and units fields) that returns a pint or astropy Quantity, controlled by
a global mode flag.
Patching runs automatically when this module is imported.
Functions
Return whether automatic unit conversion is enabled. |
|
Return the current global quantity mode. |
|
|
Enable or disable automatic unit conversion on Quantity assignment. |
|
Set the global quantity mode for |
Classes
|
Quantity backend selection. |