docstring_parser
docstring_parser copied to clipboard
NumpyDoc: Default value can be specified as part of the type
At the moment, the NumpydocParser
only looks at the description of a parameter to find its default value (relevant code).
However, the numpydoc
style guide also allows specifying the default value as part of the type (source):
Optional keyword parameters have default values, which are displayed as part of the function signature. They can also be detailed in the description: [...] or as part of the type, instead of optional. If the default value would not be used as a value, optional is preferred. These are all equivalent:
copy : bool, default True copy : bool, default=True copy : bool, default: True
This is, for example, used by scikit-learn.
Moreover, the default value should be removed from the type_name
property of DocstringParam
, just like optional
.