Skip to content

Commit 4b0fec4

Browse files
authored
[docutils] Extend applicable types to _ContentModelCategory (#14719)
1 parent add4e85 commit 4b0fec4

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

stubs/docutils/@tests/stubtest_allowlist.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,3 @@ docutils.readers.TYPE_CHECKING
3636
docutils.utils.TYPE_CHECKING
3737
docutils.writers.TYPE_CHECKING
3838
docutils.writers._html_base.TYPE_CHECKING
39-
40-
# FIXME: new stubtest errors from mypy v1.18.1 that need to be looked at more closely.
41-
# See https://github.com/python/typeshed/pull/14699
42-
docutils\.nodes\.\w+\.content_model
43-
docutils.parsers.docutils_xml.Unknown.content_model
44-
docutils.transforms.universal.SmartQuotes.nodes_to_skip

stubs/docutils/docutils/nodes.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ from docutils.transforms import Transform, Transformer
1212
from docutils.utils import Reporter
1313

1414
_N = TypeVar("_N", bound=Node)
15-
_ContentModelCategory: TypeAlias = type[Element] | tuple[type[Element], ...]
15+
_ElementLikeType: TypeAlias = type[Element | Text | Body | Bibliographic | Inline]
16+
_ContentModelCategory: TypeAlias = _ElementLikeType | tuple[_ElementLikeType, ...]
1617
_ContentModelQuantifier: TypeAlias = Literal[".", "?", "+", "*"]
1718
_ContentModelItem: TypeAlias = tuple[_ContentModelCategory, _ContentModelQuantifier]
1819
_ContentModelTuple: TypeAlias = tuple[_ContentModelItem, ...]

stubs/docutils/docutils/transforms/universal.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class StripClassesAndElements(Transform):
4343

4444
class SmartQuotes(Transform):
4545
default_priority: ClassVar[int]
46-
nodes_to_skip: ClassVar[tuple[type[nodes.Node], ...]]
46+
nodes_to_skip: ClassVar[tuple[type[nodes.Node | nodes.Special], ...]]
4747
literal_nodes: ClassVar[tuple[type[nodes.Node | nodes.Body], ...]]
4848
smartquotes_action: ClassVar[str]
4949
unsupported_languages: set[str]

0 commit comments

Comments
 (0)