@@ -70,7 +70,7 @@ def run(self) -> Iterable[LintResult]:
7070 if self .ignore_stubs and is_stub_function (function ):
7171 continue
7272
73- for i , argument in enumerate ( get_unused_arguments (function ) ):
73+ for i , argument in get_unused_arguments (function ):
7474 name = argument .arg
7575 if self .ignore_variadic_names :
7676 if function .args .vararg and function .args .vararg .arg == name :
@@ -97,17 +97,17 @@ def run(self) -> Iterable[LintResult]:
9797 yield (line_number , offset , text , check )
9898
9999
100- def get_unused_arguments (function : FunctionTypes ) -> List [ast .arg ]:
100+ def get_unused_arguments (function : FunctionTypes ) -> List [Tuple [ int , ast .arg ] ]:
101101 """Generator that yields all of the unused arguments in the given function."""
102- arguments = get_arguments (function )
102+ arguments = list ( enumerate ( get_arguments (function )) )
103103
104104 class NameFinder (NodeVisitor ):
105105 def visit_Name (self , name : ast .Name ) -> None :
106106 nonlocal arguments
107107 if isinstance (name .ctx , Store ):
108108 return
109109
110- arguments = [arg for arg in arguments if arg .arg != name .id ]
110+ arguments = [( arg_index , arg ) for arg_index , arg in arguments if arg .arg != name .id ]
111111
112112 NameFinder ().visit (function )
113113
0 commit comments