mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2025-08-14 09:27:21 +08:00
Fix resource warnings
This commit is contained in:
@ -18,7 +18,8 @@ def check_ast(argv=None):
|
||||
for filename in args.filenames:
|
||||
|
||||
try:
|
||||
ast.parse(open(filename, 'rb').read(), filename=filename)
|
||||
with open(filename, 'rb') as f:
|
||||
ast.parse(f.read(), filename=filename)
|
||||
except SyntaxError:
|
||||
print('{}: failed parsing with {} {}:'.format(
|
||||
filename,
|
||||
|
Reference in New Issue
Block a user