NodeEnumMeta#
- class NodeEnumMeta(value: int, class_name: str, names: Dict[str, int], module: str)[source]#
Bases:
object
Custom Metaclass for NodeEnum.
Note: Required to enable pickling of a NodeEnum value.
It simply servers the purpose to recreate a NodeEnum for a given enum value. Since the NodeEnums are created dynamically there is no way recreate a NodeEnum value since python can not find the definition. This class bypasses this problem by providing the functionality to recreate the Enum on the fly.
Warning: Although the class of the resulting enum object looks and feels the same as the original one it is not. Therefore comparing the type will fail. This is however the only limitation. (type(value_old) != type(value_new) but value_old == value_new)
- Parameters:
value (int) – Value of the NodeEnum object that should be created.
class_name (str) – Name of the NodeEnum class.
names (Dict[str, int]) – Mapping of the enum names to their corresponding integer value.
module (str) – Should be set to the module this class is being created in.
Methods