AnnotatedStructMeta¶
-
class
modcma.utils.AnnotatedStructMeta(name: str, bases: tuple, attrs: dict)¶ Bases:
typeMetaclass for class for AnnotatedStruct.
Wraps all parameters defined in the class body with __annotations__ into a signature. It additionally wraps each parameter into a descriptor using __annotations__, allowing for type checking. Currently, only two types of descriptors are implementated, InstanceOf and typing.AnyOf, the first implements simple type validation, the latter implements validation though the use of sequence of allowed values.