mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
autodoc: give attributes a higher priority so that descriptors are not documented as methods.
This commit is contained in:
parent
4dd3346b28
commit
521049d9a8
@ -965,10 +965,10 @@ class MethodDocumenter(ClassLevelDocumenter):
|
|||||||
"""
|
"""
|
||||||
objtype = 'method'
|
objtype = 'method'
|
||||||
member_order = 50
|
member_order = 50
|
||||||
|
priority = 0
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def can_document_member(cls, member, membername, isattr, parent):
|
def can_document_member(cls, member, membername, isattr, parent):
|
||||||
# other attributes are recognized via the module analyzer
|
|
||||||
return inspect.isroutine(member) and \
|
return inspect.isroutine(member) and \
|
||||||
not isinstance(parent, ModuleDocumenter)
|
not isinstance(parent, ModuleDocumenter)
|
||||||
|
|
||||||
@ -1011,6 +1011,10 @@ class AttributeDocumenter(ClassLevelDocumenter):
|
|||||||
objtype = 'attribute'
|
objtype = 'attribute'
|
||||||
member_order = 60
|
member_order = 60
|
||||||
|
|
||||||
|
# must be higher than the MethodDocumenter, else it will recognize
|
||||||
|
# some non-data descriptors as methods
|
||||||
|
priority = 10
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def can_document_member(cls, member, membername, isattr, parent):
|
def can_document_member(cls, member, membername, isattr, parent):
|
||||||
return (isdescriptor(member) and not
|
return (isdescriptor(member) and not
|
||||||
|
Loading…
Reference in New Issue
Block a user