From 8307b3c36264fa65b4c2e416fdf0527f02f63312 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 21 Aug 2024 18:06:28 +0300 Subject: [PATCH] Bump Markdown to 3.7.* (#12565) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastian Rittau Co-authored-by: Jelle Zijlstra --- stubs/Markdown/@tests/stubtest_allowlist.txt | 3 +++ stubs/Markdown/METADATA.toml | 2 +- stubs/Markdown/markdown/extensions/abbr.pyi | 25 ++++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/stubs/Markdown/@tests/stubtest_allowlist.txt b/stubs/Markdown/@tests/stubtest_allowlist.txt index e69de29bb2d1..e7cd7309850d 100644 --- a/stubs/Markdown/@tests/stubtest_allowlist.txt +++ b/stubs/Markdown/@tests/stubtest_allowlist.txt @@ -0,0 +1,3 @@ +# Deprecated types are infered as functions: +markdown.extensions.abbr.AbbrPreprocessor +markdown.extensions.abbr.AbbrInlineProcessor diff --git a/stubs/Markdown/METADATA.toml b/stubs/Markdown/METADATA.toml index 7a3571b51a5c..7720828f4533 100644 --- a/stubs/Markdown/METADATA.toml +++ b/stubs/Markdown/METADATA.toml @@ -1,4 +1,4 @@ -version = "3.6.*" +version = "3.7.*" upstream_repository = "https://github.com/Python-Markdown/markdown" partial_stub = true diff --git a/stubs/Markdown/markdown/extensions/abbr.pyi b/stubs/Markdown/markdown/extensions/abbr.pyi index 682f805406f9..ace06e144ae1 100644 --- a/stubs/Markdown/markdown/extensions/abbr.pyi +++ b/stubs/Markdown/markdown/extensions/abbr.pyi @@ -1,15 +1,36 @@ from re import Pattern from typing import ClassVar +from typing_extensions import deprecated +from xml.etree.ElementTree import Element +from markdown.blockparser import BlockParser from markdown.blockprocessors import BlockProcessor +from markdown.core import Markdown from markdown.extensions import Extension from markdown.inlinepatterns import InlineProcessor +from markdown.treeprocessors import Treeprocessor -class AbbrExtension(Extension): ... +class AbbrExtension(Extension): + def reset(self) -> None: ... + def reset_glossary(self) -> None: ... + def load_glossary(self, dictionary: dict[str, str]) -> None: ... -class AbbrPreprocessor(BlockProcessor): +class AbbrTreeprocessor(Treeprocessor): + RE: Pattern[str] | None + abbrs: dict[str, str] + def __init__(self, md: Markdown | None = None, abbrs: dict[str, str] | None = None) -> None: ... + def iter_element(self, el: Element, parent: Element | None = None) -> None: ... + +# Techinically it is the same type as `AbbrPreprocessor` just not deprecated. +class AbbrBlockprocessor(BlockProcessor): RE: ClassVar[Pattern[str]] + abbrs: dict[str, str] + def __init__(self, parser: BlockParser, abbrs: dict[str, str]) -> None: ... + +@deprecated("This class will be removed in the future; use `AbbrTreeprocessor` instead.") +class AbbrPreprocessor(AbbrBlockprocessor): ... +@deprecated("This class will be removed in the future; use `AbbrTreeprocessor` instead.") class AbbrInlineProcessor(InlineProcessor): title: str def __init__(self, pattern: str, title: str) -> None: ...