@@ -46,23 +46,39 @@ def build_signatures(object):
4646 yield f"| :sg:`{ name } ({ arg_string } ) -> { ret } `"
4747
4848
49+ def get_doc (env , obj ):
50+ if obj .docstring :
51+ return obj .docstring
52+
53+ # If we don't already have docs, check if a python implementation exists of this
54+ # module and return its docstring if it does
55+ python_object = env .autoapi_all_objects .get (
56+ obj .id .replace ("pygame" , "src_py" ), None
57+ )
58+ if python_object is not None :
59+ return python_object .docstring
60+
61+ return ""
62+
63+
4964class AutopgDocumenter (autoapi .documenters .AutoapiDocumenter ):
5065 def format_signature (self , ** kwargs ):
5166 return ""
5267
5368 def get_doc (self , encoding = None , ignore = 1 ):
54- if self .object .docstring :
55- return super ().get_doc (encoding , ignore )
56-
57- # If we don't already have docs, check if a python implementation exists of this
58- # module and return its docstring if it does
59- python_object = self .env .autoapi_all_objects .get (
60- self .object .id .replace ("pygame" , "src_py" ), None
69+ return [get_doc (self .env , self .object ).splitlines ()]
70+
71+ def get_object_members (self , want_all ):
72+ members_check_module , members = super ().get_object_members (want_all )
73+ members = (
74+ member
75+ for member in members
76+ if not member .object .obj .get ("hide" , False )
77+ and not member .object .imported
78+ and get_doc (self .env , member .object ) != ""
6179 )
62- if python_object is not None :
63- return [python_object .docstring .splitlines ()]
6480
65- return [ "" ]
81+ return members_check_module , members
6682
6783 def process_doc (self , docstrings ):
6884 for docstring in docstrings :
0 commit comments