Skip to content

Commit 9a36cfc

Browse files
Enable disallow_any_generics for sphinx.ext.napoleon (#12911)
1 parent de1379e commit 9a36cfc

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ module = [
237237
"sphinx.ext.doctest",
238238
"sphinx.ext.graphviz",
239239
"sphinx.ext.inheritance_diagram",
240-
"sphinx.ext.napoleon.docstring",
241240
"sphinx.highlighting",
242241
"sphinx.jinja2glue",
243242
"sphinx.registry",

sphinx/application.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def __init__(self, srcdir: str | os.PathLike[str], confdir: str | os.PathLike[st
218218

219219
# keep last few messages for traceback
220220
# This will be filled by sphinx.util.logging.LastMessagesWriter
221-
self.messagelog: deque = deque(maxlen=10)
221+
self.messagelog: deque[str] = deque(maxlen=10)
222222

223223
# say hello to the world
224224
logger.info(bold(__('Running Sphinx v%s')), sphinx.__display_version__)
@@ -1718,7 +1718,7 @@ def newest_template_mtime(self) -> float:
17181718
"""
17191719
return 0
17201720

1721-
def render(self, template: str, context: dict) -> None:
1721+
def render(self, template: str, context: dict[str, Any]) -> None:
17221722
"""Called by the builder to render a template given as a filename with
17231723
a specified context (a Python dictionary).
17241724
"""

sphinx/ext/napoleon/docstring.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
_SINGLETONS = ("None", "True", "False", "Ellipsis")
5353

5454

55-
class Deque(collections.deque):
55+
class Deque(collections.deque[Any]):
5656
"""
5757
A subclass of deque that mimics ``pockets.iterators.modify_iter``.
5858
@@ -195,7 +195,7 @@ def __init__(
195195
if not hasattr(self, '_directive_sections'):
196196
self._directive_sections: list[str] = []
197197
if not hasattr(self, '_sections'):
198-
self._sections: dict[str, Callable] = {
198+
self._sections: dict[str, Callable[..., list[str]]] = {
199199
'args': self._parse_parameters_section,
200200
'arguments': self._parse_parameters_section,
201201
'attention': partial(self._parse_admonition, 'attention'),
@@ -1023,7 +1023,7 @@ def is_numeric(token: str) -> bool:
10231023

10241024

10251025
def _convert_numpy_type_spec(
1026-
_type: str, location: str | None = None, translations: dict | None = None,
1026+
_type: str, location: str | None = None, translations: dict[str, str] | None = None,
10271027
) -> str:
10281028
if translations is None:
10291029
translations = {}

0 commit comments

Comments
 (0)