MCPcopy Index your code
hub / github.com/python/cpython / do_source

Method do_source

Lib/pdb.py:2233–2250  ·  view source on GitHub ↗

source expression Try to get source code for the given object and display it.

(self, arg)

Source from the content-addressed store, hash-verified

2231 do_ll = do_longlist
2232
2233 def do_source(self, arg):
2234 """source expression
2235
2236 Try to get source code for the given object and display it.
2237 """
2238 if not arg:
2239 self._print_invalid_arg(arg)
2240 return
2241 try:
2242 obj = self._getval(arg)
2243 except:
2244 return
2245 try:
2246 lines, lineno = self._getsourcelines(obj)
2247 except (OSError, TypeError) as err:
2248 self.error(err)
2249 return
2250 self._print_lines(lines, lineno)
2251
2252 complete_source = _complete_expression
2253

Callers

nothing calls this directly

Calls 5

_print_invalid_argMethod · 0.95
_getvalMethod · 0.95
_getsourcelinesMethod · 0.95
errorMethod · 0.95
_print_linesMethod · 0.95

Tested by

no test coverage detected