mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-01 09:03:23 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Dict, List, Mapping, Optional, Sequence, Text, TextIO, Union
|
||||
from typing import Any, BinaryIO, Callable, ClassVar, Dict, List, Mapping, Sequence, Text, TextIO
|
||||
from typing_extensions import Literal
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
@@ -21,15 +21,13 @@ class Markdown:
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
extensions: Optional[Sequence[Union[str, Extension]]] = ...,
|
||||
extension_configs: Optional[Mapping[str, Mapping[str, Any]]] = ...,
|
||||
output_format: Optional[Literal["xhtml", "html"]] = ...,
|
||||
tab_length: Optional[int] = ...,
|
||||
extensions: Sequence[str | Extension] | None = ...,
|
||||
extension_configs: Mapping[str, Mapping[str, Any]] | None = ...,
|
||||
output_format: Literal["xhtml", "html"] | None = ...,
|
||||
tab_length: int | None = ...,
|
||||
) -> None: ...
|
||||
def build_parser(self) -> Markdown: ...
|
||||
def registerExtensions(
|
||||
self, extensions: Sequence[Union[Extension, str]], configs: Mapping[str, Mapping[str, Any]]
|
||||
) -> Markdown: ...
|
||||
def registerExtensions(self, extensions: Sequence[Extension | str], configs: Mapping[str, Mapping[str, Any]]) -> Markdown: ...
|
||||
def build_extension(self, ext_name: Text, configs: Mapping[str, str]) -> Extension: ...
|
||||
def registerExtension(self, extension: Extension) -> Markdown: ...
|
||||
def reset(self: Markdown) -> Markdown: ...
|
||||
@@ -38,26 +36,26 @@ class Markdown:
|
||||
def convert(self, source: Text) -> Text: ...
|
||||
def convertFile(
|
||||
self,
|
||||
input: Optional[Union[str, TextIO, BinaryIO]] = ...,
|
||||
output: Optional[Union[str, TextIO, BinaryIO]] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
input: str | TextIO | BinaryIO | None = ...,
|
||||
output: str | TextIO | BinaryIO | None = ...,
|
||||
encoding: str | None = ...,
|
||||
) -> Markdown: ...
|
||||
|
||||
def markdown(
|
||||
text: Text,
|
||||
*,
|
||||
extensions: Optional[Sequence[Union[str, Extension]]] = ...,
|
||||
extension_configs: Optional[Mapping[str, Mapping[str, Any]]] = ...,
|
||||
output_format: Optional[Literal["xhtml", "html"]] = ...,
|
||||
tab_length: Optional[int] = ...,
|
||||
extensions: Sequence[str | Extension] | None = ...,
|
||||
extension_configs: Mapping[str, Mapping[str, Any]] | None = ...,
|
||||
output_format: Literal["xhtml", "html"] | None = ...,
|
||||
tab_length: int | None = ...,
|
||||
) -> Text: ...
|
||||
def markdownFromFile(
|
||||
*,
|
||||
input: Optional[Union[str, TextIO, BinaryIO]] = ...,
|
||||
output: Optional[Union[str, TextIO, BinaryIO]] = ...,
|
||||
encoding: Optional[str] = ...,
|
||||
extensions: Optional[Sequence[Union[str, Extension]]] = ...,
|
||||
extension_configs: Optional[Mapping[str, Mapping[str, Any]]] = ...,
|
||||
output_format: Optional[Literal["xhtml", "html"]] = ...,
|
||||
tab_length: Optional[int] = ...,
|
||||
input: str | TextIO | BinaryIO | None = ...,
|
||||
output: str | TextIO | BinaryIO | None = ...,
|
||||
encoding: str | None = ...,
|
||||
extensions: Sequence[str | Extension] | None = ...,
|
||||
extension_configs: Mapping[str, Mapping[str, Any]] | None = ...,
|
||||
output_format: Literal["xhtml", "html"] | None = ...,
|
||||
tab_length: int | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict
|
||||
|
||||
from markdown.extensions import Extension
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
@@ -21,16 +21,16 @@ class CodeHilite:
|
||||
options: Dict[str, Any]
|
||||
def __init__(
|
||||
self,
|
||||
src: Optional[Any] = ...,
|
||||
src: Any | None = ...,
|
||||
*,
|
||||
linenums: Optional[Any] = ...,
|
||||
linenums: Any | None = ...,
|
||||
guess_lang: bool = ...,
|
||||
css_class: str = ...,
|
||||
lang: Optional[Any] = ...,
|
||||
lang: Any | None = ...,
|
||||
style: str = ...,
|
||||
noclasses: bool = ...,
|
||||
tab_length: int = ...,
|
||||
hl_lines: Optional[Any] = ...,
|
||||
hl_lines: Any | None = ...,
|
||||
use_pygments: bool = ...,
|
||||
**options: Any,
|
||||
) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Match, Optional, Tuple, Union
|
||||
from typing import Any, Match, Tuple
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
def build_inlinepatterns(md, **kwargs): ...
|
||||
@@ -36,18 +36,18 @@ class Pattern:
|
||||
pattern: Any
|
||||
compiled_re: Any
|
||||
md: Any
|
||||
def __init__(self, pattern, md: Optional[Any] = ...) -> None: ...
|
||||
def __init__(self, pattern, md: Any | None = ...) -> None: ...
|
||||
@property
|
||||
def markdown(self): ...
|
||||
def getCompiledRegExp(self): ...
|
||||
def handleMatch(self, m: Match[str]) -> Optional[Union[str, Element]]: ...
|
||||
def handleMatch(self, m: Match[str]) -> str | Element | None: ...
|
||||
def type(self): ...
|
||||
def unescape(self, text): ...
|
||||
|
||||
class InlineProcessor(Pattern):
|
||||
safe_mode: bool = ...
|
||||
def __init__(self, pattern, md: Optional[Any] = ...) -> None: ...
|
||||
def handleMatch(self, m: Match[str], data) -> Union[Tuple[Element, int, int], Tuple[None, None, None]]: ... # type: ignore
|
||||
def __init__(self, pattern, md: Any | None = ...) -> None: ...
|
||||
def handleMatch(self, m: Match[str], data) -> Tuple[Element, int, int] | Tuple[None, None, None]: ... # type: ignore
|
||||
|
||||
class SimpleTextPattern(Pattern): ...
|
||||
class SimpleTextInlineProcessor(InlineProcessor): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
from . import util
|
||||
|
||||
@@ -6,7 +6,7 @@ def build_treeprocessors(md, **kwargs): ...
|
||||
def isString(s): ...
|
||||
|
||||
class Treeprocessor(util.Processor):
|
||||
def run(self, root) -> Optional[Any]: ...
|
||||
def run(self, root) -> Any | None: ...
|
||||
|
||||
class InlineProcessor(Treeprocessor):
|
||||
inlinePatterns: Any
|
||||
@@ -14,6 +14,6 @@ class InlineProcessor(Treeprocessor):
|
||||
def __init__(self, md) -> None: ...
|
||||
stashed_nodes: Any
|
||||
parent_map: Any
|
||||
def run(self, tree, ancestors: Optional[Any] = ...): ...
|
||||
def run(self, tree, ancestors: Any | None = ...): ...
|
||||
|
||||
class PrettifyTreeprocessor(Treeprocessor): ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional, Pattern
|
||||
from typing import Any, Pattern
|
||||
|
||||
PY37: Any
|
||||
__deprecated__: Any
|
||||
@@ -24,7 +24,7 @@ class AtomicString(str): ...
|
||||
|
||||
class Processor:
|
||||
md: Any
|
||||
def __init__(self, md: Optional[Any] = ...) -> None: ...
|
||||
def __init__(self, md: Any | None = ...) -> None: ...
|
||||
@property
|
||||
def markdown(self): ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user