mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 20:16:53 +00:00
Fix resource warnings
This commit is contained in:
parent
a193eab99e
commit
5dc306b35d
7 changed files with 14 additions and 7 deletions
|
|
@ -47,7 +47,8 @@ class BuiltinTypeVisitor(ast.NodeVisitor):
|
|||
|
||||
|
||||
def check_file_for_builtin_type_constructors(filename, ignore=None, allow_dict_kwargs=True):
|
||||
tree = ast.parse(open(filename, 'rb').read(), filename=filename)
|
||||
with open(filename, 'rb') as f:
|
||||
tree = ast.parse(f.read(), filename=filename)
|
||||
visitor = BuiltinTypeVisitor(ignore=ignore, allow_dict_kwargs=allow_dict_kwargs)
|
||||
visitor.visit(tree)
|
||||
return visitor.builtin_type_calls
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue