wf_psf.utils.read_config module

Read Config.

A module which defines methods to read configuration files.

Author:

Jennifer Pollack <jennifer.pollack@cea.fr>

class wf_psf.utils.read_config.RecursiveNamespace(**kwargs)[source]

Bases: SimpleNamespace

RecursiveNamespace.

A child class of the type SimpleNamespace to create nested namespaces (objects).

Parameters:

**kwargs – Extra keyword arguments used to build a nested namespace.

Methods

map_entry(entry)

Map Entry.

static map_entry(entry)[source]

Map Entry.

A function to map a dictionary to a RecursiveNamespace object.

Parameters:

entry (type) –

Returns:

  • RecursiveNamespace – RecursiveNamespace object if entry type is a dictionary

  • entry (type) – Original type of entry if type is not a dictionary

wf_psf.utils.read_config.read_conf(conf_file)[source]

Read Conf.

A function to read a yaml configuration file, recursively.

Parameters:

conf_file (str) – Name of configuration file

Returns:

Recursive Namespace object

Return type:

RecursiveNamespace

wf_psf.utils.read_config.read_stream(conf_file)[source]

Read Stream.

A generator to read multiple docs in a yaml config.

Parameters:

conf_file – Name of configuration file

Yields:

dict – A dictionary containing all config files.

wf_psf.utils.read_config.read_yaml(conf_file)[source]

Read Yaml.

A function to read a YAML file.

Parameters:

conf_file (str) – Name of configuration file

Returns:

config – A dictionary containing configuration parameters.

Return type:

dict