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

@@ -1,5 +1,5 @@
from socket import socket
from typing import Any, FrozenSet, Iterable, Sequence, Set, Tuple
from typing import Any, FrozenSet, Iterable, Sequence, Set
from .compat import HAS_IPV6 as HAS_IPV6, PY2 as PY2, WIN as WIN, string_types as string_types
from .proxy_headers import PROXY_HEADERS as PROXY_HEADERS
@@ -48,7 +48,7 @@ class Adjustments:
expose_tracebacks: bool = ...
unix_socket: str | None = ...
unix_socket_perms: int = ...
socket_options: list[Tuple[int, int, int]] = ...
socket_options: list[tuple[int, int, int]] = ...
asyncore_loop_timeout: int = ...
asyncore_use_poll: bool = ...
ipv4: bool = ...
@@ -56,6 +56,6 @@ class Adjustments:
sockets: list[socket] = ...
def __init__(self, **kw: Any) -> None: ...
@classmethod
def parse_args(cls, argv: str) -> Tuple[dict[str, Any], Any]: ...
def parse_args(cls, argv: str) -> tuple[dict[str, Any], Any]: ...
@classmethod
def check_sockets(cls, sockets: Iterable[socket]) -> None: ...

View File

@@ -1,6 +1,6 @@
from socket import socket
from threading import Condition, Lock
from typing import Mapping, Sequence, Tuple
from typing import Mapping, Sequence
from waitress.adjustments import Adjustments
from waitress.buffers import OverflowableBuffer
@@ -31,7 +31,7 @@ class HTTPChannel(wasyncore.dispatcher):
sendbuf_len: int = ...
task_lock: Lock = ...
outbuf_lock: Condition = ...
addr: Tuple[str, int] = ...
addr: tuple[str, int] = ...
def __init__(
self, server: BaseWSGIServer, sock: socket, addr: str, adj: Adjustments, map: Mapping[int, socket] | None = ...
) -> None: ...

View File

@@ -1,12 +1,12 @@
from io import TextIOWrapper
from typing import Any, Tuple
from typing import Any
PY2: bool
PY3: bool
WIN: bool
string_types: Tuple[str]
integer_types: Tuple[int]
class_types: Tuple[type]
string_types: tuple[str]
integer_types: tuple[int]
class_types: tuple[type]
text_type = str
binary_type = bytes
long = int

View File

@@ -1,5 +1,5 @@
from io import BytesIO
from typing import Any, Mapping, Pattern, Sequence, Tuple
from typing import Any, Mapping, Pattern, Sequence
from waitress.adjustments import Adjustments
from waitress.receiver import ChunkedReceiver, FixedStreamReceiver
@@ -35,9 +35,9 @@ class HTTPRequestParser:
def get_body_stream(self) -> BytesIO: ...
def close(self) -> None: ...
def split_uri(uri: bytes) -> Tuple[str, str, bytes, str, str]: ...
def split_uri(uri: bytes) -> tuple[str, str, bytes, str, str]: ...
def get_header_lines(header: bytes) -> Sequence[bytes]: ...
first_line_re: Pattern[Any]
def crack_first_line(line: str) -> Tuple[bytes, bytes, bytes]: ...
def crack_first_line(line: str) -> tuple[bytes, bytes, bytes]: ...

View File

@@ -1,10 +1,10 @@
from io import TextIOWrapper
from typing import Any, Callable, Pattern, Sequence, Tuple
from typing import Any, Callable, Pattern, Sequence
HELP: str
RUNNER_PATTERN: Pattern[Any]
def match(obj_name: str) -> Tuple[str, str]: ...
def match(obj_name: str) -> tuple[str, str]: ...
def resolve(module_name: str, object_name: str) -> Any: ...
def show_help(stream: TextIOWrapper, name: str, error: str | None = ...) -> None: ...
def show_exception(stream: TextIOWrapper) -> None: ...

View File

@@ -1,5 +1,5 @@
from socket import socket
from typing import Any, Sequence, Tuple
from typing import Any, Sequence
from waitress.adjustments import Adjustments
from waitress.channel import HTTPChannel
@@ -20,13 +20,13 @@ class MultiSocketServer:
asyncore: Any = ...
adj: Adjustments = ...
map: Any = ...
effective_listen: Sequence[Tuple[str, int]] = ...
effective_listen: Sequence[tuple[str, int]] = ...
task_dispatcher: ThreadedTaskDispatcher = ...
def __init__(
self,
map: Any | None = ...,
adj: Adjustments | None = ...,
effective_listen: Sequence[Tuple[str, int]] | None = ...,
effective_listen: Sequence[tuple[str, int]] | None = ...,
dispatcher: ThreadedTaskDispatcher | None = ...,
) -> None: ...
def print_listen(self, format_str: str) -> None: ...
@@ -38,7 +38,7 @@ class BaseWSGIServer(wasyncore.dispatcher):
next_channel_cleanup: int = ...
socketmod: socket = ...
asyncore: Any = ...
sockinfo: Tuple[int, int, int, Tuple[str, int]] = ...
sockinfo: tuple[int, int, int, tuple[str, int]] = ...
family: int = ...
socktype: int = ...
application: Any = ...
@@ -80,7 +80,7 @@ class BaseWSGIServer(wasyncore.dispatcher):
class TcpWSGIServer(BaseWSGIServer):
def bind_server_socket(self) -> None: ...
def getsockname(self) -> Tuple[str, Tuple[str, int]]: ...
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
def set_socket_options(self, conn: socket) -> None: ...
class UnixWSGIServer(BaseWSGIServer):
@@ -96,8 +96,8 @@ class UnixWSGIServer(BaseWSGIServer):
**kw: Any,
) -> None: ...
def bind_server_socket(self) -> None: ...
def getsockname(self) -> Tuple[str, Tuple[str, int]]: ...
def fix_addr(self, addr: Any) -> Tuple[str, None]: ...
def getsockname(self) -> tuple[str, tuple[str, int]]: ...
def fix_addr(self, addr: Any) -> tuple[str, None]: ...
def get_server_name(self, ip: Any) -> str: ...
WSGIServer: TcpWSGIServer

View File

@@ -1,6 +1,6 @@
from logging import Logger
from threading import Condition, Lock
from typing import Any, Deque, Mapping, Sequence, Tuple
from typing import Any, Deque, Mapping, Sequence
from .channel import HTTPChannel
from .utilities import Error
@@ -39,7 +39,7 @@ class Task:
logger: Logger = ...
channel: HTTPChannel = ...
request: Error = ...
response_headers: Sequence[Tuple[str, str]] = ...
response_headers: Sequence[tuple[str, str]] = ...
version: str = ...
def __init__(self, channel: HTTPChannel, request: Error) -> None: ...
def service(self) -> None: ...
@@ -60,7 +60,7 @@ class ErrorTask(Task):
class WSGITask(Task):
environ: Any | None = ...
response_headers: Sequence[Tuple[str, str]] = ...
response_headers: Sequence[tuple[str, str]] = ...
complete: bool = ...
status: str = ...
content_length: int = ...

View File

@@ -1,5 +1,5 @@
from logging import Logger
from typing import Any, Callable, Mapping, Match, Pattern, Sequence, Tuple
from typing import Any, Callable, Mapping, Match, Pattern, Sequence
from .rfc7230 import OBS_TEXT as OBS_TEXT, VCHAR as VCHAR
@@ -23,12 +23,12 @@ months_reg: str
rfc822_date: str
rfc822_reg: Pattern[Any]
def unpack_rfc822(m: Match[Any]) -> Tuple[int, int, int, int, int, int, int, int, int]: ...
def unpack_rfc822(m: Match[Any]) -> tuple[int, int, int, int, int, int, int, int, int]: ...
rfc850_date: str
rfc850_reg: Pattern[Any]
def unpack_rfc850(m: Match[Any]) -> Tuple[int, int, int, int, int, int, int, int, int]: ...
def unpack_rfc850(m: Match[Any]) -> tuple[int, int, int, int, int, int, int, int, int]: ...
weekdayname: Sequence[str]
monthname: Sequence[str]
@@ -52,8 +52,8 @@ class Error:
reason: str = ...
body: str = ...
def __init__(self, body: str) -> None: ...
def to_response(self) -> Tuple[str, Sequence[Tuple[str, str]], str]: ...
def wsgi_response(self, environ: Any, start_response: Callable[[str, Sequence[Tuple[str, str]]], None]) -> str: ...
def to_response(self) -> tuple[str, Sequence[tuple[str, str]], str]: ...
def wsgi_response(self, environ: Any, start_response: Callable[[str, Sequence[tuple[str, str]]], None]) -> str: ...
class BadRequest(Error):
code: int = ...

View File

@@ -1,7 +1,7 @@
from io import BytesIO
from logging import Logger
from socket import socket
from typing import Any, Callable, Mapping, Tuple
from typing import Any, Callable, Mapping
from . import compat as compat, utilities as utilities
@@ -21,7 +21,7 @@ def poll2(timeout: float = ..., map: Mapping[int, socket] | None = ...) -> None:
poll3 = poll2
def loop(timeout: float = ..., use_poll: bool = ..., map: Mapping[int, socket] | None = ..., count: int | None = ...) -> None: ...
def compact_traceback() -> Tuple[Tuple[str, str, str], BaseException, BaseException, str]: ...
def compact_traceback() -> tuple[tuple[str, str, str], BaseException, BaseException, str]: ...
class dispatcher:
debug: bool = ...
@@ -29,24 +29,24 @@ class dispatcher:
accepting: bool = ...
connecting: bool = ...
closing: bool = ...
addr: Tuple[str, int] | None = ...
addr: tuple[str, int] | None = ...
ignore_log_types: frozenset[Any]
logger: Logger = ...
compact_traceback: Callable[[], Tuple[Tuple[str, str, str], BaseException, BaseException, str]] = ...
compact_traceback: Callable[[], tuple[tuple[str, str, str], BaseException, BaseException, str]] = ...
socket: _socket | None = ...
def __init__(self, sock: _socket | None = ..., map: Mapping[int, _socket] | None = ...) -> None: ...
def add_channel(self, map: Mapping[int, _socket] | None = ...) -> None: ...
def del_channel(self, map: Mapping[int, _socket] | None = ...) -> None: ...
family_and_type: Tuple[int, int] = ...
family_and_type: tuple[int, int] = ...
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
def set_socket(self, sock: _socket, map: Mapping[int, _socket] | None = ...) -> None: ...
def set_reuse_addr(self) -> None: ...
def readable(self) -> bool: ...
def writable(self) -> bool: ...
def listen(self, num: int) -> None: ...
def bind(self, addr: Tuple[str, int]) -> None: ...
def connect(self, address: Tuple[str, int]) -> None: ...
def accept(self) -> Tuple[_socket, Tuple[str, int]] | None: ...
def bind(self, addr: tuple[str, int]) -> None: ...
def connect(self, address: tuple[str, int]) -> None: ...
def accept(self) -> tuple[_socket, tuple[str, int]] | None: ...
def send(self, data: bytes) -> int: ...
def recv(self, buffer_size: int) -> bytes: ...
def close(self) -> None: ...