utils
utils
__all__ = ['get_config', 'BaseEnum']
module-attribute
BaseEnum
Bases: Enum
Base class for enumerations.
__eq__(other) -> bool
Checks equality with another object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
BaseEnum | dict | str
|
The object to compare with. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if equal, False otherwise. |
find_by_id(id: str) -> BaseEnum
classmethod
Finds an enumeration by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
str
|
The ID to search for. |
required |
Returns:
Name | Type | Description |
---|---|---|
BaseEnum |
BaseEnum
|
The found enumeration or None if not found. |
list() -> list
classmethod
Lists all enumeration values.
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
A list of enumeration values. |
get_config(key: str, raise_exception: bool = True, default_value: str = None) -> str
Retrieves the configuration value for a given key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
The configuration key to retrieve. |
required |
raise_exception
|
bool
|
Whether to raise an exception if the key is not found. Defaults to True. |
True
|
default_value
|
str
|
The default value to return if the key is not found. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
Exception
|
If the key is not found and raise_exception is True. |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The configuration value. |