(obj)
| 780 | return cls |
| 781 | |
| 782 | def _finddoc(obj): |
| 783 | if isclass(obj): |
| 784 | for base in obj.__mro__: |
| 785 | if base is not object: |
| 786 | try: |
| 787 | doc = base.__doc__ |
| 788 | except AttributeError: |
| 789 | continue |
| 790 | if doc is not None: |
| 791 | return doc |
| 792 | return None |
| 793 | |
| 794 | if ismethod(obj): |
| 795 | name = obj.__func__.__name__ |
| 796 | self = obj.__self__ |
| 797 | if (isclass(self) and |
| 798 | getattr(getattr(self, name, None), '__func__') is obj.__func__): |
| 799 | # classmethod |
| 800 | cls = self |
| 801 | else: |
| 802 | cls = self.__class__ |
| 803 | elif isfunction(obj): |
| 804 | name = obj.__name__ |
| 805 | cls = _findclass(obj) |
| 806 | if cls is None or getattr(cls, name) is not obj: |
| 807 | return None |
| 808 | elif isbuiltin(obj): |
| 809 | name = obj.__name__ |
| 810 | self = obj.__self__ |
| 811 | if (isclass(self) and |
| 812 | self.__qualname__ + '.' + name == obj.__qualname__): |
| 813 | # classmethod |
| 814 | cls = self |
| 815 | else: |
| 816 | cls = self.__class__ |
| 817 | # Should be tested before isdatadescriptor(). |
| 818 | elif isinstance(obj, property): |
| 819 | func = obj.fget |
| 820 | name = func.__name__ |
| 821 | cls = _findclass(func) |
| 822 | if cls is None or getattr(cls, name) is not obj: |
| 823 | return None |
| 824 | elif ismethoddescriptor(obj) or isdatadescriptor(obj): |
| 825 | name = obj.__name__ |
| 826 | cls = obj.__objclass__ |
| 827 | if getattr(cls, name) is not obj: |
| 828 | return None |
| 829 | if ismemberdescriptor(obj): |
| 830 | slots = getattr(cls, '__slots__', None) |
| 831 | if isinstance(slots, dict) and name in slots: |
| 832 | return slots[name] |
| 833 | else: |
| 834 | return None |
| 835 | for base in cls.__mro__: |
| 836 | try: |
| 837 | doc = getattr(base, name).__doc__ |
| 838 | except AttributeError: |
| 839 | continue |
no test coverage detected