numpydoc.docscrape.NumpyDocString in version 1.9.0 fails to parse docstrings if there is content within a section that resembles a section header, e.g. the "Parameters\n----------" contains " Parameters\n----------"
Example reproducer: a function that takes a function as an argument and returnsanother function. The following docstring explains the returned function:
def wrapper(func):
'''
Wrap a simple function so that it takes a message string that gets printed to stdout when invoked.
Parameters
----------
func: function
Function to be wrapped. This can be any arbitrary synchronous function.
Returns
-------
wrapped_function: function
The returned function has the following signature::
wrapped_function(
message,
*args,
*kwargs,
)
\'\'\'
Parameters
----------
message: str
A custom message to be printed when the wrapped function is called.
*args
Additional arguments that are passed into the original function.
**kwargs
Extra arguments to the original function.
\'\'\'
'''
However, when using numpydoc.docscrape.NumpyDocString to parse this docstring, for example:
parsed = NumpyDocString(<example docstring above>)
...an exception is raised claiming to have duplicate Parameters section:
ValueError: The section `Parameters` appears twice in
Wrap a simple function so that it takes a message string that gets printed to stdout when invoked.
The desired behavior is to treat the nested Parameters "section" as regular content and not an actual section.
numpydoc.docscrape.NumpyDocStringin version 1.9.0 fails to parse docstrings if there is content within a section that resembles a section header, e.g. the"Parameters\n----------"contains" Parameters\n----------"Example reproducer: a function that takes a function as an argument and returnsanother function. The following docstring explains the returned function:
However, when using
numpydoc.docscrape.NumpyDocStringto parse this docstring, for example:...an exception is raised claiming to have duplicate Parameters section:
The desired behavior is to treat the nested
Parameters"section" as regular content and not an actual section.