mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #9648: autodoc: *args and **kwargs entries are duplicated
In basic usage of autodoc (docstring), `args` and `kwargs` arguments are marked up without stars. But numpydoc style recommends to mark them up with stars. This adds support for starred arguments in docstrings to `autodoc_typehints` feature.
This commit is contained in:
5
tests/roots/test-ext-napoleon/conf.py
Normal file
5
tests/roots/test-ext-napoleon/conf.py
Normal file
@@ -0,0 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
extensions = ['sphinx.ext.napoleon']
|
||||
6
tests/roots/test-ext-napoleon/index.rst
Normal file
6
tests/roots/test-ext-napoleon/index.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
test-ext-napoleon
|
||||
=================
|
||||
|
||||
.. toctree::
|
||||
|
||||
typehints
|
||||
0
tests/roots/test-ext-napoleon/mypackage/__init__.py
Normal file
0
tests/roots/test-ext-napoleon/mypackage/__init__.py
Normal file
11
tests/roots/test-ext-napoleon/mypackage/typehints.py
Normal file
11
tests/roots/test-ext-napoleon/mypackage/typehints.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def hello(x: int, *args: int, **kwargs: int) -> None:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
x
|
||||
X
|
||||
*args
|
||||
Additional arguments.
|
||||
**kwargs
|
||||
Extra arguments.
|
||||
"""
|
||||
5
tests/roots/test-ext-napoleon/typehints.rst
Normal file
5
tests/roots/test-ext-napoleon/typehints.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
typehints
|
||||
=========
|
||||
|
||||
.. automodule:: mypackage.typehints
|
||||
:members:
|
||||
Reference in New Issue
Block a user