Generate documentation for an object.
(self, object, name=None, *args)
| 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.""" |