Skip to content

Commit 92b39fd

Browse files
committed
[docutils] Bump to 0.22.*
Closes: python#14496
1 parent 29be85e commit 92b39fd

38 files changed

+429
-238
lines changed

stubs/docutils/@tests/stubtest_allowlist.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
docutils.nodes.Element.__iter__ # doesn't exist at runtime, but the class is iterable due to __getitem__
22
docutils.nodes.Element.tagname # class variable is overridden in __init__ method
3-
docutils.nodes.NodeVisitor.depart_\w+ # Methods are discovered dynamically on commonly-used subclasses
3+
docutils.nodes.NodeVisitor.depart_\w+ # Methods are discovered dynamically on commonly-used subclasses
44
docutils.nodes.NodeVisitor.visit_\w+ # Methods are discovered dynamically on commonly-used subclasses
5+
docutils.nodes.NodeVisitor.__init__ # Argument "document" should be positional-only, but subclasses are not
6+
57
# these methods take a rawsource parameter that has been deprecated and is completely ignored, so we omit it from the stub
68
docutils.nodes.Text.__new__
79
docutils.parsers.rst.directives.admonitions.BaseAdmonition.node_class # must be overridden by base classes (pseudo-abstract)
@@ -11,8 +13,26 @@ docutils.statemachine.ViewList.__iter__ # doesn't exist at runtime, but the clas
1113
docutils.transforms.Transform.apply # method apply is not implemented
1214
docutils.transforms.Transform.__getattr__
1315
docutils.TransformSpec.unknown_reference_resolvers
16+
docutils.writers.latex2e.PreambleCmds... contents
1417

1518
# Files that don't exist at runtime of stubtests, raises ImportError:
1619
docutils.parsers.commonmark_wrapper
1720
docutils.parsers.recommonmark_wrapper
1821
docutils.writers.odf_odt.pygmentsformatter # import `pygments` third-party library
22+
23+
# `TYPE_CHECKING` variable is for internal use:
24+
docutils.TYPE_CHECKING
25+
docutils.core.TYPE_CHECKING
26+
docutils.examples.TYPE_CHECKING
27+
docutils.frontend.TYPE_CHECKING
28+
docutils.io.TYPE_CHECKING
29+
docutils.languages.TYPE_CHECKING
30+
docutils.nodes.TYPE_CHECKING
31+
docutils.parsers.TYPE_CHECKING
32+
docutils.parsers.rst.directives.TYPE_CHECKING
33+
docutils.parsers.rst.directives.misc.TYPE_CHECKING
34+
docutils.parsers.rst.languages.TYPE_CHECKING
35+
docutils.readers.TYPE_CHECKING
36+
docutils.utils.TYPE_CHECKING
37+
docutils.writers.TYPE_CHECKING
38+
docutils.writers._html_base.TYPE_CHECKING

stubs/docutils/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "0.21.*"
1+
version = "0.22.*"
22
upstream_repository = "https://sourceforge.net/p/docutils/code"

stubs/docutils/docutils/__main__.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
from typing import ClassVar
1+
from typing import ClassVar, Final
22

33
import docutils
44

5+
__docformat__: Final = "reStructuredText"
6+
57
class CliSettingsSpec(docutils.SettingsSpec):
68
config_section: ClassVar[str]
79
config_section_dependencies: ClassVar[tuple[str, ...]]

stubs/docutils/docutils/core.pyi

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from typing import Final
33
from typing_extensions import deprecated
44

55
from docutils import SettingsSpec
6-
from docutils.frontend import OptionParser
76
from docutils.io import FileInput, Input, Output
87
from docutils.parsers import Parser
98
from docutils.readers import Reader
@@ -33,18 +32,10 @@ class Publisher:
3332
destination_class=...,
3433
settings: dict[str, Incomplete] | None = None,
3534
) -> None: ...
36-
def set_reader(self, reader_name: str, parser: Parser | None, parser_name: str | None) -> None: ...
35+
def set_reader(self, reader: str, parser: Parser | None = None, parser_name: str | None = None) -> None: ...
3736
def set_writer(self, writer_name: str) -> None: ...
37+
@deprecated("The `Publisher.set_components()` will be removed in Docutils 2.0.")
3838
def set_components(self, reader_name: str, parser_name: str, writer_name: str) -> None: ...
39-
@deprecated("Publisher.setup_option_parser is deprecated, and will be removed in Docutils 0.21.")
40-
def setup_option_parser(
41-
self,
42-
usage: str | None = None,
43-
description: str | None = None,
44-
settings_spec: SettingsSpec | None = None,
45-
config_section: str | None = None,
46-
**defaults,
47-
) -> OptionParser: ...
4839
def get_settings(
4940
self,
5041
usage: str | None = None,
@@ -64,7 +55,7 @@ class Publisher:
6455
**defaults,
6556
) -> None: ...
6657
def set_io(self, source_path: StrPath | None = None, destination_path: StrPath | None = None) -> None: ...
67-
def set_source(self, source=None, source_path: StrPath | None = None) -> None: ...
58+
def set_source(self, source: str | None = None, source_path: StrPath | None = None) -> None: ...
6859
def set_destination(self, destination=None, destination_path: StrPath | None = None) -> None: ...
6960
def apply_transforms(self) -> None: ...
7061
def publish(
@@ -88,11 +79,11 @@ default_description: Final[str]
8879

8980
def publish_cmdline(
9081
reader: Reader[Incomplete] | None = None,
91-
reader_name: str = "standalone",
82+
reader_name: str | None = None,
9283
parser: Parser | None = None,
93-
parser_name: str = "restructuredtext",
84+
parser_name: str | None = None,
9485
writer: Writer[Incomplete] | None = None,
95-
writer_name: str = "pseudoxml",
86+
writer_name: str | None = None,
9687
settings=None,
9788
settings_spec=None,
9889
settings_overrides=None,
@@ -108,11 +99,11 @@ def publish_file(
10899
destination=None,
109100
destination_path: StrPath | None = None,
110101
reader=None,
111-
reader_name: str = "standalone",
102+
reader_name: str | None = None,
112103
parser=None,
113-
parser_name: str = "restructuredtext",
104+
parser_name: str | None = None,
114105
writer=None,
115-
writer_name: str = "pseudoxml",
106+
writer_name: str | None = None,
116107
settings=None,
117108
settings_spec=None,
118109
settings_overrides=None,
@@ -124,11 +115,11 @@ def publish_string(
124115
source_path: StrPath | None = None,
125116
destination_path: StrPath | None = None,
126117
reader=None,
127-
reader_name: str = "standalone",
118+
reader_name: str | None = None,
128119
parser=None,
129-
parser_name: str = "restructuredtext",
120+
parser_name: str | None = None,
130121
writer=None,
131-
writer_name: str = "pseudoxml",
122+
writer_name: str | None = None,
132123
settings=None,
133124
settings_spec=None,
134125
settings_overrides=None,
@@ -141,11 +132,11 @@ def publish_parts(
141132
source_class=...,
142133
destination_path: StrPath | None = None,
143134
reader=None,
144-
reader_name: str = "standalone",
135+
reader_name: str | None = None,
145136
parser=None,
146-
parser_name: str = "restructuredtext",
137+
parser_name: str | None = None,
147138
writer=None,
148-
writer_name: str = "pseudoxml",
139+
writer_name: str | None = None,
149140
settings=None,
150141
settings_spec=None,
151142
settings_overrides: dict[str, Incomplete] | None = None,
@@ -157,9 +148,9 @@ def publish_doctree(
157148
source_path: StrPath | None = None,
158149
source_class=...,
159150
reader=None,
160-
reader_name: str = "standalone",
151+
reader_name: str | None = None,
161152
parser=None,
162-
parser_name: str = "restructuredtext",
153+
parser_name: str | None = None,
163154
settings=None,
164155
settings_spec=None,
165156
settings_overrides=None,
@@ -170,13 +161,14 @@ def publish_from_doctree(
170161
document,
171162
destination_path: StrPath | None = None,
172163
writer=None,
173-
writer_name: str = "pseudoxml",
164+
writer_name: str | None = None,
174165
settings=None,
175166
settings_spec=None,
176167
settings_overrides=None,
177168
config_section: str | None = None,
178169
enable_exit_status: bool = False,
179170
): ...
171+
@deprecated("The `publish_cmdline_to_binary()` is deprecated by `publish_cmdline()` and will be removed in Docutils 0.24.")
180172
def publish_cmdline_to_binary(
181173
reader=None,
182174
reader_name: str = "standalone",

stubs/docutils/docutils/examples.pyi

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import Incomplete, StrPath
22
from typing import Literal, overload
33
from typing_extensions import TypeAlias
44

55
from docutils.core import Publisher
6-
from docutils.io import FileInput, StringInput
76
from docutils.nodes import document
87
from docutils.writers import _WriterParts
98

109
_HTMLHeaderLevel: TypeAlias = Literal[1, 2, 3, 4, 5, 6]
1110

1211
def html_parts(
13-
input_string: str,
14-
source_path=None,
15-
destination_path=None,
12+
input_string: str | bytes,
13+
source_path: StrPath | None = None,
14+
destination_path: StrPath | None = None,
1615
input_encoding: str = "unicode",
1716
doctitle: bool = True,
1817
initial_header_level: _HTMLHeaderLevel = 1,
1918
) -> _WriterParts: ...
2019
@overload
2120
def html_body(
22-
input_string: str,
23-
source_path=None,
24-
destination_path=None,
21+
input_string: str | bytes,
22+
source_path: StrPath | None = None,
23+
destination_path: StrPath | None = None,
2524
input_encoding: str = "unicode",
2625
output_encoding: Literal["unicode"] = "unicode",
2726
doctitle: bool = True,
2827
initial_header_level: _HTMLHeaderLevel = 1,
2928
) -> str: ...
3029
@overload
3130
def html_body(
32-
input_string: str,
33-
source_path=None,
34-
destination_path=None,
31+
input_string: str | bytes,
32+
source_path: StrPath | None = None,
33+
destination_path: StrPath | None = None,
3534
input_encoding: str = "unicode",
3635
output_encoding: str = "unicode",
3736
doctitle: bool = True,
3837
initial_header_level: _HTMLHeaderLevel = 1,
3938
) -> str | bytes: ...
4039
def internals(
41-
input_string,
42-
source_path: FileInput | StringInput | None = None,
43-
destination_path: FileInput | StringInput | None = None,
40+
source: str,
41+
source_path: StrPath | None = None,
4442
input_encoding: str = "unicode",
4543
settings_overrides: dict[str, Incomplete] | None = None,
4644
) -> tuple[document | None, Publisher]: ...

0 commit comments

Comments
 (0)