Fix resource warnings
diff --git a/pre_commit_hooks/check_builtin_literals.py b/pre_commit_hooks/check_builtin_literals.py
index b7f0c00..4a4b9ce 100644
--- a/pre_commit_hooks/check_builtin_literals.py
+++ b/pre_commit_hooks/check_builtin_literals.py
@@ -47,7 +47,8 @@
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