File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,14 @@ def _fetch_object_dispname(self, el: "dc.Alias | dc.Object"):
99
99
return el .canonical_path
100
100
101
101
raise ValueError (f"Unsupported display_name: `{ self .display_name } `" )
102
+
103
+ def _fetch_method_parameters (self , el : dc .Function ):
104
+ # adapted from mkdocstrings-python jinja tempalate
105
+ if el .parent and el .parent .is_class and len (el .parameters ) > 0 :
106
+ if el .parameters [0 ].name in {"self" , "cls" }:
107
+ return dc .Parameters (* list (el .parameters )[1 :])
108
+
109
+ return el .parameters
102
110
103
111
def _render_table (self , rows , headers ):
104
112
table = tabulate (rows , headers = headers , tablefmt = "github" )
@@ -162,7 +170,7 @@ def signature(
162
170
self , el : Union [dc .Class , dc .Function ], source : Optional [dc .Alias ] = None
163
171
):
164
172
name = self ._fetch_object_dispname (source or el )
165
- pars = self .render (el . parameters )
173
+ pars = self .render (self . _fetch_method_parameters ( el ) )
166
174
167
175
return f"`{ name } ({ pars } )`"
168
176
You can’t perform that action at this time.
0 commit comments