lighthouse.configurable

class lighthouse.configurable.Configurable[source]

Bases: object

Base class for targets configured by the config file watching system.

Each subclass is expected to be able to validate and apply configuration dictionaries that come from config file content.

name = None
config_subdirectory = None
classmethod validate_config(config)[source]

Validates a given config, returns the validated config dictionary if valid, raises a ValueError for any invalid values.

Subclasses are expected to define this method.

apply_config(config)[source]

Applies a given config to the subclass.

Setting instance attributes, for example. Subclasses are expected to define this method.

NOTE: It is incredibly important that this method be idempotent with regards to the instance.

classmethod from_config(name, config)[source]

Returns a Configurable instance with the given name and config.

By default this is a simple matter of calling the constructor, but subclasses that are also Pluggable instances override this in order to check that the plugin is installed correctly first.