pformat_yaml

Contents

pformat_yaml#

tollan.utils.fmt.pformat_yaml(obj: Any) str[source]#

Pretty-format an object as a YAML string.

If the object has a __wrapped__ attribute, formats the wrapped object instead.

Example

>>> data = {'a': 1, 'b': [2, 3]}
>>> print(pformat_yaml(data))
a: 1
b:
    - 2
    - 3