rail.projects.configurable module

class rail.projects.configurable.Configurable(**kwargs)[source]

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

Parameters:

kwargs (Any)

property config: StageConfig

Return the underlying configuration

config_options: dict[str, StageParameter] = {'name': Parameter(Name for the plotter, type: <class 'str'>, default: 0.0 [optional])}
classmethod full_class_name()[source]

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

Return type:

str

get(key, default_value=None)[source]

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

Return type:

Any

Parameters:
  • key (str)

  • default_value (Any | None)

static merge_named_lists(input_lists)[source]

Merge lists, removing duplicate items

Return type:

list[Configurable]

Parameters:

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

Returns:

The merged list

Return type:

list[Configurable]

to_yaml_dict()[source]

Create a yaml-convertable dict for this object

Return type:

dict[str, dict[str, Any]]

yaml_tag: str = ''