From 64af395373187b2482def4c982e8af4c0251bea2 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sun, 23 Sep 2012 21:14:46 -0700 Subject: [PATCH] Update tools/yaml-pretty.py --- tools/yaml-pretty.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/yaml-pretty.py b/tools/yaml-pretty.py index 1355e9be..7d91dc8f 100755 --- a/tools/yaml-pretty.py +++ b/tools/yaml-pretty.py @@ -11,10 +11,9 @@ if __name__ == "__main__": args = list(sys.argv) args = args[1:] for fn in args: - data = None - with open(fn, 'r') as fh: - data = yaml.load(fh.read()) - fh.close() + fh = open(fn, 'r') + data = yaml.load(fh.read()) + fh.close() formatted = yaml.dump(data, line_break="\n", indent=4, @@ -22,4 +21,5 @@ if __name__ == "__main__": explicit_end=True, default_flow_style=False, ) - print formatted + print("# Formatted %s" % (fn)) + print(formatted) \ No newline at end of file