AnnotatedStruct¶
-
class
modcma.utils.AnnotatedStruct(*args, **kwargs)¶ Bases:
objectCustom class for defining structs.
Automatically sets parameters defined in the signature. AnnotatedStruct objects, and children thereof, require the following structure:
- class Foo(AnnotatedStruct):
variable_wo_default : type variable_w_default : type = value
The metaclass will automatically assign a decriptor object to every variable, allowing for type checking. The init function will be dynamically generated, and user specified values in the *args **kwargs, will override the defaults. The *args will follow the order as defined in the class body:
i.e. (variable_wo_default, variable_w_default,)
-
__signature__¶ The calling signature, instantiated by the metaclass
- Type
Signature
Methods Summary
set_default(name, default_value)Helper method to set default parameters.
Methods Documentation
-
set_default(name: str, default_value: Any) → None¶ Helper method to set default parameters.