gemseo / utils

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:

BaseEnum(value)

A base Enum class that can be compared to strings.

CamelCaseEnum(value)

Enum that are represented as the camel case of the key name.

MetaEnum(cls, bases, classdict)

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

gemseo.utils.base_enum.BaseEnum

class gemseo.utils.base_enum.CamelCaseEnum(value)[source]

Bases: enum.Enum

Enum that are represented as the camel case of the key name.

class gemseo.utils.base_enum.MetaEnum(cls, bases, classdict)[source]

Bases: enum.EnumMeta

An Enum meta-class to subclass the in behavior.

Methods:

mro()

Return a type's method resolution order.

mro()

Return a type’s method resolution order.