cashocs.io.config#

Management of configuration files.

Functions

load_config(path)

Loads a config object from a config file.

Classes

Any(*args, **kwargs)

Special type indicating an unconstrained type.

Config([config_file])

Class for handling the config in cashocs.

ConfigParser([defaults, dict_type, ...])

ConfigParser implementing interpolation.

class cashocs.io.config.Config(config_file=None)[source]#

Bases: ConfigParser

Class for handling the config in cashocs.

Initializes self.

Parameters:

config_file (Optional[str]) – Path to the config file.

getlist(section, option, **kwargs)[source]#

Extracts a list from a config file.

Parameters:
  • section (str) – The section where the list is placed.

  • option (str) – The option which contains the list.

  • **kwargs (Any) – A list of keyword arguments that get passed to :py:meth:self.get

Returns:

The list which is specified in section section and key option.

Return type:

List

validate_config()[source]#

Validates the configuration file.

Return type:

None

cashocs.io.config.load_config(path)[source]#

Loads a config object from a config file.

Loads the config from a .ini file via the configparser package.

Parameters:

path (str) – The path to the .ini file storing the configuration.

Returns:

The output config file, which includes the path to the .ini file.

Return type:

ConfigParser