MCPcopy
hub / github.com/python/mypy / cmd_suggest

Method cmd_suggest

mypy/dmypy_server.py:981–1003  ·  view source on GitHub ↗

Suggest a signature for a function.

(self, function: str, callsites: bool, **kwargs: Any)

Source from the content-addressed store, hash-verified

979 return result
980
981 def cmd_suggest(self, function: str, callsites: bool, **kwargs: Any) -> dict[str, object]:
982 """Suggest a signature for a function."""
983 if not self.fine_grained_manager:
984 return {
985 "error": "Command 'suggest' is only valid after a 'check' command"
986 " (that produces no parse errors)"
987 }
988 engine = SuggestionEngine(self.fine_grained_manager, **kwargs)
989 try:
990 if callsites:
991 out = engine.suggest_callsites(function)
992 else:
993 out = engine.suggest(function)
994 except SuggestionFailure as err:
995 return {"error": str(err)}
996 else:
997 if not out:
998 out = "No suggestions\n"
999 elif not out.endswith("\n"):
1000 out += "\n"
1001 return {"out": out, "err": "", "status": 0}
1002 finally:
1003 self.flush_caches()
1004
1005 def cmd_hang(self) -> dict[str, object]:
1006 """Hang for 100 seconds, as a debug hack."""

Callers 1

maybe_suggestMethod · 0.80

Calls 6

suggest_callsitesMethod · 0.95
suggestMethod · 0.95
flush_cachesMethod · 0.95
SuggestionEngineClass · 0.90
strClass · 0.85
endswithMethod · 0.45

Tested by 1

maybe_suggestMethod · 0.64