diff --git a/compose_format/__init__.py b/compose_format/__init__.py index d356c89..2167bde 100755 --- a/compose_format/__init__.py +++ b/compose_format/__init__.py @@ -77,7 +77,8 @@ def format(self, path, replace=False, strict=True): def format_string(self, data, replace=False, strict=True): data = self.reorder(load(data, RoundTripLoader), strict=strict) - formatted = dump(data, Dumper=RoundTripDumper, indent=2, width=120) + formatted = dump(data, Dumper=RoundTripDumper, + indent=2, block_seq_indent=2, width=120) return formatted.strip() + '\n' @@ -112,7 +113,7 @@ def fix_sexadecimal_numbers(value): import re SEXADECIMAL_NUMBER = '(?P\d+):(?P\d+)' - match = re.match(SEXADECIMAL_NUMBER, value) + match = re.match(SEXADECIMAL_NUMBER, str(value)) if not match or int(match.group('left')) > 60 or int(match.group('right')) > 60: return value return SingleQuotedScalarString('{0}:{1}'.format(match.group('left'), match.group('right')))