utils.format
format_as_yaml
Format data as YAML with multiline string support.
This function uses a custom YAML dumper that automatically formats strings containing newlines as multiline YAML strings using the ‘|’ style, and enums as their string values.
def format_as_yaml(data: Any, strip_spaces: str | None = None, **kwargs: Any) -> strdataAny-
The data to format as YAML
strip_spacesstr | None-
Strip mode for string processing. Options: - ‘trailing’: Remove trailing spaces from each line - ‘lines’: Remove all spaces/tabs from lines composed entirely of spaces/tabs
**kwargsAny-
Additional arguments passed to yaml.dump()
Returns
The formatted YAML string