granular_configuration_language .yaml.classes

class granular_configuration_language.yaml.classes.LazyEval(
tag: Tag,
)[source]

Bases: ABC, Generic[RT]

Base class for handling the output of a Tag that needs to be run just-in-time.

abstractmethod _run() RT[source]

Run the Tag Logic.

Implementation Note

Caching is handled by this base class and not by this method.

Returns:

Result of the lazy evaluation

Return type:

RT

property result: RT | Any

Result of the lazy evaluation, completing any chains. (Cached)

tag: Final[Tag]

Tag that created this instance

class granular_configuration_language.yaml.classes.LazyRoot[source]

Bases: object

Allows the Root reference to be defined outside loading. (Since it cannot be defined during Loading)

property root: Root

Fetch the Root.

class granular_configuration_language.yaml.classes.LoadOptions(
*,
obj_pairs_func: type[Mapping[Any, Any]],
sequence_func: type[tuple[Any] | list[Any]],
mutable: bool,
file_location: Path | None,
relative_to_directory: Path,
previous: LoadOptions | None,
)[source]

Bases: object

Type: frozen dataclass

Holds the parameters used when loading the configuration file.

file_location: Path | None

Path of the file being loaded

mutable: bool

Value of the mutable flag

obj_pairs_func: type[Mapping[Any, Any]]

Type being used for YAML mappings

previous: LoadOptions | None

Pointer to previous options, if this file was loaded by another

relative_to_directory: Path

Path for making relative file paths

sequence_func: type[tuple[Any] | list[Any]]

Type being used for YAML sequences

class granular_configuration_language.yaml.classes.Masked[source]

Bases: str

Used to keep secrets from printing to screen when running tests.

  • Inherits from str.

  • Replaces the standard __repr__() result with the constant literal '<****>'.

  • Used by !Mask tag

Note

Does not alter text or prevent print() from display the string value.

class granular_configuration_language.yaml.classes.Placeholder(message: str)[source]

Bases: object

Representation of !Placeholder tag.

Holds the !Placeholder message.

class granular_configuration_language.yaml.classes.StateHolder(
*,
options: LoadOptions,
lazy_root_obj: LazyRoot,
)[source]

Bases: object

Type: frozen dataclass

Used to pass state define while Loading configuration files into Tags.

lazy_root_obj: LazyRoot

Shared reference to the final root configuration

options: LoadOptions

Options from Loading

class granular_configuration_language.yaml.classes.Tag

NewType used to type tag strings. Must begin with !.

alias of str

class granular_configuration_language.yaml.classes.Root

TypeAlias used by type checking to identify the configuration root if it exists.

alias of RootType | None

class granular_configuration_language.yaml.classes.RootType

NewType used to type the configuration root.

Aliases Mapping as root has to be a mapping for it to be used, and no Tag should mutate it.

alias of Mapping

Internal Typing Variables

class granular_configuration_language.yaml.classes.P

alias of ParamSpec(‘P’)

class granular_configuration_language.yaml.classes.T

Generic Type

alias of TypeVar(‘T’)

class granular_configuration_language.yaml.classes.RT

Generic Return Type

alias of TypeVar(‘RT’)

class granular_configuration_language.yaml.classes.IT

Generic Intermediate Type

alias of TypeVar(‘IT’)

class granular_configuration_language.yaml.classes.KT

Type of the Key on Mappings

alias of TypeVar(‘KT’, bound= Hashable, default= Any)

class granular_configuration_language.yaml.classes.VT

Type of the Value on Mappings

alias of TypeVar(‘VT’, default= Any)

class granular_configuration_language._configuration.C

Generic Type that must be Configuration or a subclass

alias of TypeVar(‘C’, bound=Configuration)