MCPcopy Index your code
hub / github.com/RustPython/RustPython / render_doc

Function render_doc

Lib/pydoc.py:1758–1783  ·  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

1756 return thing, name if isinstance(name, str) else None
1757
1758def render_doc(thing, title='Python Library Documentation: %s', forceload=0,
1759 renderer=None):
1760 """Render text documentation, given an object or a path to an object."""
1761 if renderer is None:
1762 renderer = text
1763 object, name = resolve(thing, forceload)
1764 desc = describe(object)
1765 module = inspect.getmodule(object)
1766 if name and '.' in name:
1767 desc += ' in ' + name[:name.rfind('.')]
1768 elif module and module is not object:
1769 desc += ' in module ' + module.__name__
1770
1771 if not (inspect.ismodule(object) or
1772 inspect.isclass(object) or
1773 inspect.isroutine(object) or
1774 inspect.isdatadescriptor(object) or
1775 _getdoc(object)):
1776 # If the passed object is a piece of data or an instance,
1777 # document its available methods instead of its value.
1778 if hasattr(object, '__origin__'):
1779 object = object.__origin__
1780 else:
1781 object = type(object)
1782 desc += ' object'
1783 return title % desc + '\n\n' + renderer.document(object, name)
1784
1785def doc(thing, title='Python Library Documentation: %s', forceload=0,
1786 output=None, is_cli=False):

Callers 1

docFunction · 0.85

Calls 6

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

Tested by

no test coverage detected