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

Method getstatement

src/_pytest/_code/source.py:95–99  ·  view source on GitHub ↗

Return Source statement which contains the given linenumber (counted from 0).

(self, lineno: int)

Source from the content-addressed store, hash-verified

93 return newsource
94
95 def getstatement(self, lineno: int) -> Source:
96 """Return Source statement which contains the given linenumber
97 (counted from 0)."""
98 start, end = self.getstatementrange(lineno)
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

Callers 6

statementMethod · 0.80
statementMethod · 0.80
_getindentMethod · 0.80
test_getstatementMethod · 0.80
test_patched_compileFunction · 0.80

Calls 1

getstatementrangeMethod · 0.95

Tested by 3

test_getstatementMethod · 0.64
test_patched_compileFunction · 0.64