Inheritance diagram for IPython.core.oinspect:
Tools for inspecting Python objects.
Uses syntax highlighting for presenting the various information elements.
Similar in spirit to the inspect module, but all calls take a name argument to reference the name under which an object is being read.
Compute a dict with detailed information about an object.
Optional arguments:
precomputed already.
Generic message when no information is found.
Print the definition header for any callable object.
If the object is a class, print the constructor information.
Print the docstring for any object.
Optional: -formatter: a function to run the docstring through for specially formatted docstrings.
Examples
In [3]: %pdoc NoDoc No documentation found for NoDoc
In [4]: %pdoc NoInit No documentation found for NoInit
In [5]: obj = NoInit()
In [6]: %pdoc obj No documentation found for obj
In [5]: obj2 = NoDoc()
In [6]: %pdoc obj2 No documentation found for obj2
Show the whole file where an object was defined.
Show detailed information about an object.
Optional arguments:
precomputed already.
Search namespaces with wildcards for objects.
Arguments:
searches and optionally a type specification to narrow the search to objects of that type.
Optional arguments:
- ns_search: list of namespace names to include in search.
- ignore_case(False): make the search case-insensitive.
- show_all(False): show all names, including those starting with
underscores.
Print the source code for an object.
Extract call tip data from an oinfo dict.
Parameters : | oinfo : dict format_call : bool, optional
|
---|---|
Returns : | call_info : None, str or (str, dict) tuple.
docstring : str or None
|
Find the absolute path to the file where an object was defined.
This is essentially a robust wrapper around inspect.getabsfile.
Returns None if no file can be found.
Parameters : | obj : any Python object |
---|---|
Returns : | fname : str
|
Find the line number in a file where an object was defined.
This is essentially a robust wrapper around inspect.getsourcelines.
Returns None if no file can be found.
Parameters : | obj : any Python object |
---|---|
Returns : | lineno : int
|
Format argspect, convenience wrapper around inspect’s.
This takes a dict instead of ordered arguments and calls inspect.format_argspec with the arguments in the necessary order.
Get the names and default values of a function’s arguments.
A tuple of four things is returned: (args, varargs, varkw, defaults). ‘args’ is a list of the argument names (it may contain nested lists). ‘varargs’ and ‘varkw’ are the names of the * and ** arguments or None. ‘defaults’ is an n-tuple of the default values of the last n arguments.
Modified version of inspect.getargspec from the Python Standard Library.
Stable wrapper around inspect.getdoc.
This can’t crash because of attribute problems.
It also attempts to call a getdoc() method on the given object. This allows objects which provide their docstrings via non-standard mechanisms (like Pyro proxies) to still be inspected by ipython’s ? system.
Wrapper around inspect.getsource.
This can be modified by other projects to provide customized source extraction.
Inputs:
Optional inputs:
This implementation will skip returning any output for binary objects, but custom extractors may know how to meaningfully process them.
Make an object info dict with all fields present.