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

Method _make_info_unformatted

IPython/core/oinspect.py:669–745  ·  view source on GitHub ↗

Assemble the mimebundle as unformatted lists of information

(
        self, obj, info, formatter, detail_level, omit_sections
    )

Source from the content-addressed store, hash-verified

667 bundle["text/html"].append((title, formatted_field["text/html"]))
668
669 def _make_info_unformatted(
670 self, obj, info, formatter, detail_level, omit_sections
671 ) -> UnformattedBundle:
672 """Assemble the mimebundle as unformatted lists of information"""
673 bundle: UnformattedBundle = {
674 "text/plain": [],
675 "text/html": [],
676 }
677
678 # A convenience function to simplify calls below
679 def append_field(
680 bundle: UnformattedBundle, title: str, key: str, formatter=None
681 ):
682 self._append_info_field(
683 bundle,
684 title=title,
685 key=key,
686 info=info,
687 omit_sections=omit_sections,
688 formatter=formatter,
689 )
690
691 def code_formatter(text) -> Bundle:
692 return {
693 'text/plain': self.format(text),
694 'text/html': pylight(text)
695 }
696
697 if info["isalias"]:
698 append_field(bundle, "Repr", "string_form")
699
700 elif info['ismagic']:
701 if detail_level > 0:
702 append_field(bundle, "Source", "source", code_formatter)
703 else:
704 append_field(bundle, "Docstring", "docstring", formatter)
705 append_field(bundle, "File", "file")
706
707 elif info['isclass'] or is_simple_callable(obj):
708 # Functions, methods, classes
709 append_field(bundle, "Signature", "definition", code_formatter)
710 append_field(bundle, "Init signature", "init_definition", code_formatter)
711 append_field(bundle, "Docstring", "docstring", formatter)
712 if detail_level > 0 and info["source"]:
713 append_field(bundle, "Source", "source", code_formatter)
714 else:
715 append_field(bundle, "Init docstring", "init_docstring", formatter)
716
717 append_field(bundle, "File", "file")
718 append_field(bundle, "Type", "type_name")
719 append_field(bundle, "Subclasses", "subclasses")
720
721 else:
722 # General Python objects
723 append_field(bundle, "Signature", "definition", code_formatter)
724 append_field(bundle, "Call signature", "call_def", code_formatter)
725 append_field(bundle, "Type", "type_name")
726 append_field(bundle, "String form", "string_form")

Callers 1

_get_infoMethod · 0.95

Calls 1

is_simple_callableFunction · 0.85

Tested by

no test coverage detected