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

Method _get_info

IPython/core/oinspect.py:748–811  ·  view source on GitHub ↗

Retrieve an info dict and format it. Parameters ---------- obj : any Object to inspect and return info from oname : str (default: ''): Name of the variable pointing to `obj`. formatter : callable info already comput

(
        self,
        obj: Any,
        oname: str = "",
        formatter=None,
        info: Optional[OInfo] = None,
        detail_level: int = 0,
        omit_sections: Union[List[str], Tuple[()]] = (),
    )

Source from the content-addressed store, hash-verified

746
747
748 def _get_info(
749 self,
750 obj: Any,
751 oname: str = "",
752 formatter=None,
753 info: Optional[OInfo] = None,
754 detail_level: int = 0,
755 omit_sections: Union[List[str], Tuple[()]] = (),
756 ) -> Bundle:
757 """Retrieve an info dict and format it.
758
759 Parameters
760 ----------
761 obj : any
762 Object to inspect and return info from
763 oname : str (default: ''):
764 Name of the variable pointing to `obj`.
765 formatter : callable
766 info
767 already computed information
768 detail_level : integer
769 Granularity of detail level, if set to 1, give more information.
770 omit_sections : list[str]
771 Titles or keys to omit from output (can be set, tuple, etc., anything supporting `in`)
772 """
773
774 info_dict = self.info(obj, oname=oname, info=info, detail_level=detail_level)
775 omit_sections = list(omit_sections)
776
777 bundle = self._make_info_unformatted(
778 obj,
779 info_dict,
780 formatter,
781 detail_level=detail_level,
782 omit_sections=omit_sections,
783 )
784 if self.mime_hooks:
785 hook_data = InspectorHookData(
786 obj=obj,
787 info=info,
788 info_dict=info_dict,
789 detail_level=detail_level,
790 omit_sections=omit_sections,
791 )
792 for key, hook in self.mime_hooks.items(): # type:ignore
793 required_parameters = [
794 parameter
795 for parameter in inspect.signature(hook).parameters.values()
796 if parameter.default is inspect.Parameter.empty
797 ]
798 if len(required_parameters) == 1:
799 res = hook(hook_data)
800 else:
801 warnings.warn(
802 "MIME hook format changed in IPython 8.22; hooks should now accept"
803 " a single parameter (InspectorHookData); support for hooks requiring"
804 " two-parameters (obj and info) will be removed in a future version",
805 DeprecationWarning,

Callers 2

pinfoMethod · 0.95
object_inspect_mimeMethod · 0.80

Calls 5

infoMethod · 0.95
format_mimeMethod · 0.95
InspectorHookDataClass · 0.85
warnMethod · 0.80

Tested by

no test coverage detected