@@ -718,7 +718,7 @@ def is_filtered_inherited_member(name: str, obj: Any) -> bool:
718718 isattr = False
719719
720720 doc = getdoc (member , self .get_attr , self .config .autodoc_inherit_docstrings ,
721- self .parent , self . object_name )
721+ self .object , membername )
722722 if not isinstance (doc , str ):
723723 # Ignore non-string __doc__
724724 doc = None
@@ -2661,7 +2661,32 @@ class PropertyDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter): #
26612661 @classmethod
26622662 def can_document_member (cls , member : Any , membername : str , isattr : bool , parent : Any
26632663 ) -> bool :
2664- return inspect .isproperty (member ) and isinstance (parent , ClassDocumenter )
2664+ if isinstance (parent , ClassDocumenter ):
2665+ if inspect .isproperty (member ):
2666+ return True
2667+ else :
2668+ __dict__ = safe_getattr (parent .object , '__dict__' , {})
2669+ obj = __dict__ .get (membername )
2670+ return isinstance (obj , classmethod ) and inspect .isproperty (obj .__func__ )
2671+ else :
2672+ return False
2673+
2674+ def import_object (self , raiseerror : bool = False ) -> bool :
2675+ """Check the exisitence of uninitialized instance attribute when failed to import
2676+ the attribute."""
2677+ ret = super ().import_object (raiseerror )
2678+ if ret and not inspect .isproperty (self .object ):
2679+ __dict__ = safe_getattr (self .parent , '__dict__' , {})
2680+ obj = __dict__ .get (self .objpath [- 1 ])
2681+ if isinstance (obj , classmethod ) and inspect .isproperty (obj .__func__ ):
2682+ self .object = obj .__func__
2683+ self .isclassmethod = True
2684+ return True
2685+ else :
2686+ return False
2687+
2688+ self .isclassmethod = False
2689+ return ret
26652690
26662691 def document_members (self , all_members : bool = False ) -> None :
26672692 pass
@@ -2675,6 +2700,8 @@ def add_directive_header(self, sig: str) -> None:
26752700 sourcename = self .get_sourcename ()
26762701 if inspect .isabstractmethod (self .object ):
26772702 self .add_line (' :abstractmethod:' , sourcename )
2703+ if self .isclassmethod :
2704+ self .add_line (' :classmethod:' , sourcename )
26782705
26792706 if safe_getattr (self .object , 'fget' , None ) and self .config .autodoc_typehints != 'none' :
26802707 try :
0 commit comments