config_loader#

This module provides a class to load configuration files from the ClearMap configuration directory.

The configuration files are used to store the parameters for the ClearMap processing steps. Currently, they are stored as configobj files, but other formats like json or yaml could be supported in the future through a simple plugin function to this module (see the not_implemented functions). All that is required is that the object returned by these plugin functions implements read, write, and reload methods, a filename attribute and behaves as a python dictionary.

class ConfigLoader(src_dir)[source]#

Bases: object

get_cfg(cfg_name)[source]#
static get_cfg_from_path(cfg_path)[source]#
get_cfg_path(cfg_name, must_exist=True)[source]#
Parameters:
  • cfg_name (str)

  • must_exist (bool)

Returns

static get_default_path(cfg_name, must_exist=True, install_mode=False)[source]#
static get_patched_cfg_from_path(cfg_path)[source]#
default_dir = '/home/crousseau/.clearmap/'#
loader_functions = {'.cfg': <function get_configobj_cfg>, '.ini': <function get_configobj_cfg>, '.json': <function get_json_cfg>, '.yml': <function get_yml_cfg>}#
supported_exts = ('.cfg', '.ini', '.yml', '.json')#
clean_path(path)[source]#
flatten_alternatives(alternatives)[source]#
get_alternatives(cfg_name)[source]#
get_cfg_reader_function(cfg_path)[source]#
get_configobj_cfg(cfg_path)[source]#
get_configs(cfg_path, processing_params_path, machine_cfg_path=None)[source]#
get_json_cfg(cfg_path)[source]#
Parameters:
  • (str) (cfg_path)

  • path (Returns Should return a dict like object with a write method and filename that gives the)

  • -------

get_yml_cfg(cfg_path)[source]#
Parameters:
  • (str) (cfg_path)

  • path (Returns Should return a dict like object with a write method and filename that gives the)

  • -------

is_machine_file(cfg_name)[source]#
is_tab_file(cfg_name)[source]#
patch_cfg(cfg, default_cfg)[source]#