Remove unnecessary ellipsis expressions (#9976)

Ignore flake8 F821 warnings in stub files
This commit is contained in:
Sebastian Rittau
2023-03-29 13:28:06 +02:00
committed by GitHub
parent 8df767f163
commit 027460f11a
29 changed files with 287 additions and 294 deletions
@@ -1,9 +1,6 @@
waitress.adjustments.Adjustments.clear_untrusted_proxy_headers
waitress.adjustments.PY2
waitress.adjustments.string_types
waitress.buffers.FileBasedBuffer.__bool__
waitress.buffers.OverflowableBuffer.__bool__
waitress.buffers.ReadOnlyFileBasedBuffer.__next__
waitress.channel.HTTPChannel.addr
waitress.channel.HTTPChannel.error_task_class
waitress.channel.HTTPChannel.parser_class
+33 -33
View File
@@ -22,39 +22,39 @@ class _int_marker(int): ...
class _bool_marker: ...
class Adjustments:
host: _str_marker = ...
port: _int_marker = ...
listen: list[str] = ...
threads: int = ...
trusted_proxy: str | None = ...
trusted_proxy_count: int | None = ...
trusted_proxy_headers: set[str] = ...
log_untrusted_proxy_headers: bool = ...
clear_untrusted_proxy_headers: _bool_marker | bool = ...
url_scheme: str = ...
url_prefix: str = ...
ident: str = ...
backlog: int = ...
recv_bytes: int = ...
send_bytes: int = ...
outbuf_overflow: int = ...
outbuf_high_watermark: int = ...
inbuf_overflow: int = ...
connection_limit: int = ...
cleanup_interval: int = ...
channel_timeout: int = ...
log_socket_errors: bool = ...
max_request_header_size: int = ...
max_request_body_size: int = ...
expose_tracebacks: bool = ...
unix_socket: str | None = ...
unix_socket_perms: int = ...
socket_options: list[tuple[int, int, int]] = ...
asyncore_loop_timeout: int = ...
asyncore_use_poll: bool = ...
ipv4: bool = ...
ipv6: bool = ...
sockets: list[socket] = ...
host: _str_marker
port: _int_marker
listen: list[str]
threads: int
trusted_proxy: str | None
trusted_proxy_count: int | None
trusted_proxy_headers: set[str]
log_untrusted_proxy_headers: bool
clear_untrusted_proxy_headers: _bool_marker | bool
url_scheme: str
url_prefix: str
ident: str
backlog: int
recv_bytes: int
send_bytes: int
outbuf_overflow: int
outbuf_high_watermark: int
inbuf_overflow: int
connection_limit: int
cleanup_interval: int
channel_timeout: int
log_socket_errors: bool
max_request_header_size: int
max_request_body_size: int
expose_tracebacks: bool
unix_socket: str | None
unix_socket_perms: int
socket_options: list[tuple[int, int, int]]
asyncore_loop_timeout: int
asyncore_use_poll: bool
ipv4: bool
ipv6: bool
sockets: list[socket]
def __init__(self, **kw: Any) -> None: ...
@classmethod
def parse_args(cls, argv: str) -> tuple[dict[str, Any], Any]: ...
+14 -14
View File
@@ -1,17 +1,17 @@
from collections.abc import Callable
from io import BufferedIOBase, BufferedRandom, BytesIO
from typing import Any
from typing_extensions import Literal
COPY_BYTES: int
STRBUF_LIMIT: int
class FileBasedBuffer:
remain: int = ...
file: BytesIO = ...
remain: int
file: BytesIO
def __init__(self, file: BytesIO, from_buffer: BytesIO | None = None) -> None: ...
def __len__(self) -> int: ...
def __nonzero__(self) -> bool: ...
__bool__: Callable[[], bool] = ...
def __bool__(self) -> Literal[True]: ...
def append(self, s: Any) -> None: ...
def get(self, numbytes: int = -1, skip: bool = False) -> bytes: ...
def skip(self, numbytes: int, allow_prune: int = 0) -> None: ...
@@ -25,31 +25,31 @@ class TempfileBasedBuffer(FileBasedBuffer):
def newfile(self) -> BufferedRandom: ...
class BytesIOBasedBuffer(FileBasedBuffer):
file: BytesIO = ...
file: BytesIO
def __init__(self, from_buffer: BytesIO | None = None) -> None: ...
def newfile(self) -> BytesIO: ...
class ReadOnlyFileBasedBuffer(FileBasedBuffer):
file: BytesIO = ...
block_size: int = ...
file: BytesIO
block_size: int
def __init__(self, file: BytesIO, block_size: int = 32768) -> None: ...
remain: int = ...
remain: int
def prepare(self, size: int | None = None) -> int: ...
def get(self, numbytes: int = -1, skip: bool = False) -> bytes: ...
def __iter__(self) -> ReadOnlyFileBasedBuffer: ...
def next(self) -> bytes | None: ...
__next__: Callable[[], bytes | None] = ...
__next__ = next
def append(self, s: Any) -> None: ...
class OverflowableBuffer:
overflowed: bool = ...
buf: BufferedIOBase | None = ...
strbuf: bytes = ...
overflow: int = ...
overflowed: bool
buf: BufferedIOBase | None
strbuf: bytes
overflow: int
def __init__(self, overflow: int) -> None: ...
def __len__(self) -> int: ...
def __nonzero__(self) -> bool: ...
__bool__: Callable[[], bool] = ...
def __bool__(self) -> bool: ...
def append(self, s: bytes) -> None: ...
def get(self, numbytes: int = -1, skip: bool = False) -> bytes: ...
def skip(self, numbytes: int, allow_prune: bool = False) -> None: ...
+20 -20
View File
@@ -13,25 +13,25 @@ from . import wasyncore as wasyncore
class ClientDisconnected(Exception): ...
class HTTPChannel(wasyncore.dispatcher):
task_class: WSGITask = ...
error_task_class: ErrorTask = ...
parser_class: HTTPRequestParser = ...
request: HTTPRequestParser = ...
last_activity: float = ...
will_close: bool = ...
close_when_flushed: bool = ...
requests: Sequence[HTTPRequestParser] = ...
sent_continue: bool = ...
total_outbufs_len: int = ...
current_outbuf_count: int = ...
server: BaseWSGIServer = ...
adj: Adjustments = ...
outbufs: Sequence[OverflowableBuffer] = ...
creation_time: float = ...
sendbuf_len: int = ...
task_lock: Lock = ...
outbuf_lock: Condition = ...
addr: tuple[str, int] = ...
task_class: WSGITask
error_task_class: ErrorTask
parser_class: HTTPRequestParser
request: HTTPRequestParser
last_activity: float
will_close: bool
close_when_flushed: bool
requests: Sequence[HTTPRequestParser]
sent_continue: bool
total_outbufs_len: int
current_outbuf_count: int
server: BaseWSGIServer
adj: Adjustments
outbufs: Sequence[OverflowableBuffer]
creation_time: float
sendbuf_len: int
task_lock: Lock
outbuf_lock: Condition
addr: tuple[str, int]
def __init__(
self, server: BaseWSGIServer, sock: socket, addr: str, adj: Adjustments, map: Mapping[int, socket] | None = None
) -> None: ...
@@ -40,7 +40,7 @@ class HTTPChannel(wasyncore.dispatcher):
def readable(self) -> bool: ...
def handle_read(self) -> None: ...
def received(self, data: bytes) -> bool: ...
connected: bool = ...
connected: bool
def handle_close(self) -> None: ...
def add_channel(self, map: Mapping[int, socket] | None = None) -> None: ...
def del_channel(self, map: Mapping[int, socket] | None = None) -> None: ...
+18 -18
View File
@@ -11,26 +11,26 @@ class ParsingError(Exception): ...
class TransferEncodingNotImplemented(Exception): ...
class HTTPRequestParser:
completed: bool = ...
empty: bool = ...
expect_continue: bool = ...
headers_finished: bool = ...
header_plus: bytes = ...
chunked: bool = ...
content_length: int = ...
header_bytes_received: int = ...
body_bytes_received: int = ...
body_rcv: ChunkedReceiver | FixedStreamReceiver | None = ...
version: str = ...
error: Error | None = ...
connection_close: bool = ...
headers: Mapping[str, str] = ...
adj: Adjustments = ...
completed: bool
empty: bool
expect_continue: bool
headers_finished: bool
header_plus: bytes
chunked: bool
content_length: int
header_bytes_received: int
body_bytes_received: int
body_rcv: ChunkedReceiver | FixedStreamReceiver | None
version: str
error: Error | None
connection_close: bool
headers: Mapping[str, str]
adj: Adjustments
def __init__(self, adj: Adjustments) -> None: ...
def received(self, data: bytes) -> int: ...
first_line: str = ...
command: bytes = ...
url_scheme: str = ...
first_line: str
command: bytes
url_scheme: str
def parse_header(self, header_plus: bytes) -> None: ...
def get_body_stream(self) -> BytesIO: ...
def close(self) -> None: ...
+3 -3
View File
@@ -13,9 +13,9 @@ class Forwarded(NamedTuple):
proto: Any
class MalformedProxyHeader(Exception):
header: str = ...
reason: str = ...
value: str = ...
header: str
reason: str
value: str
def __init__(self, header: str, reason: str, value: str) -> None: ...
def proxy_headers_middleware(
+13 -13
View File
@@ -4,10 +4,10 @@ from waitress.buffers import OverflowableBuffer
from waitress.utilities import BadRequest
class FixedStreamReceiver:
completed: bool = ...
error: None = ...
remain: int = ...
buf: OverflowableBuffer = ...
completed: bool
error: None
remain: int
buf: OverflowableBuffer
def __init__(self, cl: int, buf: OverflowableBuffer) -> None: ...
def __len__(self) -> int: ...
def received(self, data: bytes) -> int: ...
@@ -15,15 +15,15 @@ class FixedStreamReceiver:
def getbuf(self) -> OverflowableBuffer: ...
class ChunkedReceiver:
chunk_remainder: int = ...
validate_chunk_end: bool = ...
control_line: bytes = ...
chunk_end: bytes = ...
all_chunks_received: bool = ...
trailer: bytes = ...
completed: bool = ...
error: BadRequest | None = ...
buf: OverflowableBuffer = ...
chunk_remainder: int
validate_chunk_end: bool
control_line: bytes
chunk_end: bytes
all_chunks_received: bool
trailer: bytes
completed: bool
error: BadRequest | None
buf: OverflowableBuffer
def __init__(self, buf: OverflowableBuffer) -> None: ...
def __len__(self) -> int: ...
def received(self, s: bytes) -> int: ...
+19 -19
View File
@@ -19,11 +19,11 @@ def create_server(
) -> MultiSocketServer | BaseWSGIServer: ...
class MultiSocketServer:
asyncore: Any = ...
adj: Adjustments = ...
map: Any = ...
effective_listen: Sequence[tuple[str, int]] = ...
task_dispatcher: ThreadedTaskDispatcher = ...
asyncore: Any
adj: Adjustments
map: Any
effective_listen: Sequence[tuple[str, int]]
task_dispatcher: ThreadedTaskDispatcher
def __init__(
self,
map: Incomplete | None = None,
@@ -36,19 +36,19 @@ class MultiSocketServer:
def close(self) -> None: ...
class BaseWSGIServer(wasyncore.dispatcher):
channel_class: HTTPChannel = ...
next_channel_cleanup: int = ...
socketmod: socket = ...
asyncore: Any = ...
sockinfo: tuple[int, int, int, tuple[str, int]] = ...
family: int = ...
socktype: int = ...
application: Any = ...
adj: Adjustments = ...
trigger: int = ...
task_dispatcher: ThreadedTaskDispatcher = ...
server_name: str = ...
active_channels: HTTPChannel = ...
channel_class: HTTPChannel
next_channel_cleanup: int
socketmod: socket
asyncore: Any
sockinfo: tuple[int, int, int, tuple[str, int]]
family: int
socktype: int
application: Any
adj: Adjustments
trigger: int
task_dispatcher: ThreadedTaskDispatcher
server_name: str
active_channels: HTTPChannel
def __init__(
self,
application: Any,
@@ -64,7 +64,7 @@ class BaseWSGIServer(wasyncore.dispatcher):
def bind_server_socket(self) -> None: ...
def get_server_name(self, ip: str) -> str: ...
def getsockname(self) -> Any: ...
accepting: bool = ...
accepting: bool
def accept_connections(self) -> None: ...
def add_task(self, task: Task) -> None: ...
def readable(self) -> bool: ...
+34 -34
View File
@@ -12,15 +12,15 @@ rename_headers: Mapping[str, str]
hop_by_hop: frozenset[Any]
class ThreadedTaskDispatcher:
stop_count: int = ...
active_count: int = ...
logger: Logger = ...
queue_logger: Logger = ...
threads: set[Any] = ...
queue: deque[Task] = ...
lock: Lock = ...
queue_cv: Condition = ...
thread_exit_cv: Condition = ...
stop_count: int
active_count: int
logger: Logger
queue_logger: Logger
threads: set[Any]
queue: deque[Task]
lock: Lock
queue_cv: Condition
thread_exit_cv: Condition
def start_new_thread(self, target: Any, args: Any) -> None: ...
def handler_thread(self, thread_no: int) -> None: ...
def set_thread_count(self, count: int) -> None: ...
@@ -28,21 +28,21 @@ class ThreadedTaskDispatcher:
def shutdown(self, cancel_pending: bool = True, timeout: int = 5) -> bool: ...
class Task:
close_on_finish: bool = ...
status: str = ...
wrote_header: bool = ...
start_time: int = ...
content_length: int | None = ...
content_bytes_written: int = ...
logged_write_excess: bool = ...
logged_write_no_body: bool = ...
complete: bool = ...
chunked_response: bool = ...
logger: Logger = ...
channel: HTTPChannel = ...
request: Error = ...
response_headers: Sequence[tuple[str, str]] = ...
version: str = ...
close_on_finish: bool
status: str
wrote_header: bool
start_time: int
content_length: int | None
content_bytes_written: int
logged_write_excess: bool
logged_write_no_body: bool
complete: bool
chunked_response: bool
logger: Logger
channel: HTTPChannel
request: Error
response_headers: Sequence[tuple[str, str]]
version: str
def __init__(self, channel: HTTPChannel, request: Error) -> None: ...
def service(self) -> None: ...
@property
@@ -54,18 +54,18 @@ class Task:
def write(self, data: bytes) -> None: ...
class ErrorTask(Task):
complete: bool = ...
status: str = ...
close_on_finish: bool = ...
content_length: int = ...
complete: bool
status: str
close_on_finish: bool
content_length: int
def execute(self) -> None: ...
class WSGITask(Task):
environ: Incomplete | None = ...
response_headers: Sequence[tuple[str, str]] = ...
complete: bool = ...
status: str = ...
content_length: int = ...
close_on_finish: bool = ...
environ: Incomplete | None
response_headers: Sequence[tuple[str, str]]
complete: bool
status: str
content_length: int
close_on_finish: bool
def execute(self) -> None: ...
def get_environment(self) -> Any: ...
+6 -6
View File
@@ -7,9 +7,9 @@ from typing_extensions import Literal
from waitress import wasyncore as wasyncore
class _triggerbase:
kind: str | None = ...
lock: Lock = ...
thunks: Callable[[None], None] = ...
kind: str | None
lock: Lock
thunks: Callable[[None], None]
def readable(self) -> Literal[True]: ...
def writable(self) -> Literal[False]: ...
def handle_connect(self) -> None: ...
@@ -20,11 +20,11 @@ class _triggerbase:
if sys.platform != "win32":
class trigger(_triggerbase, wasyncore.file_dispatcher):
kind: str = ...
kind: str
def __init__(self, map: Mapping[str, _triggerbase]) -> None: ...
else:
class trigger(_triggerbase, wasyncore.dispatcher):
kind: str = ...
trigger: socket = ...
kind: str
trigger: socket
def __init__(self, map: Mapping[str, _triggerbase]) -> None: ...
+13 -13
View File
@@ -40,29 +40,29 @@ def undquote(value: str) -> str: ...
def cleanup_unix_socket(path: str) -> None: ...
class Error:
code: int = ...
reason: str = ...
body: str = ...
code: int
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: StartResponse) -> Iterator[str]: ...
class BadRequest(Error):
code: int = ...
reason: str = ...
code: int
reason: str
class RequestHeaderFieldsTooLarge(BadRequest):
code: int = ...
reason: str = ...
code: int
reason: str
class RequestEntityTooLarge(BadRequest):
code: int = ...
reason: str = ...
code: int
reason: str
class InternalServerError(Error):
code: int = ...
reason: str = ...
code: int
reason: str
class ServerNotImplemented(Error):
code: int = ...
reason: str = ...
code: int
reason: str
+17 -17
View File
@@ -29,20 +29,20 @@ def loop(
def compact_traceback() -> tuple[tuple[str, str, str], BaseException, BaseException, str]: ...
class dispatcher:
debug: bool = ...
connected: bool = ...
accepting: bool = ...
connecting: bool = ...
closing: bool = ...
addr: tuple[str, int] | None = ...
debug: bool
connected: bool
accepting: bool
connecting: bool
closing: bool
addr: tuple[str, int] | None
ignore_log_types: frozenset[Any]
logger: Logger = ...
compact_traceback: Callable[[], tuple[tuple[str, str, str], BaseException, BaseException, str]] = ...
socket: _Socket | None = ...
logger: Logger
compact_traceback: Callable[[], tuple[tuple[str, str, str], BaseException, BaseException, str]]
socket: _Socket | None
def __init__(self, sock: _Socket | None = None, map: Mapping[int, _Socket] | None = None) -> None: ...
def add_channel(self, map: Mapping[int, _Socket] | None = None) -> None: ...
def del_channel(self, map: Mapping[int, _Socket] | None = 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) -> None: ...
def set_reuse_addr(self) -> None: ...
@@ -71,10 +71,10 @@ class dispatcher:
def handle_close(self) -> None: ...
class dispatcher_with_send(dispatcher):
out_buffer: bytes = ...
out_buffer: bytes
def __init__(self, sock: socket | None = None, map: Mapping[int, socket] | None = None) -> None: ...
def initiate_send(self) -> None: ...
handle_write: Callable[[], None] = ...
handle_write: Callable[[], None]
def writable(self) -> bool: ...
def send(self, data: bytes) -> None: ... # type: ignore[override]
@@ -82,19 +82,19 @@ def close_all(map: Mapping[int, socket] | None = None, ignore_all: bool = False)
if sys.platform != "win32":
class file_wrapper:
fd: BytesIO = ...
fd: BytesIO
def __init__(self, fd: BytesIO) -> None: ...
def __del__(self) -> None: ...
def recv(self, *args: Any) -> bytes: ...
def send(self, *args: Any) -> bytes: ...
def getsockopt(self, level: int, optname: int, buflen: bool | None = ...) -> int: ...
read: Callable[..., bytes] = ...
write: Callable[..., bytes] = ...
read: Callable[..., bytes]
write: Callable[..., bytes]
def close(self) -> None: ...
def fileno(self) -> BytesIO: ...
class file_dispatcher(dispatcher):
connected: bool = ...
connected: bool
def __init__(self, fd: BytesIO, map: Mapping[int, _Socket] | None = ...) -> None: ...
socket: _Socket = ...
socket: _Socket
def set_file(self, fd: BytesIO) -> None: ...