Skip to content

Commit 8e26a09

Browse files
committed
Update is_dunder_method to pass type checking
1 parent 1890185 commit 8e26a09

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

flake8_unused_arguments.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ def is_stub_function(function: FunctionTypes) -> bool:
261261
def is_dunder_method(function: FunctionTypes) -> bool:
262262
if isinstance(function, ast.Lambda):
263263
return False
264+
265+
if not hasattr(function, "name"):
266+
return False
267+
264268
name = function.name
265-
return name and len(name) > 4 and name.startswith("__") and name.endswith("__")
269+
return len(name) > 4 and name.startswith("__") and name.endswith("__")
266270

267271

268272
class FunctionFinder(NodeVisitor):

0 commit comments

Comments
 (0)