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

Method document

Lib/pydoc.py:476–490  ·  view source on GitHub ↗

Generate documentation for an object.

(self, object, name=None, *args)

Source from the content-addressed store, hash-verified

474 STDLIB_DIR = sysconfig.get_path('stdlib')
475
476 def document(self, object, name=None, *args):
477 """Generate documentation for an object."""
478 args = (object, name) + args
479 # 'try' clause is to attempt to handle the possibility that inspect
480 # identifies something in a way that pydoc itself has issues handling;
481 # think 'super' and how it is a descriptor (which raises the exception
482 # by lacking a __name__ attribute) and an instance.
483 try:
484 if inspect.ismodule(object): return self.docmodule(*args)
485 if inspect.isclass(object): return self.docclass(*args)
486 if inspect.isroutine(object): return self.docroutine(*args)
487 except AttributeError:
488 pass
489 if inspect.isdatadescriptor(object): return self.docdata(*args)
490 return self.docother(*args)
491
492 def fail(self, object, name=None, *args):
493 """Raise an exception for unimplemented types."""

Callers 10

docmoduleMethod · 0.80
spillMethod · 0.80
docmoduleMethod · 0.80
spillMethod · 0.80
render_docFunction · 0.80
writedocFunction · 0.80
html_getobjFunction · 0.80
test_async_annotationMethod · 0.80

Calls 6

ismoduleMethod · 0.45
docmoduleMethod · 0.45
docclassMethod · 0.45
docroutineMethod · 0.45
docdataMethod · 0.45
docotherMethod · 0.45

Tested by 3

test_async_annotationMethod · 0.64