Suggest a signature for a function.
(self, function: str, callsites: bool, **kwargs: Any)
| 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.""" |