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

Method info

IPython/core/oinspect.py:854–1090  ·  view source on GitHub ↗

Compute a dict with detailed information about an object. Parameters ---------- obj : any An object to find information about oname : str (default: '') Name of the variable pointing to `obj`. info : (default: None) A struct

(self, obj, oname="", info=None, detail_level=0)

Source from the content-addressed store, hash-verified

852 page.page(info_b)
853
854 def info(self, obj, oname="", info=None, detail_level=0) -> InfoDict:
855 """Compute a dict with detailed information about an object.
856
857 Parameters
858 ----------
859 obj : any
860 An object to find information about
861 oname : str (default: '')
862 Name of the variable pointing to `obj`.
863 info : (default: None)
864 A struct (dict like with attr access) with some information fields
865 which may have been precomputed already.
866 detail_level : int (default:0)
867 If set to 1, more information is given.
868
869 Returns
870 -------
871 An object info dict with known fields from `info_fields` (see `InfoDict`).
872 """
873
874 if info is None:
875 ismagic = False
876 isalias = False
877 ospace = ''
878 else:
879 ismagic = info.ismagic
880 isalias = info.isalias
881 ospace = info.namespace
882
883 # Get docstring, special-casing aliases:
884 att_name = oname.split(".")[-1]
885 parents_docs = None
886 prelude = ""
887 if info and info.parent is not None and hasattr(info.parent, HOOK_NAME):
888 parents_docs_dict = getattr(info.parent, HOOK_NAME)
889 if isinstance(parents_docs_dict, dict):
890 parents_docs = parents_docs_dict.get(att_name, None)
891 out: InfoDict = cast(
892 InfoDict,
893 {
894 **{field: None for field in _info_fields},
895 **{
896 "name": oname,
897 "found": True,
898 "isalias": isalias,
899 "ismagic": ismagic,
900 "subclasses": None,
901 },
902 },
903 )
904
905 if parents_docs:
906 ds = parents_docs
907 elif isalias:
908 if not callable(obj):
909 try:
910 ds = "Alias to the system command:\n %s" % obj[1]
911 except:

Callers 15

_get_infoMethod · 0.95
enable_guiMethod · 0.80
init_profile_dirMethod · 0.80
init_gui_pylabMethod · 0.80
init_extensionsMethod · 0.80
_run_exec_linesMethod · 0.80
_exec_fileMethod · 0.80
_run_cmd_line_codeMethod · 0.80
_import_appMethod · 0.80
object_inspectMethod · 0.80
test_reset_redefineMethod · 0.80
test_infoFunction · 0.80

Calls 9

_getdefMethod · 0.95
compress_userFunction · 0.90
safe_hasattrFunction · 0.90
getdocFunction · 0.85
find_fileFunction · 0.85
getsourceFunction · 0.85
is_simple_callableFunction · 0.85
getMethod · 0.80

Tested by 12

test_reset_redefineMethod · 0.64
test_infoFunction · 0.64
test_class_signatureFunction · 0.64
test_info_awkwardFunction · 0.64
test_bool_raiseFunction · 0.64
test_info_serialliarFunction · 0.64
test_calldef_noneFunction · 0.64
test_property_sourcesFunction · 0.64
test_init_colorsFunction · 0.64
test_builtin_initFunction · 0.64