MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / getdoc

Function getdoc

tools/python-3.11.9-amd64/Lib/inspect.py:844–861  ·  view source on GitHub ↗

Get the documentation string for an object. All tabs are expanded to spaces. To clean up docstrings that are indented to line up with blocks of code, any whitespace than can be uniformly removed from the second line onwards is removed.

(object)

Source from the content-addressed store, hash-verified

842 return None
843
844def getdoc(object):
845 """Get the documentation string for an object.
846
847 All tabs are expanded to spaces. To clean up docstrings that are
848 indented to line up with blocks of code, any whitespace than can be
849 uniformly removed from the second line onwards is removed."""
850 try:
851 doc = object.__doc__
852 except AttributeError:
853 return None
854 if doc is None:
855 try:
856 doc = _finddoc(object)
857 except (AttributeError, TypeError):
858 return None
859 if not isinstance(doc, str):
860 return None
861 return cleandoc(doc)
862
863def cleandoc(doc):
864 """Clean up indentation from docstrings.

Callers 1

_get_formatted_docMethod · 0.90

Calls 2

cleandocFunction · 0.85
_finddocFunction · 0.70

Tested by

no test coverage detected