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

Function getsource

Lib/inspect.py:1155–1162  ·  view source on GitHub ↗

Return the text of the source code for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a single string. An OSError is raised if the source code cannot be retrieved.

(object)

Source from the content-addressed store, hash-verified

1153 return getblock(lines[lnum:]), lnum + 1
1154
1155def getsource(object):
1156 """Return the text of the source code for an object.
1157
1158 The argument may be a module, class, method, function, traceback, frame,
1159 or code object. The source code is returned as a single string. An
1160 OSError is raised if the source code cannot be retrieved."""
1161 lines, lnum = getsourcelines(object)
1162 return ''.join(lines)
1163
1164# --------------------------------------------------- class tree extraction
1165def walktree(classes, children, parent):

Callers 1

_mainFunction · 0.85

Calls 2

getsourcelinesFunction · 0.70
joinMethod · 0.45

Tested by

no test coverage detected