Describe the Changes
Added support for serializing, deserialization, encoding, decoding, and comparing the Unit class which comes from the pint package. Doing so added a layer of complexity to the metadata matching functionality where the previous code base attempted comparing a dictionary of objects to a dictionary of objects that have been decomposed into their components. Thus, the second dictionary must have its values instantiated into objects for the comparison to work.
Example Code
No new additions have been made to the API.
Additional Notes
Objects with a to_dict() and from_dict() method no longer follow the behavior of similar objects with only a __dict__ or __slots__ method.
Objects of type pint.unit.Unit are assumed to be the same as objects of type pint.unit.build_unit_class.<locals>.Unit.
The ability to encode an uninstantiated class has been added as well using the classmethod __snapshotskip__.
Future Work
Figure out what to do about custom units defined by users that aren't in base pint. Code will break when trying to encode a non-standard unit so right now, escapes have been hardcoded for two examples: fraction and percent.
Describe the Changes Added support for serializing, deserialization, encoding, decoding, and comparing the Unit class which comes from the pint package. Doing so added a layer of complexity to the metadata matching functionality where the previous code base attempted comparing a dictionary of objects to a dictionary of objects that have been decomposed into their components. Thus, the second dictionary must have its values instantiated into objects for the comparison to work.
Example Code No new additions have been made to the API.
Additional Notes Objects with a
to_dict()
andfrom_dict()
method no longer follow the behavior of similar objects with only a__dict__
or__slots__
method.Objects of type
pint.unit.Unit
are assumed to be the same as objects of typepint.unit.build_unit_class.<locals>.Unit
.The ability to encode an uninstantiated class has been added as well using the classmethod
__snapshotskip__
.Future Work Figure out what to do about custom units defined by users that aren't in base pint. Code will break when trying to encode a non-standard unit so right now, escapes have been hardcoded for two examples:
fraction
andpercent
.