vantage6.common.configuration_manager.ConfigurationManager#

class ConfigurationManager(conf_class=<class 'vantage6.common.configuration_manager.Configuration'>, name=None)#

Bases: object

Class to maintain valid configuration settings.

Parameters:
  • conf_class (Configuration) – The class to use for the configuration.

  • name (str) – The name of the configuration.

__init__(conf_class=<class 'vantage6.common.configuration_manager.Configuration'>, name=None)#

Methods

__init__([conf_class, name])

from_file(path[, conf_class])

Load a configuration from a file.

get()

Get a configuration from the configuration manager.

load(path)

Load a configuration from a file.

put(config)

Add a configuration to the configuration manager.

save(path)

Save the configuration to a file.

Attributes

is_empty

Check if the configuration manager is empty.

classmethod from_file(path, conf_class=<class 'vantage6.common.configuration_manager.Configuration'>)#

Load a configuration from a file.

Parameters:
  • path (Path | str) – The path to the file to load the configuration from.

  • conf_class (Type[Configuration]) – The class to use for the configuration.

Returns:

The configuration manager with the configuration.

Return type:

ConfigurationManager

Raises:

AssertionError – If the name of the configuration could not be extracted from the file path.

get()#

Get a configuration from the configuration manager.

Returns:

The configuration.

Return type:

Configuration

property is_empty: bool#

Check if the configuration manager is empty.

Returns:

Whether or not the configuration manager is empty.

Return type:

bool

load(path)#

Load a configuration from a file.

Parameters:

path (Path | str) – The path to the file to load the configuration from.

Return type:

None

put(config)#

Add a configuration to the configuration manager.

Parameters:

config (dict) – The configuration to add.

Raises:

AssertionError – If the configuration is not valid.

Return type:

None

save(path)#

Save the configuration to a file.

Parameters:

path (Path | str) – The path to the file to save the configuration to.

Return type:

None