cashocs.io.config.Config#
- class cashocs.io.config.Config(
- config_file: str | None = None,
Bases:
dictClass for handling the config in cashocs.
Initializes self.
- Parameters:
config_file (str | None) – Path to the config file.
Methods Summary
clear()Remove all items from the dict.
copy()Return a shallow copy of the dict.
fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
Generates a string representation of the config for logging.
get(section, option)Get a configuration option as a string.
getboolean(section, option)Get a configuration option as a boolean.
getfloat(section, option)Get a configuration option as a float.
getint(section, option)Get a configuration option as an integer.
getlist(section, option)Get a configuration option as a list.
items()Return a set-like object providing a view on the dict's items.
keys()Return a set-like object providing a view on the dict's keys.
pop(k[,d])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()Remove and return a (key, value) pair as a 2-tuple.
set(section, option, value)Set a configuration option after converting it to its configured type.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
Validates the configuration file.
values()Return an object providing a view on the dict's values.
Methods Documentation
- clear()#
Remove all items from the dict.
- copy()#
Return a shallow copy of the dict.
- classmethod fromkeys(
- iterable,
- value=None,
- /,
Create a new dictionary with keys from iterable and values set to value.
- generate_string_representation() str[source]#
Generates a string representation of the config for logging.
- Returns:
The string representation of the config.
- Return type:
str
- get(
- section: str,
- option: str,
Get a configuration option as a string.
- Parameters:
section (str)
option (str)
- Return type:
str
- getboolean(
- section: str,
- option: str,
Get a configuration option as a boolean.
- Parameters:
section (str)
option (str)
- Return type:
bool
- getfloat(
- section: str,
- option: str,
Get a configuration option as a float.
- Parameters:
section (str)
option (str)
- Return type:
float
- getint(
- section: str,
- option: str,
Get a configuration option as an integer.
- Parameters:
section (str)
option (str)
- Return type:
int
- getlist(
- section: str,
- option: str,
Get a configuration option as a list.
- Parameters:
section (str)
option (str)
- Return type:
list
- items()#
Return a set-like object providing a view on the dict’s items.
- keys()#
Return a set-like object providing a view on the dict’s keys.
- pop(
- k[,
- d,]
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()#
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- set(
- section: str,
- option: str,
- value: str,
Set a configuration option after converting it to its configured type.
- Parameters:
section (str)
option (str)
value (str)
- Return type:
None
- setdefault(
- key,
- default=None,
- /,
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update(
- [E,]
- **F,
If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()#
Return an object providing a view on the dict’s values.