rcmpy.state package#

Module contents#

A module implementing this package’s stateful information that persists across invocations.

class rcmpy.state.State(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]] = None, schemas: SchemaMap = None, dest_attr: str = 'data', verify: bool = True)[source]#

Bases: RcmpyDictCodec

The top-level configuration object for the package.

asdict() dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]][source]#

Obtain a dictionary representing this instance.

configs_new: bool#
directory: Path#
init(data: dict[str, str | int | float | bool | None | dict[str, str | int | float | bool | None] | list[str | int | float | bool | None]]) None[source]#

Perform implementation-specific initialization.

is_new() bool[source]#

Determine if state has changed.

manifest: Dict[str, Any]#
manifest_new: bool#
root_directories(subdir: str, common_first: bool = True) List[Path][source]#

Get up to a pair of directories from some sub-directory of the current root.

set_directory(path: Path | str | None) None[source]#

Set a new directory to use as the data repository.

set_variant(variant: str = None) None[source]#

Set a new variant value.

update_manifest(data: Dict[str, Any]) None[source]#

Set new manifest data.

variables_new: bool#
variant: str#
rcmpy.state.load_state(root: Path | str | None = None, name: str = 'state.json') Iterator[State][source]#

This needs to be a context manager, so it get’s written back to disk.