[docutils] Extend applicable types to _ContentModelCategory (#14719)

This commit is contained in:
Semyon Moroz
2025-09-18 17:57:51 +04:00
committed by GitHub
parent add4e85823
commit 4b0fec4506
3 changed files with 3 additions and 8 deletions
@@ -36,9 +36,3 @@ docutils.readers.TYPE_CHECKING
docutils.utils.TYPE_CHECKING
docutils.writers.TYPE_CHECKING
docutils.writers._html_base.TYPE_CHECKING
# FIXME: new stubtest errors from mypy v1.18.1 that need to be looked at more closely.
# See https://github.com/python/typeshed/pull/14699
docutils\.nodes\.\w+\.content_model
docutils.parsers.docutils_xml.Unknown.content_model
docutils.transforms.universal.SmartQuotes.nodes_to_skip
+2 -1
View File
@@ -12,7 +12,8 @@ from docutils.transforms import Transform, Transformer
from docutils.utils import Reporter
_N = TypeVar("_N", bound=Node)
_ContentModelCategory: TypeAlias = type[Element] | tuple[type[Element], ...]
_ElementLikeType: TypeAlias = type[Element | Text | Body | Bibliographic | Inline]
_ContentModelCategory: TypeAlias = _ElementLikeType | tuple[_ElementLikeType, ...]
_ContentModelQuantifier: TypeAlias = Literal[".", "?", "+", "*"]
_ContentModelItem: TypeAlias = tuple[_ContentModelCategory, _ContentModelQuantifier]
_ContentModelTuple: TypeAlias = tuple[_ContentModelItem, ...]
@@ -43,7 +43,7 @@ class StripClassesAndElements(Transform):
class SmartQuotes(Transform):
default_priority: ClassVar[int]
nodes_to_skip: ClassVar[tuple[type[nodes.Node], ...]]
nodes_to_skip: ClassVar[tuple[type[nodes.Node | nodes.Special], ...]]
literal_nodes: ClassVar[tuple[type[nodes.Node | nodes.Body], ...]]
smartquotes_action: ClassVar[str]
unsupported_languages: set[str]