Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence, Tuple, Union, overload
from typing import Any, AnyStr, Callable, Generic, Mapping, NamedTuple, Sequence, Union, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -35,7 +35,7 @@ class _NetlocResultMixinBase(Generic[AnyStr]):
class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ...
class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ...
class _DefragResultBase(Tuple[Any, ...], Generic[AnyStr]):
class _DefragResultBase(tuple[Any, ...], Generic[AnyStr]):
url: AnyStr
fragment: AnyStr

View File

@@ -4,7 +4,7 @@ from _typeshed import StrOrBytesPath
from email.message import Message
from http.client import HTTPMessage, HTTPResponse, _HTTPConnectionProtocol
from http.cookiejar import CookieJar
from typing import IO, Any, Callable, ClassVar, Mapping, NoReturn, Pattern, Sequence, Tuple, TypeVar, overload
from typing import IO, Any, Callable, ClassVar, Mapping, NoReturn, Pattern, Sequence, TypeVar, overload
from urllib.error import HTTPError
from urllib.response import addclosehook, addinfourl
@@ -196,9 +196,9 @@ class HTTPSHandler(AbstractHTTPHandler):
def https_request(self, request: Request) -> Request: ... # undocumented
class FileHandler(BaseHandler):
names: ClassVar[Tuple[str, ...] | None] # undocumented
names: ClassVar[tuple[str, ...] | None] # undocumented
def file_open(self, req: Request) -> addinfourl: ...
def get_names(self) -> Tuple[str, ...]: ... # undocumented
def get_names(self) -> tuple[str, ...]: ... # undocumented
def open_local_file(self, req: Request) -> addinfourl: ... # undocumented
class DataHandler(BaseHandler):

View File

@@ -2,7 +2,7 @@ import sys
from _typeshed import Self
from email.message import Message
from types import TracebackType
from typing import IO, Any, BinaryIO, Callable, Iterable, Tuple, Type, TypeVar
from typing import IO, Any, BinaryIO, Callable, Iterable, Type, TypeVar
_AIUT = TypeVar("_AIUT", bound=addbase)
@@ -37,7 +37,7 @@ class addbase(BinaryIO):
class addclosehook(addbase):
closehook: Callable[..., object]
hookargs: Tuple[Any, ...]
hookargs: tuple[Any, ...]
def __init__(self, fp: IO[bytes], closehook: Callable[..., object], *hookargs: Any) -> None: ...
class addinfo(addbase):