PyOpenWorm.configure module

exception PyOpenWorm.configure.BadConf[source]

Bases: exceptions.Exception

Special exception subclass for alerting the user to a bad configuration

class PyOpenWorm.configure.ConfigValue[source]

Bases: object

A value to be configured. Base class intended to be subclassed, as its only method is not implemented

class PyOpenWorm.configure.Configure(**initial_values)[source]

Bases: object

A simple configuration object. Enables setting and getting key-value pairs

Unlike a dict, Configure objects will execute a function when retrieving values to enable deferred computation of seldom-used configuration values. In addition, entries in a Configure can be aliased to one another.


Copy this configuration into a different object.

Parameters:other – A different configuration object to copy the configuration from this object into
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 a KeyError is raised

pname : str

they key of the value you want to return.

default : object

The default value to return if there’s no entry for pname

The value corresponding to the key

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.

Parameters:file_name – configuration file encoded as JSON
Returns:a Configure object with the configuration taken from the JSON file
class PyOpenWorm.configure.Configureable(conf=None, **kwargs)[source]

Bases: object

An object which can accept configuration. A base class intended to be subclassed.

get(pname, default=None)[source]

Gets a config value from this Configureable’s conf

See also