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 more Callable[<parameters>, Any] annotations #8233

Merged
merged 3 commits into from
Jul 4, 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
2 changes: 1 addition & 1 deletion stubs/aws-xray-sdk/aws_xray_sdk/core/recorder.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AWSXRayRecorder:
kwargs: dict[str, Any],
name: str,
namespace: str,
meta_processor: Callable[..., Any],
meta_processor: Callable[..., object],
) -> Any: ...
@property
def enabled(self) -> bool: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/invoke/invoke/util.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def cd(where: str) -> AbstractContextManager[None]: ...
def has_fileno(stream) -> bool: ...
def isatty(stream) -> bool: ...
def encode_output(string: str, encoding: str) -> str: ...
def helpline(obj: Callable[..., Any]) -> str | None: ...
def helpline(obj: Callable[..., object]) -> str | None: ...

class ExceptionHandlingThread(threading.Thread):
def __init__(
self,
*,
group: None = ...,
target: Callable[..., Any] | None = ...,
target: Callable[..., object] | None = ...,
name: str | None = ...,
args: Iterable[Any] = ...,
kwargs: Mapping[str, Any] | None = ...,
Expand Down
3 changes: 1 addition & 2 deletions stubs/opentracing/opentracing/harness/scope_check.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from collections.abc import Callable
from typing import Any

from ..scope_manager import ScopeManager

class ScopeCompatibilityCheckMixin:
def scope_manager(self) -> ScopeManager: ...
def run_test(self, test_fn: Callable[[Any], Any]) -> None: ...
def run_test(self, test_fn: Callable[[], object]) -> None: ...
def test_missing_active_external(self) -> None: ...
def test_missing_active(self) -> None: ...
def test_activate(self) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/paramiko/paramiko/dsskey.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Callable
from typing import IO, Any
from typing import IO

from paramiko.message import Message
from paramiko.pkey import PKey
Expand Down Expand Up @@ -31,4 +31,4 @@ class DSSKey(PKey):
def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ...
def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ...
@staticmethod
def generate(bits: int = ..., progress_func: Callable[..., Any] | None = ...) -> DSSKey: ...
def generate(bits: int = ..., progress_func: Callable[..., object] | None = ...) -> DSSKey: ...
2 changes: 1 addition & 1 deletion stubs/paramiko/paramiko/ecdsakey.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ class ECDSAKey(PKey):
def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ...
@classmethod
def generate(
cls, curve: EllipticCurve = ..., progress_func: Callable[..., Any] | None = ..., bits: int | None = ...
cls, curve: EllipticCurve = ..., progress_func: Callable[..., object] | None = ..., bits: int | None = ...
) -> ECDSAKey: ...
4 changes: 2 additions & 2 deletions stubs/paramiko/paramiko/rsakey.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Callable
from typing import IO, Any
from typing import IO

from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey, RSAPublicNumbers
from paramiko.message import Message
Expand Down Expand Up @@ -31,4 +31,4 @@ class RSAKey(PKey):
def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ...
def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ...
@staticmethod
def generate(bits: int, progress_func: Callable[..., Any] | None = ...) -> RSAKey: ...
def generate(bits: int, progress_func: Callable[..., object] | None = ...) -> RSAKey: ...
4 changes: 2 additions & 2 deletions stubs/paramiko/paramiko/sftp_client.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import Self
from collections.abc import Callable, Iterator
from logging import Logger
from typing import IO, Any
from typing import IO
from typing_extensions import TypeAlias

from paramiko.channel import Channel
Expand All @@ -11,7 +11,7 @@ from paramiko.sftp_file import SFTPFile
from paramiko.transport import Transport
from paramiko.util import ClosingContextManager

_Callback: TypeAlias = Callable[[int, int], Any]
_Callback: TypeAlias = Callable[[int, int], object]

b_slash: bytes

Expand Down
2 changes: 1 addition & 1 deletion stubs/psutil/psutil/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def process_iter(
attrs: list[str] | tuple[str, ...] | set[str] | frozenset[str] | None = ..., ad_value: Any | None = ...
) -> Iterator[Process]: ...
def wait_procs(
procs: Iterable[Process], timeout: float | None = ..., callback: Callable[[Process], Any] | None = ...
procs: Iterable[Process], timeout: float | None = ..., callback: Callable[[Process], object] | None = ...
) -> tuple[list[Process], list[Process]]: ...
def cpu_count(logical: bool = ...) -> int: ...
def cpu_times(percpu: bool = ...): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/pysftp/pysftp/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from collections.abc import Callable, Sequence
from contextlib import AbstractContextManager
from stat import S_IMODE as S_IMODE
from types import TracebackType
from typing import IO, Any
from typing import IO
from typing_extensions import Literal, TypeAlias

import paramiko
Expand Down Expand Up @@ -33,7 +33,7 @@ class CnOpts:
def __init__(self, knownhosts: str | None = ...) -> None: ...
def get_hostkey(self, host: str) -> paramiko.PKey: ...

_Callback: TypeAlias = Callable[[int, int], Any]
_Callback: TypeAlias = Callable[[int, int], object]
_Path: TypeAlias = str | bytes

class Connection:
Expand Down
2 changes: 1 addition & 1 deletion stubs/python-nmap/nmap/nmap.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from typing import Any, TypeVar
from typing_extensions import TypeAlias, TypedDict

_T = TypeVar("_T")
_Callback: TypeAlias = Callable[[str, _Result], Any]
_Callback: TypeAlias = Callable[[str, _Result], object]

class _Result(TypedDict):
nmap: _ResultNmap
Expand Down
2 changes: 1 addition & 1 deletion stubs/six/six/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Itera
@overload
def assertRaisesRegex(self: unittest.TestCase, msg: str | None = ...) -> Any: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., object], *args: Any, **kwargs: Any) -> Any: ...
def assertRegex(
self: unittest.TestCase, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: str | None = ...
) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/waitress/waitress/runner.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ 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: ...
def run(argv: Sequence[str] = ..., _serve: Callable[..., Any] = ...) -> None: ...
def run(argv: Sequence[str] = ..., _serve: Callable[..., object] = ...) -> None: ...