mirror of https://github.com/CGAL/cgal
Refactor file opening to use 'with' statement
This commit is contained in:
parent
3aa8e3ad73
commit
b2e6a4abb0
|
|
@ -108,7 +108,7 @@ with open(input_report_file_name, "rt", encoding="utf-8") as input_report_file:
|
||||||
if not os.path.isdir(name):
|
if not os.path.isdir(name):
|
||||||
is_ignored = True
|
is_ignored = True
|
||||||
os.mkdir(name)
|
os.mkdir(name)
|
||||||
report_file_handle=open("{dir}/{file}".format(dir=name, file=report_file_name), "w+", encoding="utf-8")
|
with open("{dir}/{file}".format(dir=name, file=report_file_name), "w+", encoding="utf-8") as report_file_handle:
|
||||||
report_file_handle.write(open("{}/../../../../../.scm-branch".format(os.getcwd()), 'r', encoding="utf-8").read())
|
report_file_handle.write(open("{}/../../../../../.scm-branch".format(os.getcwd()), 'r', encoding="utf-8").read())
|
||||||
else:
|
else:
|
||||||
is_ignored = False
|
is_ignored = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue