python: Close opened files.

Fixes various instances of ‘ResourceWarning: unclosed file’ with
python -Wd.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-24 00:33:54 -07:00
committed by Tim Abbott
parent bb2db31f29
commit 31d0141a30
16 changed files with 156 additions and 134 deletions

View File

@@ -319,7 +319,8 @@ def main(options: argparse.Namespace) -> int:
version_file = os.path.join(UUID_VAR_PATH, 'provision_version')
print(f'writing to {version_file}\n')
open(version_file, 'w').write(PROVISION_VERSION + '\n')
with open(version_file, 'w') as f:
f.write(PROVISION_VERSION + '\n')
print()
print(OKBLUE + "Zulip development environment setup succeeded!" + ENDC)