anvil/tools/yaml-pretty.py
Ivan A. Melnikov 3fb6c0f0c3 Stricter flake8 check
- remove some flake8 warnings from ignore list;
- enable flake8 for tools;
- fix flake8 warnings for tools.

Change-Id: I5ddb5f7a3c62be1c7f88440bdf82bd93783f46de
2014-01-28 13:44:20 +04:00

25 lines
637 B
Python
Executable File

#!/usr/bin/env python
import sys
import yaml
# See: http://pyyaml.org/wiki/PyYAMLDocumentation
if __name__ == "__main__":
args = list(sys.argv)
args = args[1:]
for fn in args:
fh = open(fn, 'r')
data = yaml.load(fh.read())
fh.close()
formatted = yaml.dump(data,
line_break="\n",
indent=4,
explicit_start=True,
explicit_end=True,
default_flow_style=False,
)
print("# Formatted %s" % (fn))
print(formatted)