Closed
Description
When using decorators, the numpydoc ignore
inline comment does not seem to be recognized by either numpydoc --validate
or the validation during Sphinx build. Here's a reprex, stored as test.py
:
import functools
def test_decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper
@test_decorator
def test_function(): # numpydoc ignore=PR02
"""Test.
Parameters
----------
x : int
Test.
"""
print("test")
Using python -m numpydoc --validate test.test_function
raises the warning test.test_function:PR02:Unknown parameters {'x'}
when the decorator is used, but doesn't when the decorator is removed. Same thing when using validation during a Sphinx build. Interestingly, validation using python -m numpydoc.hooks.validate_docstrings test.py
does not raise the PR02 warning, even when using the decorator.
Metadata
Metadata
Assignees
Labels
No labels