mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-14 17:31:28 +08:00
Fix resource warnings
This commit is contained in:
@ -36,7 +36,8 @@ class DebugStatementParser(ast.NodeVisitor):
|
||||
|
||||
def check_file(filename):
|
||||
try:
|
||||
ast_obj = ast.parse(open(filename, 'rb').read(), filename=filename)
|
||||
with open(filename, 'rb') as f:
|
||||
ast_obj = ast.parse(f.read(), filename=filename)
|
||||
except SyntaxError:
|
||||
print('{} - Could not parse ast'.format(filename))
|
||||
print()
|
||||
|
Reference in New Issue
Block a user