Skip to content
Merged
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
12 changes: 9 additions & 3 deletions stubs/Markdown/markdown/treeprocessors.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
from _typeshed import Incomplete
from typing import Any
from re import Pattern
from typing import Any, ClassVar
from xml.etree.ElementTree import Element

from . import util

def build_treeprocessors(md, **kwargs): ...
def isString(s): ...

class Treeprocessor(util.Processor):
def run(self, root) -> Any | None: ...
def run(self, root: Element) -> Element | None: ...
Copy link
Member

@AlexWaygood AlexWaygood Feb 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring refers to this method as taking an ElementTree object, and xml.etree.ElementTree.ElementTree is a different class to xml.etree.ElementTree.Element. Is the docstring incorrect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, but yes, it’s really an Element, not an ElementTree: note this .getroot() call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I hate typing XML 🙃


class InlineProcessor(Treeprocessor):
inlinePatterns: Any
ancestors: Any
def __init__(self, md) -> None: ...
stashed_nodes: Any
parent_map: Any
def run(self, tree, ancestors: Incomplete | None = ...): ...
def run(self, tree: Element, ancestors: Incomplete | None = ...) -> Element: ...

class PrettifyTreeprocessor(Treeprocessor): ...

class UnescapeTreeprocessor(Treeprocessor):
RE: ClassVar[Pattern[str]]
def unescape(self, text: str) -> str: ...