edisgo.tools.config

Classes

Config

Container for all configurations.

Functions

load_config(filename[, config_dir, copy_default_config])

Loads the specified config file.

get(section, key)

Returns the value of a given key of a given section of the main

get_default_config_path()

Returns the basic edisgo config path. If it does not yet exist it creates

make_directory(directory)

Makes directory if it does not exist.

Module Contents

edisgo.tools.config.load_config(filename, config_dir=None, copy_default_config=True)

Loads the specified config file.

Parameters:
  • filename (str) – Config file name, e.g. ‘config_grid.cfg’.

  • config_dir (str, optional) – Path to config file. If None uses default edisgo config directory specified in config file ‘config_system.cfg’ in section ‘user_dirs’ by subsections ‘root_dir’ and ‘config_dir’. Default: None.

  • copy_default_config (bool) – If True copies a default config file into config_dir if the specified config file does not exist. Default: True.

edisgo.tools.config.get(section, key)

Returns the value of a given key of a given section of the main config file.

Parameters:
Returns:

The value which will be casted to float, int or boolean. If no cast is successful, the raw string is returned.

Return type:

float or int or bool or str

edisgo.tools.config.get_default_config_path()

Returns the basic edisgo config path. If it does not yet exist it creates it and copies all default config files into it.

Returns:

Path to default edisgo config directory specified in config file ‘config_system.cfg’ in section ‘user_dirs’ by subsections ‘root_dir’ and ‘config_dir’.

Return type:

str

edisgo.tools.config.make_directory(directory)

Makes directory if it does not exist.

Parameters:

directory (str) – Directory path