From bf851e8a1df1a2e8bcc8231d6bc93f4310e11e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Mon, 9 Jun 2025 06:35:23 -0700 Subject: [PATCH] Fix the CI failing due to type error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- src/sphinx_autodoc_typehints/patches.py | 7 ++++--- tox.ini | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sphinx_autodoc_typehints/patches.py b/src/sphinx_autodoc_typehints/patches.py index 236b38d..583ed49 100644 --- a/src/sphinx_autodoc_typehints/patches.py +++ b/src/sphinx_autodoc_typehints/patches.py @@ -103,7 +103,7 @@ def _patched_base_admonition_run(self: BaseAdmonition) -> Any: def _patched_text_indent(self: Text, *args: Any) -> Any: _, line = self.state_machine.get_source_and_line() - result = orig_text_indent(self, *args) + result = orig_text_indent(self, *args) # type: ignore[no-untyped-call] node = self.parent[-1] if node.tagname == "system_message": node = self.parent[-2] @@ -114,6 +114,7 @@ def _patched_text_indent(self: Text, *args: Any) -> Any: def _patched_body_doctest( self: Body, _match: None, _context: None, next_state: str | None ) -> tuple[list[Any], str | None, list[Any]]: + assert self.document.current_line is not None # noqa: S101 line = self.document.current_line + 1 data = "\n".join(self.state_machine.get_text_block()) n = nodes.doctest_block(data, data) @@ -128,9 +129,9 @@ def _patch_line_numbers() -> None: When the line numbers are missing, we have a hard time placing the :rtype:. """ - Text.indent = _patched_text_indent + Text.indent = _patched_text_indent # type: ignore[method-assign] BaseAdmonition.run = _patched_base_admonition_run # type: ignore[method-assign,assignment] - Body.doctest = _patched_body_doctest + Body.doctest = _patched_body_doctest # type: ignore[method-assign] def install_patches(app: Sphinx) -> None: diff --git a/tox.ini b/tox.ini index 07cd05a..87924c5 100644 --- a/tox.ini +++ b/tox.ini @@ -45,7 +45,7 @@ commands = description = run type check on code base deps = mypy==1.15 - types-docutils>=0.21.0.20241128 + types-docutils>=0.21.0.20250604 commands = mypy src mypy tests