diff --git a/stubs/Markdown/markdown/core.pyi b/stubs/Markdown/markdown/core.pyi index 7c5e77f586e8..e1f85a0f244a 100644 --- a/stubs/Markdown/markdown/core.pyi +++ b/stubs/Markdown/markdown/core.pyi @@ -21,7 +21,7 @@ class _ReadableStream(Protocol): class Markdown: preprocessors: Registry[preprocessors.Preprocessor] - inlinePatterns: Registry[inlinepatterns.Pattern] + inlinePatterns: Registry[inlinepatterns.InlineProcessor | inlinepatterns.Pattern] treeprocessors: Registry[treeprocessors.Treeprocessor] postprocessors: Registry[postprocessors.Postprocessor] parser: blockparser.BlockParser diff --git a/stubs/Markdown/markdown/extensions/smarty.pyi b/stubs/Markdown/markdown/extensions/smarty.pyi index dcf57107c141..b6f86d871d88 100644 --- a/stubs/Markdown/markdown/extensions/smarty.pyi +++ b/stubs/Markdown/markdown/extensions/smarty.pyi @@ -38,6 +38,6 @@ class SmartyExtension(Extension): def educateEllipses(self, md: Markdown) -> None: ... def educateAngledQuotes(self, md: Markdown) -> None: ... def educateQuotes(self, md: Markdown) -> None: ... - inlinePatterns: util.Registry[inlinepatterns.Pattern] + inlinePatterns: util.Registry[inlinepatterns.InlineProcessor | inlinepatterns.Pattern] def makeExtension(**kwargs) -> SmartyExtension: ... diff --git a/stubs/Markdown/markdown/inlinepatterns.pyi b/stubs/Markdown/markdown/inlinepatterns.pyi index 00ee4b4f0516..61b703082890 100644 --- a/stubs/Markdown/markdown/inlinepatterns.pyi +++ b/stubs/Markdown/markdown/inlinepatterns.pyi @@ -6,7 +6,7 @@ from xml.etree.ElementTree import Element from markdown import util from markdown.core import Markdown -def build_inlinepatterns(md: Markdown, **kwargs) -> util.Registry[Pattern]: ... +def build_inlinepatterns(md: Markdown, **kwargs) -> util.Registry[InlineProcessor | Pattern]: ... NOIMG: str BACKTICK_RE: str @@ -39,21 +39,23 @@ class EmStrongItem(NamedTuple): builder: str tags: str -class Pattern: +class _BasePattern: ANCESTOR_EXCLUDES: ClassVar[Collection[str]] pattern: str compiled_re: re.Pattern[str] md: Markdown def __init__(self, pattern: str, md: Markdown | None = None) -> None: ... def getCompiledRegExp(self) -> re.Pattern[str]: ... - def handleMatch(self, m: re.Match[str]) -> str | Element | None: ... def type(self) -> str: ... def unescape(self, text: str) -> str: ... -class InlineProcessor(Pattern): +class Pattern(_BasePattern): + def handleMatch(self, m: re.Match[str]) -> str | Element | None: ... + +class InlineProcessor(_BasePattern): safe_mode: bool def __init__(self, pattern: str, md: Markdown | None = None) -> None: ... - def handleMatch(self, m: re.Match[str], data: str) -> tuple[Element | str | None, int | None, int | None]: ... # type: ignore[override] + def handleMatch(self, m: re.Match[str], data: str) -> tuple[Element | str | None, int | None, int | None]: ... class SimpleTextPattern(Pattern): ... class SimpleTextInlineProcessor(InlineProcessor): ...