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

copy(other)[source]

Copy this configuration into a different object.

Parameters:other – A different configuration object to copy the configuration from this object into
Returns:
get(pname, default=<object object>)[source]

Get some parameter value out by asking for a key

Parameters:
  • pname – they key of the value you want to return.
  • default – True if you want the default value, False if you don’t (default)
Returns:

The value corresponding to the key in pname

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]

The getter for the configuration

Parameters:
  • pname – The key to retreive the value of interest
  • default – True if you want the default value, False if you don’t (default)
Returns:

Returns the configuration value corresponding to the key pname.