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

Method psource

IPython/core/oinspect.py:539–552  ·  view source on GitHub ↗

Print the source code for an object.

(self, obj, oname='')

Source from the content-addressed store, hash-verified

537 page.page('\n'.join(lines))
538
539 def psource(self, obj, oname=''):
540 """Print the source code for an object."""
541
542 # Flush the source cache because inspect can return out-of-date source
543 linecache.checkcache()
544 try:
545 src = getsource(obj, oname=oname)
546 except Exception:
547 src = None
548
549 if src is None:
550 self.noinfo('source', oname)
551 else:
552 page.page(self.format(src))
553
554 def pfile(self, obj, oname=''):
555 """Show the whole file where an object was defined."""

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected