MCPcopy
hub / github.com/pytest-dev/pytest / getstatementrange

Method getstatementrange

src/_pytest/_code/source.py:101–107  ·  view source on GitHub ↗

Return (start, end) tuple which spans the minimal statement region which containing the given lineno.

(self, lineno: int)

Source from the content-addressed store, hash-verified

99 return self[start:end]
100
101 def getstatementrange(self, lineno: int) -> tuple[int, int]:
102 """Return (start, end) tuple which spans the minimal statement region
103 which containing the given lineno."""
104 if not (0 <= lineno < len(self)):
105 raise IndexError("lineno out of range")
106 _ast, start, end = getstatementrange_ast(lineno, self)
107 return start, end
108
109 def deindent(self) -> Source:
110 """Return a new Source object deindented."""

Calls 1

getstatementrange_astFunction · 0.85