Skip to content

Commit ec7e0de

Browse files
authored
Fix the CI failing due to type error (#548)
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 3c82b0d commit ec7e0de

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/sphinx_autodoc_typehints/patches.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _patched_base_admonition_run(self: BaseAdmonition) -> Any:
103103

104104
def _patched_text_indent(self: Text, *args: Any) -> Any:
105105
_, line = self.state_machine.get_source_and_line()
106-
result = orig_text_indent(self, *args)
106+
result = orig_text_indent(self, *args) # type: ignore[no-untyped-call]
107107
node = self.parent[-1]
108108
if node.tagname == "system_message":
109109
node = self.parent[-2]
@@ -114,6 +114,7 @@ def _patched_text_indent(self: Text, *args: Any) -> Any:
114114
def _patched_body_doctest(
115115
self: Body, _match: None, _context: None, next_state: str | None
116116
) -> tuple[list[Any], str | None, list[Any]]:
117+
assert self.document.current_line is not None # noqa: S101
117118
line = self.document.current_line + 1
118119
data = "\n".join(self.state_machine.get_text_block())
119120
n = nodes.doctest_block(data, data)
@@ -128,9 +129,9 @@ def _patch_line_numbers() -> None:
128129
129130
When the line numbers are missing, we have a hard time placing the :rtype:.
130131
"""
131-
Text.indent = _patched_text_indent
132+
Text.indent = _patched_text_indent # type: ignore[method-assign]
132133
BaseAdmonition.run = _patched_base_admonition_run # type: ignore[method-assign,assignment]
133-
Body.doctest = _patched_body_doctest
134+
Body.doctest = _patched_body_doctest # type: ignore[method-assign]
134135

135136

136137
def install_patches(app: Sphinx) -> None:

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ commands =
4545
description = run type check on code base
4646
deps =
4747
mypy==1.15
48-
types-docutils>=0.21.0.20241128
48+
types-docutils>=0.21.0.20250604
4949
commands =
5050
mypy src
5151
mypy tests

0 commit comments

Comments
 (0)