MCPcopy Index your code
hub / github.com/RustPython/RustPython / getsourcelines

Function getsourcelines

Lib/pdb.py:106–113  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

104 return None
105
106def getsourcelines(obj):
107 lines, lineno = inspect.findsource(obj)
108 if inspect.isframe(obj) and obj.f_globals is obj.f_locals:
109 # must be a module frame: do not try to cut a block out of it
110 return lines, 1
111 elif inspect.ismodule(obj):
112 return lines, 1
113 return inspect.getblock(lines[lineno:]), lineno+1
114
115def lasti2lineno(code, lasti):
116 linestarts = list(dis.findlinestarts(code))

Callers 2

do_longlistMethod · 0.70
do_sourceMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected