Skip to content

Io

YamlIO

Bases: ABC

Handles YAML inputs and outputs.

from_yaml(yaml_paths)

Update the instance's attributes from one or more YAML files.

PARAMETER DESCRIPTION

yaml_paths

A sequence of YAML file paths or a single YAML file path.

TYPE: str | list[str]

RAISES DESCRIPTION
FileNotFoundError

If any of the YAML files cannot be found.

to_yaml(file_path)

Serialize a Pydantic BaseModel instance to a YAML file. Args: file_path: Path to the YAML file to write the serialized data to.

RAISES DESCRIPTION
YamlIOError

If the file cannot be written to.

update(data)

Iteratively update pydantic model.

PARAMETER DESCRIPTION

data

Key-value mapping to update attributes with.

TYPE: dict[str, Any]