Closed
Description
Say I have the following:
def foo(bar: str) -> None:
"""
Parameters
----------
bar : {'integer', 'float'}
Some description.
"""
if bar not in {'integer', 'float'}:
raise ValueError('bar is neither "integer" nor "float"')
The parameter bar
is a str
, and can only take on the values 'integer'
and 'float'
. However, if I run numpydoc
on it, it reports:
$ python -m numpydoc t.foo --validate
t.foo:SS01:No summary found (a short summary in a single line should be present at the beginning of the docstring)
t.foo:ES01:No extended summary found
t.foo:PR06:Parameter "bar" type should use "int" instead of "integer"
t.foo:SA01:See Also section not found
t.foo:EX01:No examples section found
The first 2 and last 2 errors are expected, but the middle one (PR06
) feels like a false positive.
Noticed when trying to validate pandas.to_numeric
(https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_numeric.html), which has a parameter downcast
which can be equal to the string 'integer'