Replace unguaranteed file closing with 'with' statement in release_noter
As this will automatically close the open file no matter what; cf. [1].
[1] https://www.python.org/dev/peps/pep-0343
Change-Id: I1f8ce004763917014f23bb168fa63d954df56c13
diff --git a/tools/release_noter/release_noter.py b/tools/release_noter/release_noter.py
index eb00d5d..2702764 100644
--- a/tools/release_noter/release_noter.py
+++ b/tools/release_noter/release_noter.py
@@ -268,11 +268,10 @@
def print_notes(commits, submodules):
- md = open("release_noter.md", "w")
- md.write("# Release Notes\n")
- print_submodules(submodules, md)
- print_commits(commits, md)
- md.close()
+ with open("release_noter.md", "w") as md:
+ md.write("# Release Notes\n")
+ print_submodules(submodules, md)
+ print_commits(commits, md)
if __name__ == "__main__":