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

Method _inspect

IPython/core/interactiveshell.py:1743–1764  ·  view source on GitHub ↗

Generic interface to the inspector system. This function is meant to be called by pdef, pdoc & friends.

(self, meth, oname, namespaces=None, **kw)

Source from the content-addressed store, hash-verified

1741 return Struct(self._ofind(oname, namespaces))
1742
1743 def _inspect(self, meth, oname, namespaces=None, **kw):
1744 """Generic interface to the inspector system.
1745
1746 This function is meant to be called by pdef, pdoc & friends.
1747 """
1748 info = self._object_find(oname, namespaces)
1749 docformat = sphinxify if self.sphinxify_docstring else None
1750 if info.found:
1751 pmethod = getattr(self.inspector, meth)
1752 # TODO: only apply format_screen to the plain/text repr of the mime
1753 # bundle.
1754 formatter = format_screen if info.ismagic else docformat
1755 if meth == 'pdoc':
1756 pmethod(info.obj, oname, formatter)
1757 elif meth == 'pinfo':
1758 pmethod(info.obj, oname, formatter, info,
1759 enable_html_pager=self.enable_html_pager, **kw)
1760 else:
1761 pmethod(info.obj, oname)
1762 else:
1763 print('Object `%s` not found.' % oname)
1764 return 'not found' # so callers can take other action
1765
1766 def object_inspect(self, oname, detail_level=0):
1767 """Get object info about oname"""

Callers 12

test_pinfo_nonasciiFunction · 0.80
test_pinfo_typeFunction · 0.80
test_pinfo_magicFunction · 0.80
pinfoMethod · 0.80
pinfo2Method · 0.80
pdefMethod · 0.80
pdocMethod · 0.80
psourceMethod · 0.80
pfileMethod · 0.80

Calls 1

_object_findMethod · 0.95

Tested by 6

test_pinfo_nonasciiFunction · 0.64
test_pinfo_typeFunction · 0.64
test_pinfo_magicFunction · 0.64