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

Method getsourcelines

IPython/core/debugger.py:954–961  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

952 do_l = do_list
953
954 def getsourcelines(self, obj):
955 lines, lineno = inspect.findsource(obj)
956 if inspect.isframe(obj) and obj.f_globals is self._get_frame_locals(obj):
957 # must be a module frame: do not try to cut a block out of it
958 return lines, 1
959 elif inspect.ismodule(obj):
960 return lines, 1
961 return inspect.getblock(lines[lineno:]), lineno + 1
962
963 def do_longlist(self, arg):
964 """Print lines of code from the current stack frame.

Callers 5

do_longlistMethod · 0.95
get_recordsMethod · 0.80
find_source_linesFunction · 0.80
get_line_number_of_frameFunction · 0.80
__init__Method · 0.80

Calls 1

_get_frame_localsMethod · 0.95

Tested by

no test coverage detected