Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions stubs/Markdown/@tests/test_cases/check_inlinepatterns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from __future__ import annotations

from typing_extensions import assert_type
from xml.etree.ElementTree import Element

from markdown.inlinepatterns import DelimiterProcessor, EvaluatedText


def check_delimiter_cache(processor: DelimiterProcessor, data: str, pos: int) -> None:
processor.build_cache(data)
assert_type(processor.get_cached_result(), tuple[Element, int, int])
assert_type(processor.get_cached_result(pos), tuple[Element, int, int])
assert_type(processor.get_cached_result(None), tuple[Element, int, int])


assert_type(EvaluatedText("text"), EvaluatedText)
2 changes: 1 addition & 1 deletion stubs/Markdown/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "~=3.11.3"
version = "~=3.11.4"
upstream-repository = "https://github.com/Python-Markdown/markdown"
6 changes: 4 additions & 2 deletions stubs/Markdown/markdown/inlinepatterns.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class HtmlInlineProcessor(InlineProcessor):
def unescape(self, text: str) -> str: ...
def backslash_unescape(self, text: str) -> str: ...

class EvaluatedText(str): ...

class Delimiter:
stack: deque[tuple[int, int, bool, int]]
tag_count: int
Expand Down Expand Up @@ -109,8 +111,8 @@ class DelimiterProcessor(InlineProcessor):
def add(self, token: str, tags: str, smart: bool = False, double: bool = False) -> None: ...
def remove(self, token: str) -> None: ...
def reset(self) -> None: ...
def increment_next_position(self, start: int, count: int) -> None: ...
def get_cached_result(self, pos: int, data: str) -> tuple[Element, int, int]: ...
def build_cache(self, data: str) -> None: ...
def get_cached_result(self, pos: int | None = None) -> tuple[Element, int, int]: ...
@staticmethod
def rule_of_3(opener: int, closer: int) -> bool: ...
def get_match(self, data: str, start: int) -> re.Match[str] | None: ...
Expand Down
Loading