Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,14 @@ Retrieving source code
class, or function.


.. function:: getabsfile(object)

Return an absolute, normalized path to the (text or binary) file in
which an object was defined. This uses :func:`getsourcefile` and falls
back to :func:`getfile` if no source file can be found. The idea is for
each object to have a unique origin.


.. function:: getmodule(object)

Try to guess which module an object was defined in. Return ``None``
Expand Down Expand Up @@ -791,6 +799,12 @@ Retrieving source code
expanded to spaces.


.. function:: indentsize(line)

Return the indentation size, in number of spaces, at the start of a line
of text, expanding tabs using :meth:`str.expandtabs`.


.. _inspect-signature-object:

Introspecting callables with the Signature object
Expand Down Expand Up @@ -1220,6 +1234,21 @@ function.
Classes and functions
---------------------

.. function:: classify_class_attrs(cls)

Return a list of :term:`named tuples <named tuple>`
``Attribute(name, kind, defining_class, object)`` for each attribute
reported by ``dir(cls)``. *kind* is one of
``'class method'``, ``'static method'``, ``'property'``, ``'method'`` or
``'data'``, and *defining_class* is the class in *cls*'s :term:`MRO` (or
its metaclass's MRO) that defines the attribute. *object* is the
attribute value, retrieved with :func:`getattr` where possible, falling
back to a lookup in the defining class's ``__dict__``.

This is used internally by :mod:`pydoc` to build the class documentation
shown by :func:`help`.


.. function:: getclasstree(classes, unique=False)

Arrange the given list of classes into a hierarchy of nested lists. Where a
Expand Down
Loading