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

Function render_doc

tools/python-3.11.9-amd64/Lib/pydoc.py:1836–1861  ·  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

1834 return thing, name if isinstance(name, str) else None
1835
1836def render_doc(thing, title='Python Library Documentation: %s', forceload=0,
1837 renderer=None):
1838 """Render text documentation, given an object or a path to an object."""
1839 if renderer is None:
1840 renderer = text
1841 object, name = resolve(thing, forceload)
1842 desc = describe(object)
1843 module = inspect.getmodule(object)
1844 if name and '.' in name:
1845 desc += ' in ' + name[:name.rfind('.')]
1846 elif module and module is not object:
1847 desc += ' in module ' + module.__name__
1848
1849 if not (inspect.ismodule(object) or
1850 inspect.isclass(object) or
1851 inspect.isroutine(object) or
1852 inspect.isdatadescriptor(object) or
1853 _getdoc(object)):
1854 # If the passed object is a piece of data or an instance,
1855 # document its available methods instead of its value.
1856 if hasattr(object, '__origin__'):
1857 object = object.__origin__
1858 else:
1859 object = type(object)
1860 desc += ' object'
1861 return title % desc + '\n\n' + renderer.document(object, name)
1862
1863def doc(thing, title='Python Library Documentation: %s', forceload=0,
1864 output=None, is_cli=False):

Callers 1

docFunction · 0.85

Calls 6

describeFunction · 0.85
_getdocFunction · 0.85
rfindMethod · 0.80
documentMethod · 0.80
resolveFunction · 0.70
typeClass · 0.50

Tested by

no test coverage detected