inventory_to_yaml

function of dascore.core.inventory source

inventory_to_yaml(
    inventory: Inventory ,
    path: str | pathlib._local.Path | None[str, Path, None] = None,
)-> ‘str’

Serialize an inventory to YAML, optionally writing it to a path.

Reached as inventory.io.to_yaml.

A field still holding its default is left out, so the document states what the inventory says rather than every field it has; what is written reloads equal to this inventory. A path whose directory is not there yet is made, as it is for every document DASCore writes.

Parameters

Parameter Description
inventory The inventory to serialize.
path Where to write the text, or None to only return it.

Examples

import dascore as dc
_, inventory = dc.examples.inventory_patch_pair()
text = inventory.io.to_yaml()
dc.inventory(text) == inventory
True