Use lowercase tuple where possible (#6170)

This commit is contained in:
Akuli
2021-10-15 00:18:19 +00:00
committed by GitHub
parent 5f386b0575
commit 994b69ef8f
242 changed files with 1212 additions and 1224 deletions

View File

@@ -5,7 +5,7 @@ import sys
import types
from _typeshed import Self, WriteableBuffer
from socket import socket
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, Tuple, Type, TypeVar, Union, overload
from typing import IO, Any, BinaryIO, Callable, Iterable, Iterator, Mapping, Protocol, Type, TypeVar, Union, overload
_DataType = Union[bytes, IO[Any], Iterable[bytes], str]
_T = TypeVar("_T")
@@ -96,7 +96,7 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO):
def getheader(self, name: str) -> str | None: ...
@overload
def getheader(self, name: str, default: _T) -> str | _T: ...
def getheaders(self) -> list[Tuple[str, str]]: ...
def getheaders(self) -> list[tuple[str, str]]: ...
def fileno(self) -> int: ...
def isclosed(self) -> bool: ...
def __iter__(self) -> Iterator[bytes]: ...
@@ -118,12 +118,12 @@ class _HTTPConnectionProtocol(Protocol):
host: str,
port: int | None = ...,
timeout: float = ...,
source_address: Tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = ...,
blocksize: int = ...,
) -> HTTPConnection: ...
else:
def __call__(
self, host: str, port: int | None = ..., timeout: float = ..., source_address: Tuple[str, int] | None = ...
self, host: str, port: int | None = ..., timeout: float = ..., source_address: tuple[str, int] | None = ...
) -> HTTPConnection: ...
class HTTPConnection:
@@ -141,12 +141,12 @@ class HTTPConnection:
host: str,
port: int | None = ...,
timeout: float | None = ...,
source_address: Tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = ...,
blocksize: int = ...,
) -> None: ...
else:
def __init__(
self, host: str, port: int | None = ..., timeout: float | None = ..., source_address: Tuple[str, int] | None = ...
self, host: str, port: int | None = ..., timeout: float | None = ..., source_address: tuple[str, int] | None = ...
) -> None: ...
def request(
self, method: str, url: str, body: _DataType | None = ..., headers: Mapping[str, str] = ..., *, encode_chunked: bool = ...
@@ -170,7 +170,7 @@ class HTTPSConnection(HTTPConnection):
key_file: str | None = ...,
cert_file: str | None = ...,
timeout: float | None = ...,
source_address: Tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = ...,
*,
context: ssl.SSLContext | None = ...,
check_hostname: bool | None = ...,
@@ -184,7 +184,7 @@ class HTTPSConnection(HTTPConnection):
key_file: str | None = ...,
cert_file: str | None = ...,
timeout: float | None = ...,
source_address: Tuple[str, int] | None = ...,
source_address: tuple[str, int] | None = ...,
*,
context: ssl.SSLContext | None = ...,
check_hostname: bool | None = ...,

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Dict, Generic, Iterable, Mapping, Tuple, TypeVar, Union, overload
from typing import Any, Dict, Generic, Iterable, Mapping, TypeVar, Union, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -32,7 +32,7 @@ class Morsel(Dict[str, Any], Generic[_T]):
@overload # type: ignore
def update(self, values: Mapping[str, str]) -> None: ...
@overload
def update(self, values: Iterable[Tuple[str, str]]) -> None: ...
def update(self, values: Iterable[tuple[str, str]]) -> None: ...
def isReservedKey(self, K: str) -> bool: ...
def output(self, attrs: list[str] | None = ..., header: str = ...) -> str: ...
def js_output(self, attrs: list[str] | None = ...) -> str: ...

View File

@@ -3,7 +3,7 @@ import io
import socketserver
import sys
from _typeshed import StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, BinaryIO, ClassVar, Mapping, Sequence, Tuple
from typing import Any, AnyStr, BinaryIO, ClassVar, Mapping, Sequence
class HTTPServer(socketserver.TCPServer):
server_name: str
@@ -14,7 +14,7 @@ if sys.version_info >= (3, 7):
daemon_threads: bool # undocumented
class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
client_address: Tuple[str, int]
client_address: tuple[str, int]
server: socketserver.BaseServer
close_connection: bool
requestline: str
@@ -28,11 +28,11 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
error_content_type: str
protocol_version: str
MessageClass: type
responses: Mapping[int, Tuple[str, str]]
responses: Mapping[int, tuple[str, str]]
default_request_version: str # undocumented
weekdayname: ClassVar[Sequence[str]] # undocumented
monthname: ClassVar[Sequence[str | None]] # undocumented
def __init__(self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer) -> None: ...
def __init__(self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer) -> None: ...
def handle(self) -> None: ...
def handle_one_request(self) -> None: ...
def handle_expect_100(self) -> bool: ...
@@ -56,10 +56,10 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
extensions_map: dict[str, str]
if sys.version_info >= (3, 7):
def __init__(
self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer, directory: str | None = ...
self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer, directory: str | None = ...
) -> None: ...
else:
def __init__(self, request: bytes, client_address: Tuple[str, int], server: socketserver.BaseServer) -> None: ...
def __init__(self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer) -> None: ...
def do_GET(self) -> None: ...
def do_HEAD(self) -> None: ...
def send_head(self) -> io.BytesIO | BinaryIO | None: ... # undocumented