Description
I noticed an inconsistency, when using numpydoc version 0.6.0 in python2.7 on Ubuntu. The parsed return section information returns different styles of tuple depending on if the return value is anoymous or not.
Here is a minimal working example:
def mwe():
from numpydoc.docscrape import NumpyDocString
docstr = (
'Returns\n'
'----------\n'
'int\n'
' can return an anoymous integer\n'
'out : ndarray\n'
' can return a named value\n'
)
doc = NumpyDocString(docstr)
returns = doc._parsed_data['Returns']
print(returns)
This results in
[(u'int', '', [u'can return an anoymous integer']),
(u'out', u'ndarray', [u'can return a named value'])]
However judging by tests (due to lack of docs), I believe it was indented that each value in the returns list should be a tuple of (arg, arg_type, arg_desc)
. Therefore we should see this instead:
[('', u'int', [u'can return an anoymous integer']),
(u'out', u'ndarray', [u'can return a named value'])]
My current workaround is this:
for p_name, p_type, p_descr in returns:
if not p_type:
p_name = ''
p_type = p_name
Metadata
Metadata
Assignees
Labels
No labels