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

10
.flake8
View File

@@ -28,18 +28,22 @@
# F403 import *' used; unable to detect undefined names
# F405 defined from star imports
# Ignored to workaround pyflakes issues with stub files
# (the bugs this rule catches are caught by our other tests anyway):
# F821 undefined name
[flake8]
extend-ignore = A, D, N8, SIM, RST, TYP, E301, E302, E305, E501
per-file-ignores =
*.py: E203
*.pyi: B, E701, E741, F401, F403, F405, F822
*.pyi: B, E701, E741, F401, F403, F405, F821, F822
# Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload.
# Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself.
# https://github.com/PyCQA/flake8/issues/1079
# F811 redefinition of unused '...'
stdlib/typing.pyi: B, E701, E741, F401, F403, F405, F811, F822
stdlib/typing.pyi: B, E701, E741, F401, F403, F405, F811, F821, F822
# Generated protobuf files include docstrings
*_pb2.pyi: B, E701, E741, F401, F403, F405, F822, Y021, Y026, Y053, Y054
*_pb2.pyi: B, E701, E741, F401, F403, F405, F821, F822, Y021, Y026, Y053, Y054
exclude = .venv*,.git
noqa_require_code = true

View File

@@ -153,9 +153,9 @@ def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> A
class BrokenProcessPool(BrokenExecutor): ...
class ProcessPoolExecutor(Executor):
_mp_context: BaseContext | None = ...
_initializer: Callable[..., None] | None = ...
_initargs: tuple[Any, ...] = ...
_mp_context: BaseContext | None
_initializer: Callable[..., None] | None
_initargs: tuple[Any, ...]
_executor_manager_thread: _ThreadWakeup
_processes: MutableMapping[int, Process]
_shutdown_thread: bool

View File

@@ -44,9 +44,9 @@ class ThreadPoolExecutor(Executor):
_broken: bool
_shutdown: bool
_shutdown_lock: Lock
_thread_name_prefix: str | None = ...
_initializer: Callable[..., None] | None = ...
_initargs: tuple[Any, ...] = ...
_thread_name_prefix: str | None
_initializer: Callable[..., None] | None
_initargs: tuple[Any, ...]
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
def __init__(
self,

View File

@@ -39,10 +39,10 @@ _HaveCodeType: TypeAlias = types.MethodType | types.FunctionType | types.CodeTyp
if sys.version_info >= (3, 11):
class Positions(NamedTuple):
lineno: int | None = ...
end_lineno: int | None = ...
col_offset: int | None = ...
end_col_offset: int | None = ...
lineno: int | None = None
end_lineno: int | None = None
col_offset: int | None = None
end_col_offset: int | None = None
if sys.version_info >= (3, 11):
class Instruction(NamedTuple):
@@ -54,7 +54,7 @@ if sys.version_info >= (3, 11):
offset: int
starts_line: int | None
is_jump_target: bool
positions: Positions | None = ...
positions: Positions | None = None
else:
class Instruction(NamedTuple):

View File

@@ -24,7 +24,7 @@ def main(
def read_signed(fd: int) -> Any: ...
def write_signed(fd: int, n: int) -> None: ...
_forkserver: ForkServer = ...
_forkserver: ForkServer
ensure_running = _forkserver.ensure_running
get_inherited_fds = _forkserver.get_inherited_fds
connect_to_new_process = _forkserver.connect_to_new_process

View File

@@ -9,7 +9,7 @@ class ResourceTracker:
def register(self, name: Sized, rtype: Incomplete) -> None: ...
def unregister(self, name: Sized, rtype: Incomplete) -> None: ...
_resource_tracker: ResourceTracker = ...
_resource_tracker: ResourceTracker
ensure_running = _resource_tracker.ensure_running
register = _resource_tracker.register
unregister = _resource_tracker.unregister

View File

@@ -70,7 +70,7 @@ class HTMLRepr(Repr):
def repr_unicode(self, x: AnyStr, level: complex) -> str: ...
class HTMLDoc(Doc):
_repr_instance: HTMLRepr = ...
_repr_instance: HTMLRepr
repr = _repr_instance.repr
escape = _repr_instance.escape
def page(self, title: str, contents: str) -> str: ...
@@ -154,7 +154,7 @@ class TextRepr(Repr):
def repr_instance(self, x: object, level: complex) -> str: ...
class TextDoc(Doc):
_repr_instance: TextRepr = ...
_repr_instance: TextRepr
repr = _repr_instance.repr
def bold(self, text: str) -> str: ...
def indent(self, text: str, prefix: str = " ") -> str: ...

View File

@@ -100,9 +100,7 @@ class SystemRandom(Random):
def getstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
def setstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
# ----- random function stubs -----
_inst: Random = ...
_inst: Random
seed = _inst.seed
random = _inst.random
uniform = _inst.uniform

View File

@@ -167,20 +167,14 @@ _T = TypeVar("_T")
def overload(func: _F) -> _F: ...
# Unlike the vast majority module-level objects in stub files,
# these `_SpecialForm` objects in typing need the default value `= ...`,
# due to the fact that they are used elswhere in the same file.
# Otherwise, flake8 erroneously flags them as undefined.
# `_SpecialForm` objects in typing.py that are not used elswhere in the same file
# do not need the default value assignment.
Union: _SpecialForm = ...
Generic: _SpecialForm = ...
Union: _SpecialForm
Generic: _SpecialForm
# Protocol is only present in 3.8 and later, but mypy needs it unconditionally
Protocol: _SpecialForm = ...
Callable: _SpecialForm = ...
Type: _SpecialForm = ...
NoReturn: _SpecialForm = ...
ClassVar: _SpecialForm = ...
Protocol: _SpecialForm
Callable: _SpecialForm
Type: _SpecialForm
NoReturn: _SpecialForm
ClassVar: _SpecialForm
Optional: _SpecialForm
Tuple: _SpecialForm
@@ -193,7 +187,7 @@ if sys.version_info >= (3, 8):
if sys.version_info >= (3, 11):
Self: _SpecialForm
Never: _SpecialForm = ...
Never: _SpecialForm
Unpack: _SpecialForm
Required: _SpecialForm
NotRequired: _SpecialForm

View File

@@ -113,7 +113,7 @@ class _SpecialForm:
# typing.Protocol and typing_extensions.Protocol so they can properly
# warn users about potential runtime exceptions when using typing.Protocol
# on older versions of Python.
Protocol: _SpecialForm = ...
Protocol: _SpecialForm
def runtime_checkable(cls: _TC) -> _TC: ...

View File

@@ -1,4 +1,4 @@
__author__: str = ...
__author__: str
__copyright__: str
__license__: str
__version__: str

View File

@@ -20,48 +20,48 @@ class AnsiCursor:
# All attributes in the following classes are string in instances and int in the class.
# We use str since that is the common case for users.
class AnsiFore(AnsiCodes):
BLACK: str = ...
RED: str = ...
GREEN: str = ...
YELLOW: str = ...
BLUE: str = ...
MAGENTA: str = ...
CYAN: str = ...
WHITE: str = ...
RESET: str = ...
LIGHTBLACK_EX: str = ...
LIGHTRED_EX: str = ...
LIGHTGREEN_EX: str = ...
LIGHTYELLOW_EX: str = ...
LIGHTBLUE_EX: str = ...
LIGHTMAGENTA_EX: str = ...
LIGHTCYAN_EX: str = ...
LIGHTWHITE_EX: str = ...
BLACK: str
RED: str
GREEN: str
YELLOW: str
BLUE: str
MAGENTA: str
CYAN: str
WHITE: str
RESET: str
LIGHTBLACK_EX: str
LIGHTRED_EX: str
LIGHTGREEN_EX: str
LIGHTYELLOW_EX: str
LIGHTBLUE_EX: str
LIGHTMAGENTA_EX: str
LIGHTCYAN_EX: str
LIGHTWHITE_EX: str
class AnsiBack(AnsiCodes):
BLACK: str = ...
RED: str = ...
GREEN: str = ...
YELLOW: str = ...
BLUE: str = ...
MAGENTA: str = ...
CYAN: str = ...
WHITE: str = ...
RESET: str = ...
LIGHTBLACK_EX: str = ...
LIGHTRED_EX: str = ...
LIGHTGREEN_EX: str = ...
LIGHTYELLOW_EX: str = ...
LIGHTBLUE_EX: str = ...
LIGHTMAGENTA_EX: str = ...
LIGHTCYAN_EX: str = ...
LIGHTWHITE_EX: str = ...
BLACK: str
RED: str
GREEN: str
YELLOW: str
BLUE: str
MAGENTA: str
CYAN: str
WHITE: str
RESET: str
LIGHTBLACK_EX: str
LIGHTRED_EX: str
LIGHTGREEN_EX: str
LIGHTYELLOW_EX: str
LIGHTBLUE_EX: str
LIGHTMAGENTA_EX: str
LIGHTCYAN_EX: str
LIGHTWHITE_EX: str
class AnsiStyle(AnsiCodes):
BRIGHT: str = ...
DIM: str = ...
NORMAL: str = ...
RESET_ALL: str = ...
BRIGHT: str
DIM: str
NORMAL: str
RESET_ALL: str
Fore: AnsiFore
Back: AnsiBack

View File

@@ -3,7 +3,7 @@ from _typeshed import SupportsWrite
from collections.abc import Callable, Sequence
from re import Pattern
from types import TracebackType
from typing import Any, TextIO
from typing import Any, ClassVar, TextIO
from typing_extensions import TypeAlias
if sys.platform == "win32":
@@ -29,15 +29,15 @@ _WinTermCall: TypeAlias = Callable[[int | None, bool, bool], None]
_WinTermCallDict: TypeAlias = dict[int, tuple[_WinTermCall] | tuple[_WinTermCall, int] | tuple[_WinTermCall, int, bool]]
class AnsiToWin32:
ANSI_CSI_RE: Pattern[str] = ...
ANSI_OSC_RE: Pattern[str] = ...
wrapped: TextIO = ...
autoreset: bool = ...
stream: StreamWrapper = ...
strip: bool = ...
convert: bool = ...
win32_calls: _WinTermCallDict = ...
on_stderr: bool = ...
ANSI_CSI_RE: ClassVar[Pattern[str]]
ANSI_OSC_RE: ClassVar[Pattern[str]]
wrapped: TextIO
autoreset: bool
stream: StreamWrapper
strip: bool
convert: bool
win32_calls: _WinTermCallDict
on_stderr: bool
def __init__(
self, wrapped: TextIO, convert: bool | None = None, strip: bool | None = None, autoreset: bool = False
) -> None: ...

View File

@@ -16,7 +16,7 @@ class KexGex:
min_bits: int
max_bits: int
preferred_bits: int
hash_algo: Callable[[ReadableBuffer], _Hash] = ...
hash_algo: Callable[[ReadableBuffer], _Hash]
transport: Transport
p: int | None
q: int | None
@@ -31,4 +31,4 @@ class KexGex:
class KexGexSHA256(KexGex):
name: str
hash_algo: Callable[[ReadableBuffer], _Hash] = ...
hash_algo: Callable[[ReadableBuffer], _Hash]

View File

@@ -25,10 +25,10 @@ from pysftp.helpers import (
)
class CnOpts:
log: bool = ...
compression: bool = ...
ciphers: Sequence[str] | None = ...
hostkeys: paramiko.HostKeys | None = ...
log: bool
compression: bool
ciphers: Sequence[str] | None
hostkeys: paramiko.HostKeys | None
def __init__(self, knownhosts: str | None = None) -> None: ...
def get_hostkey(self, host: str) -> paramiko.PKey: ...

View File

@@ -1,9 +1,9 @@
class ConnectionException(Exception):
message: str = ...
message: str
def __init__(self, host: str, port: int) -> None: ...
class CredentialException(Exception):
message: str = ...
message: str
def __init__(self, message: str) -> None: ...
class HostKeysException(Exception): ...

View File

@@ -1,9 +1,9 @@
class JSONDecodeError(ValueError):
msg: str = ...
doc: str = ...
pos: int = ...
end: int | None = ...
lineno: int = ...
colno: int = ...
endlineno: int | None = ...
endcolno: int | None = ...
msg: str
doc: str
pos: int
end: int | None
lineno: int
colno: int
endlineno: int | None
endcolno: int | None

View File

@@ -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

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]: ...

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: ...

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: ...

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: ...

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(

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: ...

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: ...

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: ...

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: ...

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

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: ...