Skip to content

Commit 95c2879

Browse files
committed
Add support for Yields for sphinx strings as well.
1 parent 8f0bef9 commit 95c2879

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

numpydoc/docscrape_sphinx.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ def _str_returns(self):
6363
out += ['']
6464
return out
6565

66+
def _str_yields(self):
67+
out = []
68+
if self['Yields']:
69+
out += self._str_field_list('Yields')
70+
out += ['']
71+
for param, param_type, desc in self['Yields']:
72+
if param_type:
73+
out += self._str_indent(['**%s** : %s' % (param.strip(),
74+
param_type)])
75+
else:
76+
out += self._str_indent([param.strip()])
77+
if desc:
78+
out += ['']
79+
out += self._str_indent(desc, 8)
80+
out += ['']
81+
return out
82+
6683
def _str_param_list(self, name):
6784
out = []
6885
if self[name]:

numpydoc/traitsdoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __str__(self, indent=0, func_role="func"):
9090
out += self._str_summary()
9191
out += self._str_extended_summary()
9292
for param_list in ('Parameters', 'Traits', 'Methods',
93-
'Returns','Raises'):
93+
'Returns', 'Yields', 'Raises'):
9494
out += self._str_param_list(param_list)
9595
out += self._str_see_also("obj")
9696
out += self._str_section('Notes')

0 commit comments

Comments
 (0)