State

State

class State[source]

Bases: object

Describes the (mutable) state of a configuration being parsed

Attributes

Note: attributes inherited from parent classes are not shown here, if any

root_path

Base path to use to resolve relative config file paths

instances

Contains the sequence of values for each parameter

config_files_to_process

Contains a list of configuration files to process

special_action

Contains a special action if flag was encountered

Methods

append

Appends a value to a parameter

make

Creates the initial state, populated with the default values when present

List of members of State

root_path: Optional[pathlib.Path]

Base path to use to resolve relative config file paths

instances: Dict[str, List[Any]]

Contains the sequence of values for each parameter

config_files_to_process: List[pathlib.Path]

Contains a list of configuration files to process

special_action: Optional[configpile.enums.SpecialAction]

Contains a special action if flag was encountered

append(key, value)[source]

Appends a value to a parameter

No type checking is performed, be careful.

Parameters
  • key (str) – Parameter name

  • value (Any) – Value to append

Return type

None

static make(root_path, params)[source]

Creates the initial state, populated with the default values when present

Parameters

params (Iterable[Param[Any]]) – Sequence of parameters

Raises

ValueError – If a default value cannot be parsed correctly

Return type

State

Returns

The initial mutable state

__init__(root_path, instances, config_files_to_process, special_action)