Skip to content

Io

schemas.io.YamlIO

Bases: ABC

Handles YAML inputs and outputs.

from_yaml(yaml_paths)

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

TODO: Need to fix with new Pydantic framework.

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.

TODO: Need to fix with new Pydantic framework.

PARAMETER DESCRIPTION
file_path

Path to the YAML file to write the serialized data to.

TYPE: str

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]