Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stubs/paramiko/paramiko/channel.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/paramiko/paramiko/packet.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/paramiko/paramiko/transport.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/pyOpenSSL/OpenSSL/SSL.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
2 changes: 1 addition & 1 deletion stubs/pynput/pynput/_util.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
2 changes: 1 addition & 1 deletion stubs/pynput/pynput/keyboard/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/pysftp/pysftp/helpers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/setuptools/pkg_resources/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]]: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/waitress/waitress/trigger.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
5 changes: 3 additions & 2 deletions stubs/waitress/waitress/utilities.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 = ...
Expand Down