granular_configuration_language .yaml.file_ops

granular_configuration_language.yaml.file_ops.as_environment_variable_path(
tag: Tag,
variable_name: str,
options: LoadOptions,
) Path[source]

Added in version 2.3.0.

Converts the environment variable to a Path and checks if it has already been loaded.

Note

Uses a reserved file extension.

Parameters:
  • tag (Tag) – Tag doing this, used for error reporting.

  • variable_name (str) – Name of the environment variable being loaded

  • options (LoadOptions) – options from the Tag doing this action, used for tracking chains.

Returns:

Path instance

Return type:

Path

granular_configuration_language.yaml.file_ops.as_file_path(
tag: Tag,
file_name: str,
options: LoadOptions,
) Path[source]

Added in version 2.3.0.

Converts the relative file name to a Path and checks if it has already been loaded.

Parameters:
  • tag (Tag) – Tag doing this, used for error reporting.

  • file_name (str) – Name of the file being loaded

  • options (LoadOptions) – options from the Tag doing this action, used for tracking chains.

Returns:

Path instance

Return type:

Path

class granular_configuration_language.yaml.file_ops.EagerIOBinaryFile(
path: Path,
exists: bool,
data: bytes,
)[source]

Bases: object

Type: frozen dataclass

Added in version 2.3.0.

Encapsulates a file that has been read as binary.

data: bytes

Contents of the file, if the file exists, else an empty bytes

exists: bool

True, if the file exists, else False

path: Path

File path

class granular_configuration_language.yaml.file_ops.EagerIOTextFile(
path: Path,
exists: bool,
data: str,
)[source]

Bases: object

Type: frozen dataclass

Added in version 2.3.0.

Encapsulates a file that has been read as text.

data: str

Contents of the file, if the file exists, else an empty str

exists: bool

True, if the file exists, else False

path: Path

File path