Skip to content

Commit ddd7dc6

Browse files
committed
Merge pull request #1 from tacaswell/yield_section
ENH : simplify handling of Yield section
2 parents 95c2879 + def02e6 commit ddd7dc6

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

numpydoc/docscrape.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,8 @@ def __str__(self, func_role=''):
393393
out += self._str_signature()
394394
out += self._str_summary()
395395
out += self._str_extended_summary()
396-
for param_list in ('Parameters', 'Returns', 'Other Parameters',
397-
'Raises', 'Warns'):
396+
for param_list in ('Parameters', 'Returns', 'Yields',
397+
'Other Parameters', 'Raises', 'Warns'):
398398
out += self._str_param_list(param_list)
399399
out += self._str_section('Warnings')
400400
out += self._str_see_also(func_role)

numpydoc/docscrape_sphinx.py

+1-17
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ 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-
8366
def _str_param_list(self, name):
8467
out = []
8568
if self[name]:
@@ -242,6 +225,7 @@ def __str__(self, indent=0, func_role="obj"):
242225
out += self._str_extended_summary()
243226
out += self._str_param_list('Parameters')
244227
out += self._str_returns()
228+
out += self._str_param_list('Yields')
245229
for param_list in ('Other Parameters', 'Raises', 'Warns'):
246230
out += self._str_param_list(param_list)
247231
out += self._str_warnings()

numpydoc/tests/test_docscrape.py

-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ def test_yields():
178178
"""
179179
doc = NumpyDocString(doc_text)
180180
section = doc['Yields']
181-
print(section)
182181
assert_equal(len(section), 2)
183182
truth = [('a', 'apples.'), ('b', 'bananas.')]
184183
for (arg, arg_type, desc), (arg_true, ending) in zip(section, truth):

0 commit comments

Comments
 (0)