devops.config.base
Base configuration utilities.
Functions
|
Get a boolean value from a mapping. |
|
Get a string value from a mapping. |
|
Get a string enum value from a mapping. |
|
Get a list of strings from a mapping. |
|
Get a string or list of strings from a mapping. |
|
Get a sub-table from a mapping. |
Exceptions
|
Custom exception for configuration-related errors. |
- exception devops.config.base.ConfigError(message)[source]
Bases:
ExceptionCustom exception for configuration-related errors.
- Parameters:
message (str)
- Return type:
None
- devops.config.base.get_table(mapping, key)[source]
Get a sub-table from a mapping.
- Parameters:
- Returns:
dict[str, Any] – The extracted sub-table or an empty dictionary if the key is not found.
- Raises:
ConfigError – If the value associated with the key is not a dictionary.
- Return type:
- devops.config.base.get_bool(mapping, key, *, default=None)[source]
Get a boolean value from a mapping.
- Parameters:
- Returns:
bool | None – The extracted boolean value or None if the key is not found.
- Return type:
bool | None
- devops.config.base.get_str_or_str_list(mapping, key, default=None)[source]
Get a string or list of strings from a mapping.
- Parameters:
- Returns:
str | list[str] | None – The extracted string or list of strings value or None if the key is not found.
- Return type:
- devops.config.base.get_str_enum(mapping, key, enum_type, default=None)[source]
Get a string enum value from a mapping.
- Parameters:
- Returns:
StrEnum | None – The extracted enum value or None if the key is not found.
- Raises:
ConfigError – If the value associated with the key is not a valid enum value.
- Return type:
StrEnum | None
- devops.config.base.get_str_list(mapping, key, default=None)[source]
Get a list of strings from a mapping.
- Parameters:
- Returns:
list[str] – The extracted list of strings or an empty list if the key is not found.
- Raises:
ConfigError – If the value associated with the key is not a list of strings.
- Return type: