MCPcopy Index your code
hub / github.com/python/cpython / render_doc

Function render_doc

Lib/pydoc.py:1712–1737  ·  view source on GitHub ↗

Render text documentation, given an object or a path to an object.

(thing, title='Python Library Documentation: %s', forceload=0,
        renderer=None)

Source from the content-addressed store, hash-verified

1710 return thing, name if isinstance(name, str) else None
1711
1712def render_doc(thing, title='Python Library Documentation: %s', forceload=0,
1713 renderer=None):
1714 """Render text documentation, given an object or a path to an object."""
1715 if renderer is None:
1716 renderer = text
1717 object, name = resolve(thing, forceload)
1718 desc = describe(object)
1719 module = inspect.getmodule(object)
1720 if name and '.' in name:
1721 desc += ' in ' + name[:name.rfind('.')]
1722 elif module and module is not object:
1723 desc += ' in module ' + module.__name__
1724
1725 if not (inspect.ismodule(object) or
1726 inspect.isclass(object) or
1727 inspect.isroutine(object) or
1728 inspect.isdatadescriptor(object) or
1729 _getdoc(object)):
1730 # If the passed object is a piece of data or an instance,
1731 # document its available methods instead of its value.
1732 if hasattr(object, '__origin__'):
1733 object = object.__origin__
1734 else:
1735 object = type(object)
1736 desc += ' object'
1737 return title % desc + '\n\n' + renderer.document(object, name)
1738
1739def doc(thing, title='Python Library Documentation: %s', forceload=0,
1740 output=None, is_cli=False):

Callers 1

docFunction · 0.85

Calls 6

describeFunction · 0.85
_getdocFunction · 0.85
documentMethod · 0.80
resolveFunction · 0.70
rfindMethod · 0.45
ismoduleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…