Skip to content

Commit

Permalink
Format whitespace consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPelletier committed Sep 27, 2021
1 parent bbb5c95 commit 0846c9e
Show file tree
Hide file tree
Showing 2 changed files with 1,275 additions and 1,062 deletions.
19 changes: 19 additions & 0 deletions tools/tidy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
from ruamel.yaml import YAML

with open('../utm.yaml', 'r') as f:
lines = f.readlines()
i = 0
while i < len(lines):
line = lines[i]
colon = line.find(':')
is_ref = line.find('$ref:')
if len(line) > 80 and colon > 0 and is_ref == -1:
indent = len(line) - len(line.lstrip())
line1 = line[0:colon+1] + ' >-' + '\n'
line2 = (' ' * (indent + 2)) + line[colon+1:]
lines = lines[0:i] + [line1, line2] + lines[i+1:]
i += 2
else:
i += 1

with open('../utm.yaml', 'w') as f:
f.writelines(lines)

yaml = YAML()
with open('../utm.yaml', 'r') as f:
api = yaml.load(f)
Expand Down
Loading

0 comments on commit 0846c9e

Please sign in to comment.