Skip to content

yaml_dump

A simple YAML dumper to avoid extra dependencies.

Classes

YAMLDumpers

Bases: UserDict

Registry of YAML dumpers.

Functions

add_dumper
add_dumper(data_type: type, dumper: DumperFunc) -> None

Add a YAML dumper.

Functions

dump

dump(data: Any) -> str

Dump a value to a string buffer.

format_bool

format_bool(val: bool) -> str

Return a YAML representation of a bool.

format_date

format_date(val: datetime.date) -> str

Return a YAML representation of a date.

format_datetime

format_datetime(val: datetime.datetime) -> str

Return a string representation of a value.

format_dict

format_dict(val: dict) -> str

Return a YAML representation of a dict.

format_float

format_float(data: float) -> str

Return a YAML representation of a float.

format_int

format_int(val: int) -> str

Return a YAML representation of an int.

format_none

format_none(_: None) -> str

Return a YAML representation of None.

format_sequence

format_sequence(val: Union[list, tuple]) -> str

Return a string representation of a value.

format_str

format_str(val: str) -> str

Return a YAML representation of a string.