mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-17 21:25:35 +00:00
parent
d40122948b
commit
9c91de9370
@ -11,6 +11,14 @@ Features
|
||||
* `#151 <https://github.com/readthedocs/sphinx-autoapi/issues/151>`: (Python) Added the ``autoapi_python_use_implicit_namespaces`` option to allow
|
||||
AutoAPI to search for implicit namespace packages.
|
||||
|
||||
Bug Fixes
|
||||
^^^^^^^^^
|
||||
* `#186 <https://github.com/readthedocs/sphinx-autoapi/issues/186>`: (Python)
|
||||
Fixed an exception when there are too many argument type annotations
|
||||
in a type comment.
|
||||
Instead, a warning is raised to indicate that the extra annotations
|
||||
will be ignored.
|
||||
|
||||
|
||||
v1.2.1 (2019-10-9)
|
||||
------------------
|
||||
|
@ -8,6 +8,9 @@ import sys
|
||||
|
||||
import astroid
|
||||
import astroid.nodes
|
||||
import sphinx.util.logging
|
||||
|
||||
_LOGGER = sphinx.util.logging.getLogger(__name__)
|
||||
|
||||
|
||||
if sys.version_info < (3,):
|
||||
@ -432,6 +435,13 @@ def format_args(args_node):
|
||||
result.append("/")
|
||||
|
||||
if args_node.args:
|
||||
if len(args_node.args) < len(annotations):
|
||||
msg = "Ignoring extra argument type annotation(s) on {}".format(
|
||||
args_node.scope().qname()
|
||||
)
|
||||
_LOGGER.warning(msg)
|
||||
annotations = annotations[: len(args_node.args)]
|
||||
|
||||
result.append(
|
||||
_format_args(args_node.args, positional_or_keyword_defaults, annotations)
|
||||
)
|
||||
|
@ -39,3 +39,8 @@ class A:
|
||||
|
||||
|
||||
global_a = A() # type: A
|
||||
|
||||
|
||||
def f3(first_arg, **kwargs):
|
||||
# type: (first_arg, Any) -> None
|
||||
"""Annotation incorrectly leaves out `**`."""
|
||||
|
Loading…
Reference in New Issue
Block a user