diff --git a/src/antsibull_changelog/yaml.py b/src/antsibull_changelog/yaml.py index 633a3c6..c8afb5d 100644 --- a/src/antsibull_changelog/yaml.py +++ b/src/antsibull_changelog/yaml.py @@ -15,16 +15,21 @@ import yaml _SafeLoader: Any -_SafeDumper: Any try: # use C version if possible for speedup - from yaml import CSafeDumper as _SafeDumper from yaml import CSafeLoader as _SafeLoader except ImportError: - from yaml import SafeDumper as _SafeDumper from yaml import SafeLoader as _SafeLoader +class _SafeDumper(yaml.SafeDumper): + """ + Extend YAML dumper to increase indent of list items. + """ + def increase_indent(self, flow=False, indentless=False): + return super().increase_indent(flow, False) + + def load_yaml(path: str) -> Any: """ Load and parse YAML file ``path``.