From 55025fca3a6be0d0e662964ab393f6869d21b28b Mon Sep 17 00:00:00 2001 From: ANSHUL SINGH <72524975+ekanshul@users.noreply.github.com> Date: Thu, 20 Aug 2026 01:56:29 +0530 Subject: [PATCH] Bump docutils to 0.23 Co-Authored-By: Claude Fable 5 --- stubs/docutils/@tests/stubtest_allowlist.txt | 1 + stubs/docutils/METADATA.toml | 2 +- stubs/docutils/docutils/frontend.pyi | 2 +- stubs/docutils/docutils/nodes.pyi | 36 +++++++++++++++---- .../parsers/rst/directives/tables.pyi | 3 -- stubs/docutils/docutils/parsers/rst/roles.pyi | 2 +- stubs/docutils/docutils/transforms/misc.pyi | 1 + .../docutils/transforms/references.pyi | 4 +++ .../docutils/writers/latex2e/__init__.pyi | 1 + 9 files changed, 39 insertions(+), 13 deletions(-) diff --git a/stubs/docutils/@tests/stubtest_allowlist.txt b/stubs/docutils/@tests/stubtest_allowlist.txt index 25b1f04867fd..e210c1e10470 100644 --- a/stubs/docutils/@tests/stubtest_allowlist.txt +++ b/stubs/docutils/@tests/stubtest_allowlist.txt @@ -14,6 +14,7 @@ docutils.transforms.Transform.apply # method apply is not implemented docutils.transforms.Transform.__getattr__ docutils.TransformSpec.unknown_reference_resolvers docutils.writers.latex2e.PreambleCmds... contents +docutils.writers.latex2e.PreambleCmds.inline role \w+ # attribute names with spaces, set with setattr() from docutils.sty # Files that don't exist at runtime of stubtests, raises ImportError: docutils.parsers.commonmark_wrapper diff --git a/stubs/docutils/METADATA.toml b/stubs/docutils/METADATA.toml index 3d0d77995d83..f48cf6eedcb7 100644 --- a/stubs/docutils/METADATA.toml +++ b/stubs/docutils/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.22.3" +version = "0.23" upstream-repository = "https://sourceforge.net/p/docutils/code" diff --git a/stubs/docutils/docutils/frontend.pyi b/stubs/docutils/docutils/frontend.pyi index 1a457f810419..88aabf86b2e6 100644 --- a/stubs/docutils/docutils/frontend.pyi +++ b/stubs/docutils/docutils/frontend.pyi @@ -199,4 +199,4 @@ class ConfigParser(RawConfigParser): class ConfigDeprecationWarning(FutureWarning): ... -def get_default_settings(*components: SettingsSpec) -> Values: ... +def get_default_settings(*components: SettingsSpec | type[SettingsSpec]) -> Values: ... diff --git a/stubs/docutils/docutils/nodes.pyi b/stubs/docutils/docutils/nodes.pyi index d40fbed7cd19..56b49e584f2b 100644 --- a/stubs/docutils/docutils/nodes.pyi +++ b/stubs/docutils/docutils/nodes.pyi @@ -1,6 +1,6 @@ import sys import xml.dom.minidom -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from abc import abstractmethod from collections import Counter from collections.abc import Callable, Generator, Iterable, Iterator, Mapping, Sequence @@ -63,7 +63,12 @@ class Node: @overload def findall( - self, condition: type[_N], include_self: bool = True, descend: bool = True, siblings: bool = False, ascend: bool = False + self, + condition: type[_N] | tuple[type[_N], ...], + include_self: bool = True, + descend: bool = True, + siblings: bool = False, + ascend: bool = False, ) -> Generator[_N]: ... @overload def findall( @@ -78,7 +83,12 @@ class Node: @overload @deprecated("The `nodes.Node.traverse()` is deprecated. Use `Node.findall()` instead.") def traverse( - self, condition: type[_N], include_self: bool = True, descend: bool = True, siblings: bool = False, ascend: bool = False + self, + condition: type[_N] | tuple[type[_N], ...], + include_self: bool = True, + descend: bool = True, + siblings: bool = False, + ascend: bool = False, ) -> list[_N]: ... @overload @deprecated("The `nodes.Node.traverse()` is deprecated. Use `Node.findall()` instead.") @@ -93,7 +103,12 @@ class Node: @overload def next_node( - self, condition: type[_N], include_self: bool = False, descend: bool = True, siblings: bool = False, ascend: bool = False + self, + condition: type[_N] | tuple[type[_N], ...], + include_self: bool = False, + descend: bool = True, + siblings: bool = False, + ascend: bool = False, ) -> _N | None: ... @overload def next_node( @@ -309,6 +324,7 @@ class document(Root, Structural, Element): substitution_names: dict[str, str] refnames: dict[str, list[Element]] refids: dict[str, list[Element]] + names: dict[str, Element | None] nameids: dict[str, str] nametypes: dict[str, bool] ids: dict[str, Element] @@ -322,17 +338,21 @@ class document(Root, Structural, Element): citations: list[citation] autofootnote_start: int symbol_footnote_start: int - id_counter: Counter[int] + id_counter: Counter[str] parse_messages: list[system_message] transform_messages: list[system_message] transformer: Transformer + include_log: list[tuple[StrPath, tuple[Incomplete, ...]]] decoration: decoration | None document: Self def __init__(self, settings: Values, reporter: Reporter, *args: Node, **kwargs: Any) -> None: ... def asdom(self, dom: Any | None = None) -> Any: ... def set_id(self, node: Element, msgnode: Element | None = None, suggested_prefix: str = "") -> str: ... + def create_id(self, node: Element, suggested_prefix: str = "") -> str: ... + @deprecated("`nodes.document.set_name_id_map()` will be removed in Docutils 1.0.") def set_name_id_map(self, node: Element, id: str, msgnode: Element | None = None, explicit: bool = False) -> None: ... - def set_duplicate_name_id(self, node: Element, id: str, name: str, msgnode: Element, explicit: bool) -> None: ... + def set_duplicate_name(self, node: Element, name: str, msgnode: Element, explicit: bool) -> None: ... + def note_names(self, node: Element, msgnode: Element | None = None, explicit: bool = False) -> None: ... def has_name(self, name: str) -> bool: ... def note_implicit_target(self, target: Element, msgnode: Element | None = None) -> None: ... def note_explicit_target(self, target: Element, msgnode: Element | None = None) -> None: ... @@ -395,7 +415,9 @@ class footer(Decorative, Element): ... class section(Structural, Element): ... class topic(Structural, Element): ... class sidebar(Structural, Element): ... -class transition(Structural, Element): ... + +class transition(Structural, Element): + ignored_siblings: ClassVar[tuple[type[Element], ...]] # Body Elements # =============== diff --git a/stubs/docutils/docutils/parsers/rst/directives/tables.pyi b/stubs/docutils/docutils/parsers/rst/directives/tables.pyi index 56d14a5a6ac6..3bc3e4d3b430 100644 --- a/stubs/docutils/docutils/parsers/rst/directives/tables.pyi +++ b/stubs/docutils/docutils/parsers/rst/directives/tables.pyi @@ -48,9 +48,6 @@ class CSVTable(Table): quoting: Incomplete def __init__(self) -> None: ... - @staticmethod - @deprecated("Deprecated and not required with Python 3; will be removed in Docutils 0.22.") - def check_requirements() -> None: ... def process_header_option(self): ... def run(self) -> Sequence[nodes.table | nodes.system_message]: ... def get_csv_data(self): ... diff --git a/stubs/docutils/docutils/parsers/rst/roles.pyi b/stubs/docutils/docutils/parsers/rst/roles.pyi index 4697d6982e79..8c91bff07b63 100644 --- a/stubs/docutils/docutils/parsers/rst/roles.pyi +++ b/stubs/docutils/docutils/parsers/rst/roles.pyi @@ -102,7 +102,7 @@ def raw_role( content: Sequence[str] | None = None, ) -> tuple[list[Node], list[system_message]]: ... def code_role( - role: str, + role_name: str, rawtext: str, text: str, lineno: int, diff --git a/stubs/docutils/docutils/transforms/misc.pyi b/stubs/docutils/docutils/transforms/misc.pyi index 3baa09ca0761..5fddcda15047 100644 --- a/stubs/docutils/docutils/transforms/misc.pyi +++ b/stubs/docutils/docutils/transforms/misc.pyi @@ -17,3 +17,4 @@ class Transitions(Transform): default_priority: ClassVar[int] def apply(self) -> None: ... def visit_transition(self, node: nodes.transition) -> None: ... + def warn(self, msg: str, node: nodes.Node) -> None: ... diff --git a/stubs/docutils/docutils/transforms/references.pyi b/stubs/docutils/docutils/transforms/references.pyi index 3d6d710310ce..6bb14effc834 100644 --- a/stubs/docutils/docutils/transforms/references.pyi +++ b/stubs/docutils/docutils/transforms/references.pyi @@ -7,6 +7,10 @@ from docutils.transforms import Transform __docformat__: Final = "reStructuredText" +class SectionIDs(Transform): + default_priority: ClassVar[int] + def apply(self) -> None: ... + class PropagateTargets(Transform): default_priority: ClassVar[int] def apply(self) -> None: ... diff --git a/stubs/docutils/docutils/writers/latex2e/__init__.pyi b/stubs/docutils/docutils/writers/latex2e/__init__.pyi index 5b75055a0140..359019018439 100644 --- a/stubs/docutils/docutils/writers/latex2e/__init__.pyi +++ b/stubs/docutils/docutils/writers/latex2e/__init__.pyi @@ -77,6 +77,7 @@ class PreambleCmds: admonition: ClassVar[str] fieldlist: ClassVar[str] footnotes: ClassVar[str] + bracket_footnoterefs: ClassVar[str] inline: ClassVar[str] legend: ClassVar[str] lineblock: ClassVar[str]