mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-25 01:38:40 +08:00
Use TypeAlias where possible for type aliases (#7630)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from _typeshed import Self
|
||||
from collections.abc import Iterator
|
||||
from typing import Any, Callable, Generic, Iterable, Pattern, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import BeautifulSoup
|
||||
from .builder import TreeBuilder
|
||||
@@ -27,10 +28,10 @@ class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution):
|
||||
def encode(self, encoding: str) -> str: ... # type: ignore[override] # incompatible with str
|
||||
|
||||
_PageElementT = TypeVar("_PageElementT", bound=PageElement)
|
||||
_SimpleStrainable = str | bool | None | bytes | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool]
|
||||
_Strainable = _SimpleStrainable | Iterable[_SimpleStrainable]
|
||||
_SimpleNormalizedStrainable = str | bool | None | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool]
|
||||
_NormalizedStrainable = _SimpleNormalizedStrainable | Iterable[_SimpleNormalizedStrainable]
|
||||
_SimpleStrainable: TypeAlias = str | bool | None | bytes | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool]
|
||||
_Strainable: TypeAlias = _SimpleStrainable | Iterable[_SimpleStrainable]
|
||||
_SimpleNormalizedStrainable: TypeAlias = str | bool | None | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool]
|
||||
_NormalizedStrainable: TypeAlias = _SimpleNormalizedStrainable | Iterable[_SimpleNormalizedStrainable]
|
||||
|
||||
class PageElement:
|
||||
parent: Tag | None
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from typing import Callable
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .dammit import EntitySubstitution as EntitySubstitution
|
||||
|
||||
_EntitySubstitution = Callable[[str], str]
|
||||
_EntitySubstitution: TypeAlias = Callable[[str], str]
|
||||
|
||||
class Formatter(EntitySubstitution):
|
||||
HTML: str
|
||||
|
||||
Reference in New Issue
Block a user