@@ -55,14 +55,14 @@ def __init__(self, qualifed_name: str, source_code: str) -> None:
5555 self .name = qualifed_name .split ("." )[- 1 ]
5656 self .results : list [int ] = [] # map actual line number to line number in ast
5757
58- def visit_Call (self , node ): # noqa: ANN201, ANN001
58+ def visit_Call (self , node ): # type: ignore[no-untyped-def] # noqa: ANN201, ANN001
5959 """Detect fn calls."""
60- func_name = self ._get_called_func_name (node .func )
60+ func_name = self ._get_called_func_name (node .func ) # type: ignore[no-untyped-call]
6161 if func_name == self .name :
6262 self .results .append (node .lineno - 1 )
6363 self .generic_visit (node )
6464
65- def _get_called_func_name (self , node ): # noqa: ANN001, ANN202
65+ def _get_called_func_name (self , node ): # type: ignore[no-untyped-def] # noqa: ANN001, ANN202
6666 """Return name of called fn."""
6767 if isinstance (node , ast .Name ):
6868 return node .id
@@ -130,10 +130,12 @@ def leave_FunctionDef(self, original_node: cst.FunctionDef, updated_node: cst.Fu
130130 return updated_node
131131
132132 def leave_SimpleStatementLine (
133- self , original_node : cst .SimpleStatementLine , updated_node : cst .SimpleStatementLine
133+ self ,
134+ original_node : cst .SimpleStatementLine , # noqa: ARG002
135+ updated_node : cst .SimpleStatementLine ,
134136 ) -> cst .SimpleStatementLine :
135137 # Check if this statement line contains a call to self.name
136- if self ._contains_myfunc_call (updated_node ):
138+ if self ._contains_myfunc_call (updated_node ): # type: ignore[no-untyped-call]
137139 # Find matching test cases by looking for this test function name in the test results
138140 self .cfo_idx_loc_to_look_at += 1
139141 matching_original_times = []
@@ -209,21 +211,21 @@ def leave_SimpleStatementLine(
209211 )
210212 return updated_node
211213
212- def _contains_myfunc_call (self , node ):
214+ def _contains_myfunc_call (self , node ): # type: ignore[no-untyped-def] # noqa : ANN202, ANN001
213215 """Recursively search for any Call node in the statement whose function is named self.name (including obj.myfunc)."""
214216
215217 class Finder (cst .CSTVisitor ):
216- def __init__ (self , name : str ):
218+ def __init__ (self , name : str ) -> None :
217219 super ().__init__ ()
218220 self .found = False
219221 self .name = name
220222
221- def visit_Call (self , call_node ):
223+ def visit_Call (self , call_node ) -> None : # type: ignore[no-untyped-def] # noqa : ANN001
222224 func_expr = call_node .func
223225 if isinstance (func_expr , cst .Name ):
224226 if func_expr .value == self .name :
225227 self .found = True
226- elif isinstance (func_expr , cst .Attribute ):
228+ elif isinstance (func_expr , cst .Attribute ): # noqa : SIM102
227229 if func_expr .attr .value == self .name :
228230 self .found = True
229231
0 commit comments