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

Function findsource

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

Source from the content-addressed store, hash-verified

117
118
119def findsource(obj) -> Tuple[Optional[Source], int]:
120 try:
121 sourcelines, lineno = inspect.findsource(obj)
122 except Exception:
123 return None, -1
124 source = Source()
125 source.lines = [line.rstrip() for line in sourcelines]
126 return source, lineno
127
128
129def 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