mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add types to Markdown (#6045)
Most methods and attributes were previously untyped or `Any`-typed. Co-authored-by: PythonCoderAS <13932583+PythonCoderAS@users.noreply.github.com> Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
markdown.blockprocessors.BlockProcessor.detab
|
||||
markdown.extensions.abbr.ABBR_REF_RE
|
||||
markdown.extensions.attr_list.AttrListTreeprocessor.run
|
||||
markdown.extensions.codehilite.CodeHilite.__init__
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
from typing import Any
|
||||
|
||||
__version_info__: Any
|
||||
__version_info__: tuple[int, int, int, str, int]
|
||||
__version__: str
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
from typing import Any, List
|
||||
from typing import Any, Iterable, List, TypeVar
|
||||
from xml.etree.ElementTree import Element, ElementTree
|
||||
|
||||
class State(List[Any]):
|
||||
def set(self, state) -> None: ...
|
||||
from . import Markdown
|
||||
from .util import Registry
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class State(List[_T]):
|
||||
def set(self, state: _T) -> None: ...
|
||||
def reset(self) -> None: ...
|
||||
def isstate(self, state): ...
|
||||
def isstate(self, state: _T) -> bool: ...
|
||||
|
||||
class BlockParser:
|
||||
blockprocessors: Any
|
||||
state: Any
|
||||
md: Any
|
||||
def __init__(self, md) -> None: ...
|
||||
blockprocessors: Registry
|
||||
state: State[Any] # TODO: possible to get rid of Any?
|
||||
md: Markdown
|
||||
def __init__(self, md: Markdown) -> None: ...
|
||||
@property
|
||||
def markdown(self): ...
|
||||
root: Any
|
||||
def parseDocument(self, lines): ...
|
||||
def parseChunk(self, parent, text) -> None: ...
|
||||
def parseBlocks(self, parent, blocks) -> None: ...
|
||||
def markdown(self): ... # deprecated
|
||||
root: Element
|
||||
def parseDocument(self, lines: Iterable[str]) -> ElementTree: ...
|
||||
def parseChunk(self, parent: Element, text: str) -> None: ...
|
||||
def parseBlocks(self, parent: Element, blocks: list[str]) -> None: ...
|
||||
|
||||
@@ -1,48 +1,54 @@
|
||||
from typing import Any, Pattern
|
||||
from logging import Logger
|
||||
from typing import Any, Match, Pattern
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
logger: Any
|
||||
from markdown import Markdown
|
||||
|
||||
def build_block_parser(md, **kwargs): ...
|
||||
from .blockparser import BlockParser
|
||||
|
||||
logger: Logger
|
||||
|
||||
def build_block_parser(md: Markdown, **kwargs: Any): ...
|
||||
|
||||
class BlockProcessor:
|
||||
parser: Any
|
||||
tab_length: Any
|
||||
def __init__(self, parser) -> None: ...
|
||||
def lastChild(self, parent): ...
|
||||
def detab(self, text): ...
|
||||
def looseDetab(self, text, level: int = ...): ...
|
||||
def test(self, parent, block) -> None: ...
|
||||
def run(self, parent, blocks) -> None: ...
|
||||
parser: BlockParser
|
||||
tab_length: int
|
||||
def __init__(self, parser: BlockParser) -> None: ...
|
||||
def lastChild(self, parent: Element) -> Element | None: ...
|
||||
def detab(self, text: str, length: int | None = ...): ...
|
||||
def looseDetab(self, text: str, level: int = ...): ...
|
||||
def test(self, parent: Element, block: str) -> None: ...
|
||||
def run(self, parent: Element, blocks: list[str]) -> None: ...
|
||||
|
||||
class ListIndentProcessor(BlockProcessor):
|
||||
ITEM_TYPES: Any
|
||||
LIST_TYPES: Any
|
||||
ITEM_TYPES: list[str]
|
||||
LIST_TYPES: list[str]
|
||||
INDENT_RE: Pattern[str]
|
||||
def __init__(self, *args) -> None: ...
|
||||
def create_item(self, parent, block) -> None: ...
|
||||
def get_level(self, parent, block): ...
|
||||
def __init__(self, parser: BlockParser) -> None: ... # Note: This was done because the args are sent as-is.
|
||||
def create_item(self, parent: Element, block: str) -> None: ...
|
||||
def get_level(self, parent: Element, block: str) -> tuple[int, Element]: ...
|
||||
|
||||
class CodeBlockProcessor(BlockProcessor): ...
|
||||
|
||||
class BlockQuoteProcessor(BlockProcessor):
|
||||
RE: Pattern[str]
|
||||
def clean(self, line): ...
|
||||
def clean(self, line: str) -> str: ...
|
||||
|
||||
class OListProcessor(BlockProcessor):
|
||||
TAG: str = ...
|
||||
STARTSWITH: str = ...
|
||||
LAZY_OL: bool = ...
|
||||
SIBLING_TAGS: Any
|
||||
SIBLING_TAGS: list[str]
|
||||
RE: Pattern[str]
|
||||
CHILD_RE: Pattern[str]
|
||||
INDENT_RE: Pattern[str]
|
||||
def __init__(self, parser) -> None: ...
|
||||
def get_items(self, block): ...
|
||||
def __init__(self, parser: BlockParser) -> None: ...
|
||||
def get_items(self, block: str) -> list[str]: ...
|
||||
|
||||
class UListProcessor(OListProcessor):
|
||||
TAG: str = ...
|
||||
RE: Pattern[str]
|
||||
def __init__(self, parser) -> None: ...
|
||||
def __init__(self, parser: BlockParser) -> None: ...
|
||||
|
||||
class HashHeaderProcessor(BlockProcessor):
|
||||
RE: Pattern[str]
|
||||
@@ -53,7 +59,7 @@ class SetextHeaderProcessor(BlockProcessor):
|
||||
class HRProcessor(BlockProcessor):
|
||||
RE: str = ...
|
||||
SEARCH_RE: Pattern[str]
|
||||
match: Any
|
||||
match: Match[str]
|
||||
|
||||
class EmptyBlockProcessor(BlockProcessor): ...
|
||||
class ParagraphProcessor(BlockProcessor): ...
|
||||
|
||||
Reference in New Issue
Block a user