mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fix several ResourceWarning: unclosed file
This commit is contained in:
parent
abee146199
commit
67d6fcb0f6
10 changed files with 78 additions and 34 deletions
|
|
@ -43,7 +43,8 @@ def _read_state(prefix, venv):
|
|||
if not os.path.exists(filename):
|
||||
return None
|
||||
else:
|
||||
return json.loads(io.open(filename).read())
|
||||
with io.open(filename) as f:
|
||||
return json.loads(f.read())
|
||||
|
||||
|
||||
def _write_state(prefix, venv, state):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue