mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
python: Migrate open statements to use with.
This is low priority, but it's nice to be consistently using the best practice pattern. Fixes: #12419.
This commit is contained in:
@@ -7,7 +7,8 @@ def show_all_branches(fns):
|
||||
# type: (List[str]) -> None
|
||||
for fn in fns:
|
||||
print(fn)
|
||||
text = open(fn).read()
|
||||
with open(fn, 'r') as f:
|
||||
text = f.read()
|
||||
branches = html_branches(text, fn=fn)
|
||||
for branch in branches:
|
||||
print(branch.text())
|
||||
@@ -25,7 +26,8 @@ class Grepper:
|
||||
all_branches = [] # type: List[HtmlTreeBranch]
|
||||
|
||||
for fn in fns:
|
||||
text = open(fn).read()
|
||||
with open(fn, 'r') as f:
|
||||
text = f.read()
|
||||
branches = html_branches(text, fn=fn)
|
||||
all_branches += branches
|
||||
|
||||
|
||||
Reference in New Issue
Block a user