@@ -74,17 +74,18 @@ def _str_returns(self, name='Returns'):
74
74
if self [name ]:
75
75
out += self ._str_field_list (name )
76
76
out += ['' ]
77
- for param , param_type , desc in self [name ]:
78
- if param_type :
79
- out += self ._str_indent ([typed_fmt % (param .strip (),
80
- param_type )])
77
+ for param in self [name ]:
78
+ if param . type :
79
+ out += self ._str_indent ([typed_fmt % (param .name . strip (),
80
+ param . type )])
81
81
else :
82
- out += self ._str_indent ([untyped_fmt % param .strip ()])
83
- if desc and self .use_blockquotes :
84
- out += ['' ]
85
- elif not desc :
86
- desc = ['..' ]
87
- out += self ._str_indent (desc , 8 )
82
+ out += self ._str_indent ([untyped_fmt % param .name .strip ()])
83
+ if not param .desc :
84
+ out += self ._str_indent (['..' ], 8 )
85
+ else :
86
+ if self .use_blockquotes :
87
+ out += ['' ]
88
+ out += self ._str_indent (param .desc , 8 )
88
89
out += ['' ]
89
90
return out
90
91
@@ -200,13 +201,14 @@ def _str_param_list(self, name, fake_autosummary=False):
200
201
if self [name ]:
201
202
out += self ._str_field_list (name )
202
203
out += ['' ]
203
- for param , param_type , desc in self [name ]:
204
- display_param , desc = self ._process_param (param , desc ,
204
+ for param in self [name ]:
205
+ display_param , desc = self ._process_param (param .name ,
206
+ param .desc ,
205
207
fake_autosummary )
206
208
207
- if param_type :
209
+ if param . type :
208
210
out += self ._str_indent (['%s : %s' % (display_param ,
209
- param_type )])
211
+ param . type )])
210
212
else :
211
213
out += self ._str_indent ([display_param ])
212
214
if desc and self .use_blockquotes :
@@ -243,21 +245,21 @@ def _str_member_list(self, name):
243
245
244
246
autosum = []
245
247
others = []
246
- for param , param_type , desc in self [name ]:
247
- param = param .strip ()
248
+ for param in self [name ]:
249
+ param = param ._replace ( name = param . name . strip () )
248
250
249
251
# Check if the referenced member can have a docstring or not
250
- param_obj = getattr (self ._obj , param , None )
252
+ param_obj = getattr (self ._obj , param . name , None )
251
253
if not (callable (param_obj )
252
254
or isinstance (param_obj , property )
253
255
or inspect .isdatadescriptor (param_obj )):
254
256
param_obj = None
255
257
256
258
if param_obj and pydoc .getdoc (param_obj ):
257
259
# Referenced object has a docstring
258
- autosum += [" %s%s" % (prefix , param )]
260
+ autosum += [" %s%s" % (prefix , param . name )]
259
261
else :
260
- others .append (( param , param_type , desc ) )
262
+ others .append (param )
261
263
262
264
if autosum :
263
265
out += ['.. autosummary::' ]
@@ -266,15 +268,17 @@ def _str_member_list(self, name):
266
268
out += ['' ] + autosum
267
269
268
270
if others :
269
- maxlen_0 = max (3 , max ([len (x [ 0 ] ) + 4 for x in others ]))
271
+ maxlen_0 = max (3 , max ([len (p . name ) + 4 for p in others ]))
270
272
hdr = sixu ("=" ) * maxlen_0 + sixu (" " ) + sixu ("=" ) * 10
271
273
fmt = sixu ('%%%ds %%s ' ) % (maxlen_0 ,)
272
274
out += ['' , '' , hdr ]
273
- for param , param_type , desc in others :
274
- desc = sixu (" " ).join (x .strip () for x in desc ).strip ()
275
- if param_type :
276
- desc = "(%s) %s" % (param_type , desc )
277
- out += [fmt % ("**" + param .strip () + "**" , desc )]
275
+ for param in others :
276
+ name = "**" + param .name .strip () + "**"
277
+ desc = sixu (" " ).join (x .strip ()
278
+ for x in param .desc ).strip ()
279
+ if param .type :
280
+ desc = "(%s) %s" % (param .type , desc )
281
+ out += [fmt % (name , desc )]
278
282
out += [hdr ]
279
283
out += ['' ]
280
284
return out
0 commit comments