Generate documentation for an object.
(self, object, name=None, *args)
| 484 | % sys.version_info[:2]) |
| 485 | |
| 486 | def document(self, object, name=None, *args): |
| 487 | """Generate documentation for an object.""" |
| 488 | args = (object, name) + args |
| 489 | # 'try' clause is to attempt to handle the possibility that inspect |
| 490 | # identifies something in a way that pydoc itself has issues handling; |
| 491 | # think 'super' and how it is a descriptor (which raises the exception |
| 492 | # by lacking a __name__ attribute) and an instance. |
| 493 | try: |
| 494 | if inspect.ismodule(object): return self.docmodule(*args) |
| 495 | if inspect.isclass(object): return self.docclass(*args) |
| 496 | if inspect.isroutine(object): return self.docroutine(*args) |
| 497 | except AttributeError: |
| 498 | pass |
| 499 | if inspect.isdatadescriptor(object): return self.docdata(*args) |
| 500 | return self.docother(*args) |
| 501 | |
| 502 | def fail(self, object, name=None, *args): |
| 503 | """Raise an exception for unimplemented types.""" |
no test coverage detected