granular_configuration_language .yaml.file_ops.binary

class granular_configuration_language.yaml.file_ops.binary.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

granular_configuration_language.yaml.file_ops.binary.load_binary_file(
file: Path,
/,
) EagerIOBinaryFile[source]

Added in version 2.3.0.

Load the binary file as an EagerIOBinaryFile instance

Parameters:

file (Path) – file path

Returns:

Constructed instance

Return type:

EagerIOBinaryFile

granular_configuration_language.yaml.file_ops.binary.read_binary_data(
filename: Path | EagerIOBinaryFile,
/,
) bytes[source]

Added in version 2.3.0.

Read file contents.

Whether it is already loaded (as an EagerIOBinaryFile instance) or as a Path

Parameters:

filename (Path | EagerIOTextFile) – File path

Raises:

FileNotFoundError – Errors if the file does not exist.

Returns:

File contents.

Return type:

bytes