Python 3 stubs: use str instead of typing.Text (#7638)

This commit is contained in:
Alex Waygood
2022-04-16 15:47:00 +01:00
committed by GitHub
parent d802e65f67
commit 819900fa55
5 changed files with 56 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
from _typeshed import Self
from collections.abc import Callable, Mapping, Sequence
from typing import Any, BinaryIO, ClassVar, Text, TextIO
from typing import Any, BinaryIO, ClassVar, TextIO
from typing_extensions import Literal
from xml.etree.ElementTree import Element
@@ -15,9 +15,9 @@ class Markdown:
postprocessors: Registry
parser: BlockParser
htmlStash: HtmlStash
output_formats: ClassVar[dict[Literal["xhtml", "html"], Callable[[Element], Text]]]
output_formats: ClassVar[dict[Literal["xhtml", "html"], Callable[[Element], str]]]
output_format: Literal["xhtml", "html"]
serializer: Callable[[Element], Text]
serializer: Callable[[Element], str]
tab_length: int
block_level_elements: list[str]
def __init__(
@@ -30,12 +30,12 @@ class Markdown:
) -> None: ...
def build_parser(self) -> 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 build_extension(self, ext_name: str, configs: Mapping[str, str]) -> Extension: ...
def registerExtension(self, extension: Extension) -> Markdown: ...
def reset(self: Self) -> Self: ...
def set_output_format(self, format: Literal["xhtml", "html"]) -> Markdown: ...
def is_block_level(self, tag: str) -> bool: ...
def convert(self, source: Text) -> Text: ...
def convert(self, source: str) -> str: ...
def convertFile(
self,
input: str | TextIO | BinaryIO | None = ...,
@@ -44,13 +44,13 @@ class Markdown:
) -> Markdown: ...
def markdown(
text: Text,
text: str,
*,
extensions: Sequence[str | Extension] | None = ...,
extension_configs: Mapping[str, Mapping[str, Any]] | None = ...,
output_format: Literal["xhtml", "html"] | None = ...,
tab_length: int | None = ...,
) -> Text: ...
) -> str: ...
def markdownFromFile(
*,
input: str | TextIO | BinaryIO | None = ...,