7.4.6. pymodaq_utils.enums module

class pymodaq_utils.enums.BaseEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enum to be used within pymodaq with some utility methods

classmethod names() List[str][source]

Returns all the names of the enum

classmethod to_dict()[source]

Returns the enum in form of a dict with names os keys

New in 4.0.2

classmethod to_dict_value()[source]

Returns the enum in form of a dict with values os keys

New in 4.0.2

classmethod values() List[str][source]

Returns all the names of the enum

pymodaq_utils.enums.enum_checker(enum: BaseEnum, item: BaseEnum | str)[source]

Check if the item parameter is a valid enum or at least one valid string name of the enum

If a string, transforms it to a valid enum (case not important)

Parameters:
  • enum (BaseEnum class or one of its derivated class) –

  • item (str or BaseEnum instance) –

Return type:

BaseEnum class or one of its derivated class