base_enum module¶
Custom Enumerations.
The .BaseEnum class enables the specification of options which were previously defined using class attributes. It enables backward compatibility, as the user can either provide the Enum member or its name as a string. The conversion is then made implicitly.
Classes:
|
A base Enum class that can be compared to strings. |
|
Enum that are represented as the camel case of the key name. |
|
An Enum meta-class to subclass the in behavior. |
- class gemseo.utils.base_enum.BaseEnum(value)[source]¶
Bases:
enum.Enum
A base Enum class that can be compared to strings.
Methods:
get_member_from_name
(value)Return an Enum member from a name or a member.
- classmethod get_member_from_name(value)[source]¶
Return an Enum member from a name or a member.
This class method returns an Enum member either from the name of the member or the member itself. It enables backward compatibility with the use of class attributes for options.
- Parameters
value (Union[str, gemseo.utils.base_enum.BaseEnum]) – An Enum member name or an Enum member.
- Raises
TypeError – If the Enum member is not from the same Enum class.
- Return type