Use new union syntax in rest of stdlib (#5884)

This commit is contained in:
Akuli authored and GitHub committed 2021-08-08 15:44:30 +02:00
1 parent ebacd320a3
commit df6a211855
7 files changed
+177 -228

No files matched your search

+10 -10
View File
@@ -1,7 +1,7 @@
import sys
from email.errors import HeaderParseError, MessageDefect
from email.policy import Policy
from typing import Any, Iterable, Iterator, List, Optional, Pattern, Set, Tuple, Type, TypeVar, Union
from typing import Any, Iterable, Iterator, List, Pattern, Set, Tuple, Type, TypeVar, Union
from typing_extensions import Final
_T = TypeVar("_T")
@@ -24,7 +24,7 @@ if sys.version_info >= (3, 7):
rfc2047_matcher: Pattern[str]
class TokenList(List[Union[TokenList, Terminal]]):
token_type: Optional[str] = ...
token_type: str | None = ...
syntactic_break: bool = ...
ew_combine_allowed: bool = ...
defects: List[MessageDefect] = ...
@@ -69,9 +69,9 @@ class Token(TokenList):
class EncodedWord(TokenList):
token_type: str = ...
cte: Optional[str] = ...
charset: Optional[str] = ...
lang: Optional[str] = ...
cte: str | None = ...
charset: str | None = ...
lang: str | None = ...
class QuotedString(TokenList):
token_type: str = ...
@@ -145,7 +145,7 @@ class NameAddr(TokenList):
@property
def domain(self) -> str: ...
@property
def route(self) -> Optional[List[Domain]]: ...
def route(self) -> List[Domain] | None: ...
@property
def addr_spec(self) -> str: ...
@@ -156,7 +156,7 @@ class AngleAddr(TokenList):
@property
def domain(self) -> str: ...
@property
def route(self) -> Optional[List[Domain]]: ...
def route(self) -> List[Domain] | None: ...
@property
def addr_spec(self) -> str: ...
@@ -247,8 +247,8 @@ class DomainLiteral(TokenList):
class MIMEVersion(TokenList):
token_type: str = ...
major: Optional[int] = ...
minor: Optional[int] = ...
major: int | None = ...
minor: int | None = ...
class Parameter(TokenList):
token_type: str = ...
@@ -270,7 +270,7 @@ class Attribute(TokenList):
class Section(TokenList):
token_type: str = ...
number: Optional[int] = ...
number: int | None = ...
class Value(TokenList):
token_type: str = ...