Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,4 +1,4 @@
from typing import Any, Container, Iterable, Optional, Text
from typing import Any, Container, Iterable, Text
from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback
from bleach.sanitizer import (
@@ -26,5 +26,5 @@ def clean(
strip_comments: bool = ...,
) -> Text: ...
def linkify(
text: Text, callbacks: Iterable[_Callback] = ..., skip_tags: Optional[Container[Text]] = ..., parse_email: bool = ...
text: Text, callbacks: Iterable[_Callback] = ..., skip_tags: Container[Text] | None = ..., parse_email: bool = ...
) -> Text: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Generator, Iterable, List, Optional, Text
from typing import Any, Generator, Iterable, List, Text
class HTMLParser(object): # actually html5lib.HTMLParser
def __getattr__(self, __name: Text) -> Any: ... # incomplete
@@ -13,14 +13,14 @@ class HTMLSerializer(object): # actually html5lib.serializer.HTMLSerializer
def __getattr__(self, __name: Text) -> Any: ... # incomplete
class BleachHTMLParser(HTMLParser):
tags: Optional[List[Text]]
tags: List[Text] | None
strip: bool
consume_entities: bool
def __init__(self, tags: Optional[Iterable[Text]], strip: bool, consume_entities: bool, **kwargs) -> None: ...
def __init__(self, tags: Iterable[Text] | None, strip: bool, consume_entities: bool, **kwargs) -> None: ...
class BleachHTMLSerializer(HTMLSerializer):
escape_rcdata: bool
def escape_base_amp(self, stoken: Text) -> Generator[Text, None, None]: ...
def serialize(self, treewalker, encoding: Optional[Text] = ...) -> Generator[Text, None, None]: ...
def serialize(self, treewalker, encoding: Text | None = ...) -> Generator[Text, None, None]: ...
def __getattr__(__name: Text) -> Any: ... # incomplete

View File

@@ -1,4 +1,4 @@
from typing import Any, Container, Iterable, List, MutableMapping, Optional, Pattern, Protocol, Text
from typing import Any, Container, Iterable, List, MutableMapping, Pattern, Protocol, Text
from .html5lib_shim import Filter
@@ -24,11 +24,11 @@ class Linker(object):
def __init__(
self,
callbacks: Iterable[_Callback] = ...,
skip_tags: Optional[Container[Text]] = ...,
skip_tags: Container[Text] | None = ...,
parse_email: bool = ...,
url_re: Pattern[Text] = ...,
email_re: Pattern[Text] = ...,
recognized_tags: Optional[Container[Text]] = ...,
recognized_tags: Container[Text] | None = ...,
) -> None: ...
def linkify(self, text: Text) -> Text: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Container, Dict, Iterable, List, Optional, Pattern, Text, Union
from typing import Any, Callable, Container, Dict, Iterable, List, Pattern, Text, Union
from .html5lib_shim import BleachHTMLParser, BleachHTMLSerializer, SanitizerFilter
@@ -33,7 +33,7 @@ class Cleaner(object):
protocols: Container[Text] = ...,
strip: bool = ...,
strip_comments: bool = ...,
filters: Optional[Iterable[_Filter]] = ...,
filters: Iterable[_Filter] | None = ...,
) -> None: ...
def clean(self, text: Text) -> Text: ...