mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
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:
committed by
Tim Abbott
parent
bb2db31f29
commit
31d0141a30
@@ -10,12 +10,13 @@ from typing import Iterable, List
|
||||
def expand_reqs_helper(fpath: str) -> List[str]:
|
||||
result = [] # type: List[str]
|
||||
|
||||
for line in open(fpath):
|
||||
if line.strip().startswith(('#', '--hash')):
|
||||
continue
|
||||
dep = line.split(" \\", 1)[0].strip()
|
||||
if dep:
|
||||
result.append(dep)
|
||||
with open(fpath) as f:
|
||||
for line in f:
|
||||
if line.strip().startswith(('#', '--hash')):
|
||||
continue
|
||||
dep = line.split(" \\", 1)[0].strip()
|
||||
if dep:
|
||||
result.append(dep)
|
||||
return result
|
||||
|
||||
def expand_reqs(fpath: str) -> List[str]:
|
||||
|
||||
Reference in New Issue
Block a user