finam.tools.get_enum_value#
- finam.tools.get_enum_value(value, enum_cls, error=<class 'ValueError'>)[source]#
Convert value to corresponding enum value.
- Parameters:
value (any) – Value to convert to enum value.
enum_cls (Enum) – Enumeration class to get value from.
error (Exception, optional) – Error to raise if value is not present in enum class, by default ValueError
- Returns:
Corresponding Enum value.
- Return type:
enum
- Raises:
ValueError – If enum_cls is not a subclass of Enum
error – If value couldn’t be found in given enum class.