Generic interface to the inspector system. This function is meant to be called by pdef, pdoc & friends.
(self, meth, oname, namespaces=None, **kw)
| 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""" |