mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
packaging: use with open() instead of try/finally: close
This commit is contained in:
parent
0e3f3a7076
commit
21a9c748aa
11 changed files with 41 additions and 69 deletions
|
@ -720,17 +720,15 @@ class EggInfoToDistInfoTestCase(support.TempdirManager,
|
|||
dir_paths.append(path)
|
||||
for f in files:
|
||||
path = os.path.join(tempdir, f)
|
||||
_f = open(path, 'w')
|
||||
_f.write(f)
|
||||
_f.close()
|
||||
with open(path, 'w') as _f:
|
||||
_f.write(f)
|
||||
file_paths.append(path)
|
||||
|
||||
record_file = open(record_file_path, 'w')
|
||||
for fpath in file_paths:
|
||||
record_file.write(fpath + '\n')
|
||||
for dpath in dir_paths:
|
||||
record_file.write(dpath + '\n')
|
||||
record_file.close()
|
||||
with open(record_file_path, 'w') as record_file:
|
||||
for fpath in file_paths:
|
||||
record_file.write(fpath + '\n')
|
||||
for dpath in dir_paths:
|
||||
record_file.write(dpath + '\n')
|
||||
|
||||
return (tempdir, record_file_path)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue