owmeta_core.configure module¶
This module defines a generic configuration dictionary with a few extra features.
A list of all documented configuration values can be found under “configuration values” in the index.
- exception owmeta_core.configure.BadConf[source]¶
Bases:
ExceptionSpecial exception subclass for alerting the user to a bad configuration
- class owmeta_core.configure.ConfigValue[source]¶
Bases:
objectA value to be configured. Base class intended to be subclassed, as its only method is not implemented
- class owmeta_core.configure.Configurable(conf=None, **kwargs)[source]¶
Bases:
objectAn object which can accept configuration. A base class intended to be subclassed.
- get(pname, default=None)[source]¶
Gets a config value from this
Configurable’sconfSee also
- class owmeta_core.configure.Configuration(**initial_values)[source]¶
Bases:
objectA simple configuration object. Enables setting and getting key-value pairs
Unlike a
dict, Configuration objects will execute a function when retrieving values to enable deferred computation of seldom-used configuration values. In addition, entries in aConfigurationcan be aliased to one another.- copy(other)[source]¶
Copy configuration from another object into this one
- Parameters
- other
dictorConfiguration Configuration to copy from
- other
- Returns
Configurationself
- get(pname, default=NO_DEFAULT)[source]¶
Get some parameter value out by asking for a key. Note that unlike
dict, if you don’t specify a default, then aKeyErroris raised
- link(*names)[source]¶
Call link() with the names of configuration values that should always be the same to link them together
- classmethod open(file_name)[source]¶
Open a configuration file and read it to build the internal state.
Sets
configure.file_locationto the given file_name- configure.file_location¶
The location where a
Configurationwas loaded from. This may be set by any function that loads the configuration – not justConfiguration.open. Generally, this value is suitable for finding files in locations relative to the config file, but not for much else.
- Parameters
- file_name
str configuration file encoded as JSON
- file_name
- Returns
Configurationreturns an instance of this class with the configuration taken from the JSON file
See also
- classmethod process_config(config_dict, variables=None)[source]¶
Resolves variables in config values and creates an instance of this class
- Parameters
- config_dict
dict The source for the resulting config
- config_dict
- Returns
Configurationconfig populated with variables