Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compose_format/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -112,7 +113,7 @@ def fix_sexadecimal_numbers(value):
import re

SEXADECIMAL_NUMBER = '(?P<left>\d+):(?P<right>\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')))
Expand Down