From 746e9568075195c2af13fdaafcedd1bbd1cb0abb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Jun 2025 15:01:27 +0000 Subject: [PATCH 1/5] Bump types-docutils from 0.21.0.20250525 to 0.21.0.20250604 Bumps [types-docutils](https://github.com/typeshed-internal/stub_uploader) from 0.21.0.20250525 to 0.21.0.20250604. - [Commits](https://github.com/typeshed-internal/stub_uploader/commits) --- updated-dependencies: - dependency-name: types-docutils dependency-version: 0.21.0.20250604 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 70962dd7adf..280e56c6bf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ lint = [ "sphinx-lint>=0.9", "types-colorama==0.4.15.20240311", "types-defusedxml==0.7.0.20250516", - "types-docutils==0.21.0.20250525", + "types-docutils==0.21.0.20250604", "types-Pillow==10.2.0.20240822", "types-Pygments==2.19.0.20250516", "types-requests==2.32.4.20250611", # align with requests @@ -166,7 +166,7 @@ type-stubs = [ # align with versions used elsewhere "types-colorama==0.4.15.20240311", "types-defusedxml==0.7.0.20250516", - "types-docutils==0.21.0.20250525", + "types-docutils==0.21.0.20250604", "types-Pillow==10.2.0.20240822", "types-Pygments==2.19.0.20250516", "types-requests==2.32.4.20250611", From 043820aac473f398cb54bc765c69100801648fcf Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 24 Jun 2025 07:02:46 +0100 Subject: [PATCH 2/5] Remove unused type: ignore comments --- sphinx/directives/patches.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py index 94184de502c..87f9f65465a 100644 --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -30,7 +30,7 @@ logger = logging.getLogger(__name__) -class Figure(images.Figure): # type: ignore[misc] +class Figure(images.Figure): """The figure directive which applies `:name:` option to the figure node instead of the image node. """ @@ -56,7 +56,7 @@ def run(self) -> list[Node]: return [figure_node] -class CSVTable(tables.CSVTable): # type: ignore[misc] +class CSVTable(tables.CSVTable): """The csv-table directive which searches a CSV file from Sphinx project's source directory when an absolute path is given via :file: option. """ From f9e30eb313b22c35e2ebfe82ac1087a8f82a356d Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 24 Jun 2025 07:08:52 +0100 Subject: [PATCH 3/5] Set stub reporter in test to actual Reporter --- tests/test_util/test_util_docutils_sphinx_directive.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_util/test_util_docutils_sphinx_directive.py b/tests/test_util/test_util_docutils_sphinx_directive.py index eb1e4aea16a..e91a4d2ae23 100644 --- a/tests/test_util/test_util_docutils_sphinx_directive.py +++ b/tests/test_util/test_util_docutils_sphinx_directive.py @@ -11,6 +11,7 @@ state_classes, ) from docutils.statemachine import StringList +from docutils.utils import Reporter from sphinx.util.docutils import SphinxDirective, new_document @@ -26,7 +27,7 @@ def make_directive_and_state( *, env: SimpleNamespace, input_lines: StringList | None = None ) -> tuple[RSTState, SphinxDirective]: sm = RSTStateMachine(state_classes, initial_state='Body') - sm.reporter = object() + sm.reporter = Reporter(source='', report_level=0, halt_level=0) if input_lines is not None: sm.input_lines = input_lines state = RSTState(sm) From 5ecdcafe2ef826c60ac9eb9d674e5e041282e452 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 24 Jun 2025 07:11:16 +0100 Subject: [PATCH 4/5] Ignore a method-assign mypy error --- sphinx/directives/other.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index 8c66ed383b5..a7e3b63f520 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -406,7 +406,7 @@ def _insert_input(include_lines: list[str], source: str) -> None: # Only enable this patch if there are listeners for 'include-read'. if self.env.events.listeners.get('include-read'): # See https://github.com/python/mypy/issues/2427 for details on the mypy issue - self.state_machine.insert_input = _insert_input + self.state_machine.insert_input = _insert_input # type: ignore[method-assign] if self.arguments[0].startswith('<') and self.arguments[0].endswith('>'): # docutils "standard" includes, do not do path processing From ad377efc11aed92d5ccfe815560f5be330b25652 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 24 Jun 2025 07:14:00 +0100 Subject: [PATCH 5/5] Change return type to reflect that we do not know a sequence specific type --- sphinx/directives/patches.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py index 87f9f65465a..0a4a9146b8a 100644 --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -19,6 +19,7 @@ from sphinx.util.osutil import SEP, relpath if TYPE_CHECKING: + from collections.abc import Sequence from typing import ClassVar from docutils.nodes import Node @@ -35,7 +36,7 @@ class Figure(images.Figure): instead of the image node. """ - def run(self) -> list[Node]: + def run(self) -> Sequence[Node]: name = self.options.pop('name', None) result = super().run() if len(result) == 2 or isinstance(result[0], nodes.system_message):