From d6f2835d608dde71c4e2a6cf274ba620396edd06 Mon Sep 17 00:00:00 2001 From: Semyon Moroz Date: Fri, 21 Mar 2025 17:31:36 +0400 Subject: [PATCH] Clarify sequences for `markdown` stubs (#13686) --- stubs/Markdown/markdown/__init__.pyi | 3 +++ stubs/Markdown/markdown/extensions/extra.pyi | 4 +--- stubs/Markdown/markdown/extensions/meta.pyi | 2 -- stubs/Markdown/markdown/extensions/smarty.pyi | 3 +-- stubs/Markdown/markdown/treeprocessors.pyi | 4 ++-- stubs/Markdown/markdown/util.pyi | 24 +++++++++---------- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/stubs/Markdown/markdown/__init__.pyi b/stubs/Markdown/markdown/__init__.pyi index 3f57adcc4..f9e139497 100644 --- a/stubs/Markdown/markdown/__init__.pyi +++ b/stubs/Markdown/markdown/__init__.pyi @@ -1,2 +1,5 @@ +from .__meta__ import __version__ as __version__, __version_info__ as __version_info__ from .core import Markdown as Markdown, markdown as markdown, markdownFromFile as markdownFromFile from .extensions import Extension as Extension + +__all__ = ["Markdown", "markdown", "markdownFromFile"] diff --git a/stubs/Markdown/markdown/extensions/extra.pyi b/stubs/Markdown/markdown/extensions/extra.pyi index 7262914db..b063970d1 100644 --- a/stubs/Markdown/markdown/extensions/extra.pyi +++ b/stubs/Markdown/markdown/extensions/extra.pyi @@ -1,8 +1,6 @@ -from typing import Any - from markdown.extensions import Extension -extensions: Any +extensions: list[str] class ExtraExtension(Extension): def __init__(self, **kwargs) -> None: ... diff --git a/stubs/Markdown/markdown/extensions/meta.pyi b/stubs/Markdown/markdown/extensions/meta.pyi index d3ef7e8d5..b0bead44a 100644 --- a/stubs/Markdown/markdown/extensions/meta.pyi +++ b/stubs/Markdown/markdown/extensions/meta.pyi @@ -1,11 +1,9 @@ from re import Pattern -from typing import Any from markdown.core import Markdown from markdown.extensions import Extension from markdown.preprocessors import Preprocessor -log: Any META_RE: Pattern[str] META_MORE_RE: Pattern[str] BEGIN_RE: Pattern[str] diff --git a/stubs/Markdown/markdown/extensions/smarty.pyi b/stubs/Markdown/markdown/extensions/smarty.pyi index dcf57107c..9a0004630 100644 --- a/stubs/Markdown/markdown/extensions/smarty.pyi +++ b/stubs/Markdown/markdown/extensions/smarty.pyi @@ -1,5 +1,4 @@ from collections.abc import Mapping, Sequence -from typing import Any from xml.etree.ElementTree import Element from markdown import inlinepatterns, util @@ -32,7 +31,7 @@ class SubstituteTextPattern(HtmlInlineProcessor): def __init__(self, pattern: str, replace: Sequence[int | str | Element], md: Markdown) -> None: ... class SmartyExtension(Extension): - substitutions: Any + substitutions: dict[str, str] def __init__(self, **kwargs) -> None: ... def educateDashes(self, md: Markdown) -> None: ... def educateEllipses(self, md: Markdown) -> None: ... diff --git a/stubs/Markdown/markdown/treeprocessors.pyi b/stubs/Markdown/markdown/treeprocessors.pyi index 9afc5d801..2648d02d2 100644 --- a/stubs/Markdown/markdown/treeprocessors.pyi +++ b/stubs/Markdown/markdown/treeprocessors.pyi @@ -1,5 +1,5 @@ from re import Pattern -from typing import Any, ClassVar +from typing import ClassVar from typing_extensions import TypeGuard from xml.etree.ElementTree import Element @@ -17,7 +17,7 @@ class InlineProcessor(Treeprocessor): ancestors: list[str] def __init__(self, md: Markdown) -> None: ... stashed_nodes: dict[str, Element | str] - parent_map: Any + parent_map: dict[Element[str], Element[str]] def run(self, tree: Element, ancestors: list[str] | None = None) -> Element: ... class PrettifyTreeprocessor(Treeprocessor): ... diff --git a/stubs/Markdown/markdown/util.pyi b/stubs/Markdown/markdown/util.pyi index 2a0d9fdd0..d1160266b 100644 --- a/stubs/Markdown/markdown/util.pyi +++ b/stubs/Markdown/markdown/util.pyi @@ -1,22 +1,22 @@ from collections.abc import Iterator from re import Pattern -from typing import Any, Generic, TypedDict, TypeVar, overload +from typing import Final, Generic, TypedDict, TypeVar, overload from markdown.core import Markdown _T = TypeVar("_T") -BLOCK_LEVEL_ELEMENTS: list[str] -STX: str -ETX: str -INLINE_PLACEHOLDER_PREFIX: str -INLINE_PLACEHOLDER: str -INLINE_PLACEHOLDER_RE: Pattern[str] -AMP_SUBSTITUTE: str -HTML_PLACEHOLDER: str -HTML_PLACEHOLDER_RE: Pattern[str] -TAG_PLACEHOLDER: str -RTL_BIDI_RANGES: Any +BLOCK_LEVEL_ELEMENTS: Final[list[str]] +STX: Final[str] +ETX: Final[str] +INLINE_PLACEHOLDER_PREFIX: Final[str] +INLINE_PLACEHOLDER: Final[str] +INLINE_PLACEHOLDER_RE: Final[Pattern[str]] +AMP_SUBSTITUTE: Final[str] +HTML_PLACEHOLDER: Final[str] +HTML_PLACEHOLDER_RE: Final[Pattern[str]] +TAG_PLACEHOLDER: Final[str] +RTL_BIDI_RANGES: Final[tuple[tuple[str, str], tuple[str, str]]] def get_installed_extensions(): ... def deprecated(message: str, stacklevel: int = 2): ...