hvl_ccb.utils.enum
- class AutoNumberNameEnum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
NameEnum
,AutoNumberEnum
Auto-numbered enum with names used as string representation, and with lookup and equality based on this representation.
- class BoolEnum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
NameEnum
- BoolEnum inherits from NameEnum and the type of the first value is
enforced to be ‘boolean’. For bool()-operation the __bool__ is redefined here.
- class NameEnum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
StrEnumBase
Enum with names used as string representation, and with lookup and equality based on this representation. The lookup is implemented in StrEnumBase with the _missing_value_ method. The equality is also defined at this place (__eq__).
Use-case:
class E(NameEnum): a = 2 b = 4 E.a == "a" E.a != 2 E.a != "2"
The access would be normally with E[“a”], but E(“a”) works also. Therefore, E[“a”] == E(“a”)
Attention: to avoid errors, best use together with unique enum decorator.
- class RangeEnum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
float
,ValueEnum
Range enumeration inherit from ValueEnum, find suitable voltage/current/resistance input range for devices such as multimeter and oscilloscope
- class StrEnumBase(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
String representation-based equality and lookup.
- class ValueEnum(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
StrEnumBase
Enum with string representation of values used as string representation, and with lookup and equality based on this representation. Values do not need to be of type ‘str’, but they need to have a str-representation to enable this feature. The lookup is implemented in StrEnumBase with the _missing_value_ method. The equality is also defined at this place (__eq__).
Use-case:
class E(ValueEnum): ONE = 1 E.ONE == "1" E.ONE != 1 E.ONE != "ONE"
The access would be normally with E(1), but E(“1”) works also. Therefore, E(1) == E(“1”)
Attention: to avoid errors, best use together with unique enum decorator.