Skip to content

Parsing returns section with several types and no name #428

Closed
@MaozGelbart

Description

@MaozGelbart

According to numpydoc return value specification, the name for each return value may be optional. If the return value is omitted and the return type can take several types (if the actual type depends on user input, for example), then if the second type contains " :" as part of the type description (as in the following example) it is incorrectly identified as parameter type separator. This prevents sphinx recognition of the referenced type.

from numpydoc.docscrape import NumpyDocString
docstr="""
Returns
-------
str or :class:`NumpyDocString`
"""
print(NumpyDocString(docstr))

Results with:




Returns
-------
str or : class:`NumpyDocString`

I would expect getting the following result:




Returns
-------
str or :class:`NumpyDocString`

The example is using version 1.4.0.
I think this was changed in #286 .

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions