Configuration (Core)#

alts.core.configuration
class ConfAttr[source]#

Bases: object

Description
A configurable attribute may be only initialized at runtime.
Works with the NotSet() class.
class Configurable(*args, **kwargs)[source]#

Bases: ROOT

Description
Remembers its parameters and is able to create new instances of itself with the same parameters.
Parameters:
  • args (Any) – Positional arguments for configuration

  • kwargs (Any) – Keyword arguments for configuration

class ConfigurableMeta[source]#

Bases: type

Description
A ConfigurableMeta returns a new Configurable of the given type when called.
exception InitError[source]#

Bases: AttributeError

Description
Is raised when an object hasn’t been initialized.
class NotSet[source]#

Bases: object

Description
If an attribute is set to NotSet() or NOTSET, then an AttributeError is raised if the attribute is being read.
class ROOT[source]#

Bases: object

Description
ROOT defines basic implementations of the __init__, __post_init__, init and post_init methods.
init(self, cls) None[source]#
Description
Initializes all non-dataclass objects after cls in method resolution order.
Parameters:

cls (Type) – Starting point of initialization.

post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
init(default, default_factory) Any[source]#
Description
An initialisor that is at the start of the experiment.
Prioritizes default_factory as default over default.
Parameters:
  • default (Any) – A fixed default value (default= NOTSET)

  • default_factory (Any) – A dynamic default factory (default= NOTSET)

Returns:

A static/dynamic default if one is given, otherwise becomes a configurable attribute ConfAttr()

Return type:

Any

is_set(param) param[source]#
Description
Returns param if it is not None, otherwise raises a ValueError as setting param is required.
Parameters:

param (Any) – The parameter to be tested, whether it is set

Returns:

param

Return type:

Any

Raises:

valueError – If param is None

post_init() Any[source]#
Description
An initialisor that is run during the experiment.
Returns:

A not set default

Return type:

Any

pre_init(default, default_factory) Any[source]#
Description
An initialisor that is run before the experiment. Sets the defaults of attributes.
Prioritizes default_factory as default over default.
Parameters:
  • default (Any) – A fixed default value (default= NOTSET)

  • default_factory (Any) – A dynamic default factory (default= NOTSET)

Returns:

A field(init=False, repr=False)

Return type:

Any

Raises:

ValueError – If neither default nor default_factory are set