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

Method run_command

mypy/dmypy_server.py:277–290  ·  view source on GitHub ↗

Run a specific command from the registry.

(self, command: str, data: dict[str, object])

Source from the content-addressed store, hash-verified

275 traceback.print_exception(*exc_info)
276
277 def run_command(self, command: str, data: dict[str, object]) -> dict[str, object]:
278 """Run a specific command from the registry."""
279 key = "cmd_" + command
280 method = getattr(self.__class__, key, None)
281 if method is None:
282 return {"error": f"Unrecognized command '{command}'"}
283 else:
284 if command not in {"check", "recheck", "run"}:
285 # Only the above commands use some error formatting.
286 del data["is_tty"]
287 del data["terminal_width"]
288 ret = method(self, **data)
289 assert isinstance(ret, dict)
290 return ret
291
292 # Command functions (run in the server via RPC).
293

Callers 1

serveMethod · 0.95

Calls 2

getattrFunction · 0.85
isinstanceFunction · 0.85

Tested by

no test coverage detected