MCPcopy Create free account
hub / github.com/pytest-dev/pytest / getstatementrange

Method getstatementrange

src/_pytest/_code/source.py:96–102  ·  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

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

Calls 1

getstatementrange_astFunction · 0.85