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

Function findsource

src/_pytest/_code/source.py:125–133  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

123
124
125def findsource(obj) -> tuple[Source | None, int]:
126 try:
127 sourcelines, lineno = inspect.findsource(obj)
128 except Exception:
129 return None, -1
130 source = Source()
131 source.lines = [line.rstrip() for line in sourcelines]
132 source.raw_lines = sourcelines
133 return source, lineno
134
135
136def getrawcode(obj: object, trycall: bool = True) -> types.CodeType:

Callers 4

fullsourceMethod · 0.90
getfslinenoFunction · 0.90
test_findsource_fallbackFunction · 0.90
test_findsourceFunction · 0.90

Calls 1

SourceClass · 0.85

Tested by 2

test_findsource_fallbackFunction · 0.72
test_findsourceFunction · 0.72