autodoc: give attributes a higher priority so that descriptors are not documented as methods.

This commit is contained in:
Georg Brandl 2009-09-17 14:20:46 +02:00
parent 4dd3346b28
commit 521049d9a8

View File

@ -965,10 +965,10 @@ class MethodDocumenter(ClassLevelDocumenter):
"""
objtype = 'method'
member_order = 50
priority = 0
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
# other attributes are recognized via the module analyzer
return inspect.isroutine(member) and \
not isinstance(parent, ModuleDocumenter)
@ -1011,6 +1011,10 @@ class AttributeDocumenter(ClassLevelDocumenter):
objtype = 'attribute'
member_order = 60
# must be higher than the MethodDocumenter, else it will recognize
# some non-data descriptors as methods
priority = 10
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
return (isdescriptor(member) and not