Skip to content

Commit

Permalink
Enable disallow_any_generics for sphinx.ext.napoleon (#12911)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtheturtle authored Sep 23, 2024
1 parent de1379e commit 9a36cfc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ module = [
"sphinx.ext.doctest",
"sphinx.ext.graphviz",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.napoleon.docstring",
"sphinx.highlighting",
"sphinx.jinja2glue",
"sphinx.registry",
Expand Down
4 changes: 2 additions & 2 deletions sphinx/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def __init__(self, srcdir: str | os.PathLike[str], confdir: str | os.PathLike[st

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

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

def render(self, template: str, context: dict) -> None:
def render(self, template: str, context: dict[str, Any]) -> None:
"""Called by the builder to render a template given as a filename with
a specified context (a Python dictionary).
"""
Expand Down
6 changes: 3 additions & 3 deletions sphinx/ext/napoleon/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
_SINGLETONS = ("None", "True", "False", "Ellipsis")


class Deque(collections.deque):
class Deque(collections.deque[Any]):
"""
A subclass of deque that mimics ``pockets.iterators.modify_iter``.
Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(
if not hasattr(self, '_directive_sections'):
self._directive_sections: list[str] = []
if not hasattr(self, '_sections'):
self._sections: dict[str, Callable] = {
self._sections: dict[str, Callable[..., list[str]]] = {
'args': self._parse_parameters_section,
'arguments': self._parse_parameters_section,
'attention': partial(self._parse_admonition, 'attention'),
Expand Down Expand Up @@ -1023,7 +1023,7 @@ def is_numeric(token: str) -> bool:


def _convert_numpy_type_spec(
_type: str, location: str | None = None, translations: dict | None = None,
_type: str, location: str | None = None, translations: dict[str, str] | None = None,
) -> str:
if translations is None:
translations = {}
Expand Down

0 comments on commit 9a36cfc

Please sign in to comment.