summaryrefslogtreecommitdiffstats
path: root/subcmds/manifest.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2019-11-11 05:40:22 -0500
committerMike Frysinger <vapier@google.com>2019-11-12 03:44:39 +0000
commit3164d40e2247d42537aef8e80fa7e048e14bec9f (patch)
tree650cc33e3d5c4b39c3cc652e93495e47a170931b /subcmds/manifest.py
parentf4545126197781beb03bb0fd47e7f24ce5af6ca8 (diff)
downloadgit-repo-3164d40e2247d42537aef8e80fa7e048e14bec9f.tar.gz
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>
Diffstat (limited to 'subcmds/manifest.py')
-rw-r--r--subcmds/manifest.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/subcmds/manifest.py b/subcmds/manifest.py
index 768f072e..9c1b3f0c 100644
--- a/subcmds/manifest.py
+++ b/subcmds/manifest.py
@@ -40,10 +40,9 @@ in a Git repository for use during future 'repo init' invocations.
40 helptext = self._helpDescription + '\n' 40 helptext = self._helpDescription + '\n'
41 r = os.path.dirname(__file__) 41 r = os.path.dirname(__file__)
42 r = os.path.dirname(r) 42 r = os.path.dirname(r)
43 fd = open(os.path.join(r, 'docs', 'manifest-format.md')) 43 with open(os.path.join(r, 'docs', 'manifest-format.md')) as fd:
44 for line in fd: 44 for line in fd:
45 helptext += line 45 helptext += line
46 fd.close()
47 return helptext 46 return helptext
48 47
49 def _Options(self, p): 48 def _Options(self, p):