mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-06 23:24:25 +08:00
Use TypeAlias where possible for type aliases (#7630)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from collections.abc import MutableMapping
|
||||
from typing import Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_Attrs = MutableMapping[Any, str]
|
||||
_Attrs: TypeAlias = MutableMapping[Any, str]
|
||||
|
||||
def nofollow(attrs: _Attrs, new: bool = ...) -> _Attrs: ...
|
||||
def target_blank(attrs: _Attrs, new: bool = ...) -> _Attrs: ...
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from collections.abc import Container, Iterable, MutableMapping
|
||||
from typing import Any, Pattern, Protocol
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .html5lib_shim import Filter
|
||||
|
||||
_Attrs = MutableMapping[Any, str]
|
||||
_Attrs: TypeAlias = MutableMapping[Any, str]
|
||||
|
||||
class _Callback(Protocol):
|
||||
def __call__(self, attrs: _Attrs, new: bool = ...) -> _Attrs: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections.abc import Callable, Container, Iterable
|
||||
from typing import Any, Pattern
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .css_sanitizer import CSSSanitizer
|
||||
from .html5lib_shim import BleachHTMLParser, BleachHTMLSerializer, SanitizerFilter
|
||||
@@ -38,9 +39,9 @@ class Cleaner:
|
||||
) -> None: ...
|
||||
def clean(self, text: str) -> str: ...
|
||||
|
||||
_AttributeFilter = Callable[[str, str, str], bool]
|
||||
_AttributeDict = dict[str, list[str] | _AttributeFilter] | dict[str, list[str]] | dict[str, _AttributeFilter]
|
||||
_Attributes = _AttributeFilter | _AttributeDict | list[str]
|
||||
_AttributeFilter: TypeAlias = Callable[[str, str, str], bool]
|
||||
_AttributeDict: TypeAlias = dict[str, list[str] | _AttributeFilter] | dict[str, list[str]] | dict[str, _AttributeFilter]
|
||||
_Attributes: TypeAlias = _AttributeFilter | _AttributeDict | list[str]
|
||||
|
||||
def attribute_filter_factory(attributes: _Attributes) -> _AttributeFilter: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user