PlasmaCalcs.quantities.quantity_loader.MetaQuantTracking
- class PlasmaCalcs.quantities.quantity_loader.MetaQuantTracking(*args, **kw)
Bases:
MetaBehaviorHavermetaclass which predefines some things for tracking calcs, in the class namespace:KNOWN_VARS - dict of {var: LoadableVar} for all functions decorated with @known_varKNOWN_PATTERNS - dict of {pattern: LoadablePattern} for all functions decorated with @known_pattern.KNOWN_SETTERS - dict of {var: f} for all functions decorated with @known_setterknown_var - instance of DecoratingVars; use @known_var or @known_var(name=varname) to decorate functions.use this for vars, which require exact match for name.E.g. name=’n’ for number density.(Note, if function.__name__ is ‘get_{var}’, name=’{var}’ is implied, if not provided explicitly.)known_pattern - instance of DecoratingPatterns; use @known_pattern(pattern) to decorate functions.use this for patterns, which require regex match for name.E.g. pattern=’mean_(.+)’ for mean of any var.decorated functions will be supplied with kwarg _match=re.fullmatch(pattern, var).known_setter - instance of DecoratingSetters; use @known_setter or @known_setter(name=varname).use this for setters, which are functions that set the value of vars.For more details see setvars or set_var.Also, copy base classes’ KNOWN_VARS, KNOWN_PATTERNS, and KNOWN_SETTERS to this class, if they exist.Note that __prepare__ gets called before class definition begins, and fills class namespace,then __init__ gets called after class definition ends. For example:class MySubclass(metaclass=MetaQuantTracking):# <– __prepare__ runs here. Roughly: locals().update(__prepare__())pass # or, define other functions, variables, etc, as desired.# <– __init__ runs here. Roughly: MetaQuantTracking.__init__(MySubclass)- __init__(*args, **kw)
- initialize cls (with metaclass=MetaBehaviorHaver)
Methods
__init__(*args, **kw)mro()- mro()
- Return a type’s method resolution order.