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

Method _inspect

IPython/core/interactiveshell.py:1872–1904  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

1870 return self._ofind(oname, namespaces)
1871
1872 def _inspect(self, meth, oname: str, namespaces=None, **kw):
1873 """Generic interface to the inspector system.
1874
1875 This function is meant to be called by pdef, pdoc & friends.
1876 """
1877 info: OInfo = self._object_find(oname, namespaces)
1878 if self.sphinxify_docstring:
1879 if sphinxify is None:
1880 raise ImportError("Module ``docrepr`` required but missing")
1881 docformat = sphinxify(self.object_inspect(oname))
1882 else:
1883 docformat = None
1884 if info.found or hasattr(info.parent, oinspect.HOOK_NAME):
1885 pmethod = getattr(self.inspector, meth)
1886 # TODO: only apply format_screen to the plain/text repr of the mime
1887 # bundle.
1888 formatter = format_screen if info.ismagic else docformat
1889 if meth == 'pdoc':
1890 pmethod(info.obj, oname, formatter)
1891 elif meth == 'pinfo':
1892 pmethod(
1893 info.obj,
1894 oname,
1895 formatter,
1896 info,
1897 enable_html_pager=self.enable_html_pager,
1898 **kw,
1899 )
1900 else:
1901 pmethod(info.obj, oname)
1902 else:
1903 print('Object `%s` not found.' % oname)
1904 return 'not found' # so callers can take other action
1905
1906 def object_inspect(self, oname, detail_level=0):
1907 """Get object info about oname"""

Callers 14

pinfoMethod · 0.80
pinfo2Method · 0.80
pdefMethod · 0.80
pdocMethod · 0.80
psourceMethod · 0.80
pfileMethod · 0.80
test_pinfo_bool_raiseFunction · 0.80
test_pinfo_getindexFunction · 0.80
test_pinfo_nonasciiFunction · 0.80
test_pinfo_typeFunction · 0.80

Calls 3

_object_findMethod · 0.95
object_inspectMethod · 0.95
sphinxifyFunction · 0.85

Tested by 8

test_pinfo_bool_raiseFunction · 0.64
test_pinfo_getindexFunction · 0.64
test_pinfo_nonasciiFunction · 0.64
test_pinfo_typeFunction · 0.64
test_pinfo_magicFunction · 0.64