@@ -211,15 +211,18 @@ def _read_sections(self):
211
211
else :
212
212
yield name , self ._strip (data [2 :])
213
213
214
- def _parse_param_list (self , content ):
214
+ def _parse_param_list (self , content , single_element_is_type = False ):
215
215
r = Reader (content )
216
216
params = []
217
217
while not r .eof ():
218
218
header = r .read ().strip ()
219
219
if ' : ' in header :
220
220
arg_name , arg_type = header .split (' : ' )[:2 ]
221
221
else :
222
- arg_name , arg_type = header , ''
222
+ if single_element_is_type :
223
+ arg_name , arg_type = '' , header
224
+ else :
225
+ arg_name , arg_type = header , ''
223
226
224
227
desc = r .read_to_next_unindented_line ()
225
228
desc = dedent_lines (desc )
@@ -351,10 +354,12 @@ def _parse(self):
351
354
self ._error_location ("The section %s appears twice"
352
355
% section )
353
356
354
- if section in ('Parameters' , 'Returns' , 'Yields' , 'Raises' ,
355
- 'Warns' , 'Other Parameters' , 'Attributes' ,
357
+ if section in ('Parameters' , 'Other Parameters' , 'Attributes' ,
356
358
'Methods' ):
357
359
self [section ] = self ._parse_param_list (content )
360
+ elif section in ('Returns' , 'Yields' , 'Raises' , 'Warns' ):
361
+ self [section ] = self ._parse_param_list (
362
+ content , single_element_is_type = True )
358
363
elif section .startswith ('.. index::' ):
359
364
self ['index' ] = self ._parse_index (section , content )
360
365
elif section == 'See Also' :
0 commit comments