mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
Explicitly check for ast.Name
This commit is contained in:
parent
805530fe29
commit
df93509aed
2 changed files with 3 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ class BuiltinTypeVisitor(ast.NodeVisitor):
|
|||
return self.allow_dict_kwargs and (getattr(node, 'kwargs', None) or getattr(node, 'keywords', None))
|
||||
|
||||
def visit_Call(self, node):
|
||||
if isinstance(node.func, ast.Attribute):
|
||||
if not isinstance(node.func, ast.Name):
|
||||
# Ignore functions that are object attributes (`foo.bar()`).
|
||||
# Assume that if the user calls `builtins.list()`, they know what
|
||||
# they're doing.
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ def visitor():
|
|||
@pytest.mark.parametrize(
|
||||
('expression', 'calls'),
|
||||
[
|
||||
# see #285
|
||||
('x[0]()', []),
|
||||
# complex
|
||||
("0j", []),
|
||||
("complex()", [BuiltinTypeCall('complex', 1, 0)]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue