MCPcopy Create free account
hub / github.com/python/mypy / get_definition

Method get_definition

mypy/inspections.py:603–611  ·  view source on GitHub ↗

Get symbol definitions of expression(s) at a location.

(self, location: str)

Source from the content-addressed store, hash-verified

601 return self.run_inspection(location, self.expr_attrs)
602
603 def get_definition(self, location: str) -> dict[str, object]:
604 """Get symbol definitions of expression(s) at a location."""
605 result = self.run_inspection(location, self.expression_def)
606 if "out" in result and not result["out"]:
607 # None of the expressions found turns out to be a RefExpr.
608 _, location = location.split(":", maxsplit=1)
609 result["out"] = f"No name or member expressions at {location}"
610 result["status"] = 1
611 return result
612
613
614def parse_location(location: str) -> tuple[str, list[int]]:

Callers 1

cmd_inspectMethod · 0.95

Calls 2

run_inspectionMethod · 0.95
splitMethod · 0.80

Tested by

no test coverage detected