Get the documentation string for an object. All tabs are expanded to spaces. To clean up docstrings that are indented to line up with blocks of code, any whitespace than can be uniformly removed from the second line onwards is removed.
(object, *, fallback_to_class_doc=True, inherit_class_doc=True)
| 790 | return None |
| 791 | |
| 792 | def getdoc(object, *, fallback_to_class_doc=True, inherit_class_doc=True): |
| 793 | """Get the documentation string for an object. |
| 794 | |
| 795 | All tabs are expanded to spaces. To clean up docstrings that are |
| 796 | indented to line up with blocks of code, any whitespace than can be |
| 797 | uniformly removed from the second line onwards is removed.""" |
| 798 | if fallback_to_class_doc: |
| 799 | try: |
| 800 | doc = object.__doc__ |
| 801 | except AttributeError: |
| 802 | return None |
| 803 | else: |
| 804 | doc = _getowndoc(object) |
| 805 | if doc is None: |
| 806 | try: |
| 807 | doc = _finddoc(object, search_in_class=inherit_class_doc) |
| 808 | except (AttributeError, TypeError): |
| 809 | return None |
| 810 | if not isinstance(doc, str): |
| 811 | return None |
| 812 | return cleandoc(doc) |
| 813 | |
| 814 | def cleandoc(doc): |
| 815 | """Clean up indentation from docstrings. |
nothing calls this directly
no test coverage detected
searching dependent graphs…