Third-party stubs: audit Callable[<parameters>, None] annotations (#8175)

This commit is contained in:
Alex Waygood
2022-06-26 12:56:19 +01:00
committed by GitHub
parent 49cdaa41db
commit 74bd0d962b
10 changed files with 13 additions and 12 deletions

View File

@@ -60,9 +60,9 @@ class Channel(ClosingContextManager):
auth_protocol: str | bytes | None = ...,
auth_cookie: str | bytes | None = ...,
single_connection: bool = ...,
handler: Callable[[Channel, tuple[str, int]], None] | None = ...,
handler: Callable[[Channel, tuple[str, int]], object] | None = ...,
) -> bytes: ...
def request_forward_agent(self, handler: Callable[[Channel], None]) -> bool: ...
def request_forward_agent(self, handler: Callable[[Channel], object]) -> bool: ...
def get_transport(self) -> Transport: ...
def set_name(self, name: str) -> None: ...
def get_name(self) -> str: ...

View File

@@ -44,7 +44,7 @@ class Packetizer:
def get_mac_size_in(self) -> int: ...
def get_mac_size_out(self) -> int: ...
def need_rekey(self) -> bool: ...
def set_keepalive(self, interval: int, callback: Callable[[], None]) -> None: ...
def set_keepalive(self, interval: int, callback: Callable[[], object]) -> None: ...
def read_timer(self) -> None: ...
def start_handshake(self, timeout: float) -> None: ...
def handshake_timed_out(self) -> bool: ...

View File

@@ -120,7 +120,7 @@ class Transport(Thread, ClosingContextManager):
timeout: float | None = ...,
) -> Channel: ...
def request_port_forward(
self, address: str, port: int, handler: Callable[[Channel, _Addr, _Addr], None] | None = ...
self, address: str, port: int, handler: Callable[[Channel, _Addr, _Addr], object] | None = ...
) -> int: ...
def cancel_port_forward(self, address: str, port: int) -> None: ...
def open_sftp_client(self) -> SFTPClient | None: ...

View File

@@ -151,6 +151,6 @@ class Context:
def use_privatekey(self, pkey: PKey) -> None: ...
def add_extra_chain_cert(self, certobj: X509) -> None: ...
def set_cipher_list(self, cipher_list: bytes) -> None: ...
def set_keylog_callback(self, callback: Callable[[Connection, bytes], None]) -> None: ...
def set_keylog_callback(self, callback: Callable[[Connection, bytes], object]) -> None: ...
def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ...
def set_alpn_select_callback(self, callback: Callable[[Connection, list[bytes]], bytes]) -> None: ...

View File

@@ -67,6 +67,6 @@ class Events(Generic[_T, _AbstractListener_T]):
def __iter__(self: Self) -> Self: ...
def __next__(self) -> _T: ...
def get(self, timeout: float | None = ...) -> _T | None: ...
def _event_mapper(self, event: Callable[_P, None]) -> Callable[_P, None]: ...
def _event_mapper(self, event: Callable[_P, object]) -> Callable[_P, None]: ...
class NotifierMixin: ...

View File

@@ -20,7 +20,7 @@ class Events(_util.Events[Any, Listener]):
def get(self, timeout: float | None = ...) -> Press | Release | None: ...
class HotKey:
def __init__(self, keys: list[KeyCode], on_activate: Callable[[], None]) -> None: ...
def __init__(self, keys: list[KeyCode], on_activate: Callable[[], object]) -> None: ...
@staticmethod
def parse(keys: str) -> list[KeyCode]: ...
def press(self, key: Key | KeyCode) -> None: ...

View File

@@ -27,7 +27,7 @@ def path_advance(thepath: str, sep: str = ...) -> Iterator[str]: ...
def path_retreat(thepath: str, sep: str = ...) -> Iterator[str]: ...
def reparent(newparent: str, oldpath: str) -> str: ...
_PathCallback: TypeAlias = Callable[[str], None]
_PathCallback: TypeAlias = Callable[[str], object]
def walktree(
localpath: str, fcallback: _PathCallback, dcallback: _PathCallback, ucallback: _PathCallback, recurse: bool = ...

View File

@@ -36,7 +36,7 @@ class WorkingSet:
self, requirements: Iterable[Requirement], env: Environment | None = ..., installer: _InstallerType | None = ...
) -> list[Distribution]: ...
def add(self, dist: Distribution, entry: str | None = ..., insert: bool = ..., replace: bool = ...) -> None: ...
def subscribe(self, callback: Callable[[Distribution], None]) -> None: ...
def subscribe(self, callback: Callable[[Distribution], object]) -> None: ...
def find_plugins(
self, plugin_env: Environment, full_env: Environment | None = ..., fallback: bool = ...
) -> tuple[list[Distribution], dict[Distribution, Exception]]: ...

View File

@@ -16,7 +16,7 @@ class _triggerbase:
def handle_connect(self) -> None: ...
def handle_close(self) -> None: ...
def close(self) -> None: ...
def pull_trigger(self, thunk: Callable[[None], None] | None = ...) -> None: ...
def pull_trigger(self, thunk: Callable[[None], object] | None = ...) -> None: ...
def handle_read(self) -> None: ...
if sys.platform == "linux" or sys.platform == "darwin":

View File

@@ -1,4 +1,5 @@
from collections.abc import Callable, Mapping, Sequence
from _typeshed.wsgi import StartResponse
from collections.abc import Iterator, Mapping, Sequence
from logging import Logger
from typing import Any, Match, Pattern
@@ -43,7 +44,7 @@ class Error:
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 wsgi_response(self, environ: Any, start_response: StartResponse) -> Iterator[str]: ...
class BadRequest(Error):
code: int = ...