mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-06-26 20:17:52 +00:00
use open context managers in more places
Use open() as a context manager to simplify the close logic and make the code easier to read & understand. This is also more Pythonic. Change-Id: I579d03cca86f99b2c6c6a1f557f6e5704e2515a7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244734 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
5
repo
5
repo
@ -513,9 +513,8 @@ def SetupGnuPG(quiet):
|
||||
sys.exit(1)
|
||||
print()
|
||||
|
||||
fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w')
|
||||
fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n')
|
||||
fd.close()
|
||||
with open(os.path.join(home_dot_repo, 'keyring-version'), 'w') as fd:
|
||||
fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n')
|
||||
return True
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user