rail.core.configurable module

class rail.core.configurable.Configurable

Bases: object

Base class used to attach Ceci.StageParamters to a class

This implements:

  1. being able to define parameters that are attached to a class

  2. being able to create an object of that class from a dict with the required paramters

  3. checking that all the required parameters are present and of the correct types

  4. check that there are no additional parameters given

  5. being able to write a snapshot of the current values of the paramters to yaml

Subclasses should:

  1. add parameters to the config_options class member

  2. set the yaml_tag class member to a unique value

__init__(**kwargs)

C’tor

Parameters:

**kwargs (Any) – Configuration parameters for this object, must match class.config_options data members

Return type:

None

property config: StageConfig

Return the underlying configuration

classmethod full_class_name()

Return the full name of the class, including the parent module

Return type:

str

get(key, default_value=None)

Get a particular item by key, return default value if it is not present

Parameters:
  • key (str)

  • default_value (Any | None)

Return type:

Any

static merge_named_lists(input_lists)

Merge lists, removing duplicate items

Parameters:

input_lists (list[list[Configurable]]) – Lists to be merged

Returns:

The merged list

Return type:

list[Configurable]

to_yaml_dict()

Create a yaml-convertable dict for this object

Return type:

dict[str, dict[str, Any]]

yaml_tag: str = ''