Use PEP 604 syntax wherever possible (#7493)

This commit is contained in:
Alex Waygood
2022-03-16 15:01:33 +00:00
committed by GitHub
parent 15e21a8dc1
commit 3ab250eec8
174 changed files with 472 additions and 490 deletions

View File

@@ -1,6 +1,6 @@
from _typeshed import Self
from collections.abc import Iterator
from typing import Any, Callable, Generic, Iterable, Pattern, TypeVar, Union, overload
from typing import Any, Callable, Generic, Iterable, Pattern, TypeVar, overload
from . import BeautifulSoup
from .builder import TreeBuilder
@@ -28,10 +28,10 @@ class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution):
_PageElementT = TypeVar("_PageElementT", bound=PageElement)
# The wrapping Union[] can be removed once mypy fully supports | in type aliases.
_SimpleStrainable = Union[str, bool, None, bytes, Pattern[str], Callable[[str], bool], Callable[[Tag], bool]]
_Strainable = Union[_SimpleStrainable, Iterable[_SimpleStrainable]]
_SimpleNormalizedStrainable = Union[str, bool, None, Pattern[str], Callable[[str], bool], Callable[[Tag], bool]]
_NormalizedStrainable = Union[_SimpleNormalizedStrainable, Iterable[_SimpleNormalizedStrainable]]
_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]
class PageElement:
parent: Tag | None