yaml#

Helper functions for reading and writing to YAML files.

create_prettier_round_trip_yaml() YAML[source]#
read_preserved_yaml(src: str) Any[source]#

Get a ruamel.yaml object from a YAML string.

>>> formatted_obj = read_preserved_yaml("[--line-length=85]")
>>> formatted_obj
['--line-length=85']
>>> type(formatted_obj)
<class 'ruamel.yaml.comments.CommentedSeq'>
write_yaml(definition: dict, output_path: Path | str) None[source]#

Write a dict to disk with standardized YAML formatting.