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

Method get_guesses

mypy/suggestions.py:405–421  ·  view source on GitHub ↗

Compute a list of guesses for a function's type. This focuses just on the argument types, and doesn't change the provided return type.

(
        self,
        is_method: bool,
        base: CallableType,
        defaults: list[Type | None],
        callsites: list[Callsite],
        uses: list[list[Type]],
    )

Source from the content-addressed store, hash-verified

403 ]
404
405 def get_guesses(
406 self,
407 is_method: bool,
408 base: CallableType,
409 defaults: list[Type | None],
410 callsites: list[Callsite],
411 uses: list[list[Type]],
412 ) -> list[CallableType]:
413 """Compute a list of guesses for a function's type.
414
415 This focuses just on the argument types, and doesn't change the provided return type.
416 """
417 options = self.get_args(is_method, base, defaults, callsites, uses)
418
419 # Take the first `max_guesses` guesses.
420 product = itertools.islice(itertools.product(*options), 0, self.max_guesses)
421 return [refine_callable(base, base.copy_modified(arg_types=list(x))) for x in product]
422
423 def get_callsites(self, func: FuncDef) -> tuple[list[Callsite], list[str]]:
424 """Find all call sites of a function."""

Callers 1

get_suggestionMethod · 0.95

Calls 4

get_argsMethod · 0.95
refine_callableFunction · 0.85
listClass · 0.85
copy_modifiedMethod · 0.45

Tested by

no test coverage detected