MCPcopy Index your code
hub / github.com/python/mypy / get_arg_uses

Function get_arg_uses

mypy/suggestions.py:197–211  ·  view source on GitHub ↗

Find all the types of arguments that each arg is passed to. For example, given def foo(x: int) -> None: ... def bar(x: str) -> None: ... def test(x, y): foo(x) bar(y) this will return [[int], [str]].

(typemap: dict[Expression, Type], func: FuncDef)

Source from the content-addressed store, hash-verified

195
196
197def get_arg_uses(typemap: dict[Expression, Type], func: FuncDef) -> list[list[Type]]:
198 """Find all the types of arguments that each arg is passed to.
199
200 For example, given
201 def foo(x: int) -> None: ...
202 def bar(x: str) -> None: ...
203 def test(x, y):
204 foo(x)
205 bar(y)
206
207 this will return [[int], [str]].
208 """
209 finder = ArgUseFinder(func, typemap)
210 func.body.accept(finder)
211 return [finder.arg_types[arg.variable] for arg in func.arguments]
212
213
214class SuggestionFailure(Exception):

Callers 1

get_suggestionMethod · 0.85

Calls 2

ArgUseFinderClass · 0.85
acceptMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…