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

Function parse_location

mypy/inspections.py:614–626  ·  view source on GitHub ↗
(location: str)

Source from the content-addressed store, hash-verified

612
613
614def parse_location(location: str) -> tuple[str, list[int]]:
615 if location.count(":") < 2:
616 raise ValueError("Format should be file:line:column[:end_line:end_column]")
617 parts = location.rsplit(":", maxsplit=2)
618 start, *rest = parts
619 # Note: we must allow drive prefix like `C:` on Windows.
620 if start.count(":") < 2:
621 return start, [int(p) for p in rest]
622 parts = start.rsplit(":", maxsplit=2)
623 start, *start_rest = parts
624 if start.count(":") < 2:
625 return start, [int(p) for p in start_rest + rest]
626 raise ValueError("Format should be file:line:column[:end_line:end_column]")

Callers 2

run_inspectionMethod · 0.85

Calls 4

ValueErrorClass · 0.85
intClass · 0.85
rsplitMethod · 0.80
countMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…