hsm.userdata.HierarchicalDict
- class HierarchicalDict(parent=None, **kwargs)
Bases:
object
Hierarchical dictionary
Variables can be get / set via attribute syntax: dict.var. Variables need to be declared before they can be set. If not defined in current dictionary, search proceeds in parent dictionary.
Initialize a new hierarchical dictionary with the given parent and declare the keys given by remaining keyword arguments.
Methods
Declare variables (and their initial values) using the given keyword arguments.
- __getitem__(key)
Retrieve a variable value from the dictionary.
If not found in the current dictionary, search propagates the parent hierarchy. Finally, if key is not defined in the hierarchy, KeyError is raised.
- declare(**kwargs)
Declare variables (and their initial values) using the given keyword arguments.
Will not overwrite already declared variables.