From b21f35dee6a9eb8d9002a909b71abd199933a409 Mon Sep 17 00:00:00 2001 From: gardar Date: Fri, 26 Apr 2024 17:37:38 +0000 Subject: [PATCH] fix: Increase indent of list items in yaml output Signed-off-by: gardar --- src/antsibull_changelog/yaml.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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``.