MCPcopy Create free account
hub / github.com/ipython/ipython / psource

Method psource

IPython/core/oinspect.py:477–490  ·  view source on GitHub ↗

Print the source code for an object.

(self, obj, oname='')

Source from the content-addressed store, hash-verified

475 page.page('\n'.join(lines))
476
477 def psource(self, obj, oname=''):
478 """Print the source code for an object."""
479
480 # Flush the source cache because inspect can return out-of-date source
481 linecache.checkcache()
482 try:
483 src = getsource(obj, oname=oname)
484 except Exception:
485 src = None
486
487 if src is None:
488 self.noinfo('source', oname)
489 else:
490 page.page(self.format(src))
491
492 def pfile(self, obj, oname=''):
493 """Show the whole file where an object was defined."""

Callers

nothing calls this directly

Calls 4

noinfoMethod · 0.95
getsourceFunction · 0.85
pageMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected