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:
Takeshi KOMIYA
2022-05-15 20:43:04 +09:00
parent 92fcac321b
commit 06a9139308
8 changed files with 92 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
extensions = ['sphinx.ext.napoleon']

View File

@@ -0,0 +1,6 @@
test-ext-napoleon
=================
.. toctree::
typehints

View File

@@ -0,0 +1,11 @@
def hello(x: int, *args: int, **kwargs: int) -> None:
"""
Parameters
----------
x
X
*args
Additional arguments.
**kwargs
Extra arguments.
"""

View File

@@ -0,0 +1,5 @@
typehints
=========
.. automodule:: mypackage.typehints
:members: