stdlib: audit more callback annotations (#8209)

This commit is contained in:
Alex Waygood
2022-07-19 15:07:25 +01:00
committed by GitHub
parent 540a6b25bf
commit e2ce7c6344
21 changed files with 61 additions and 64 deletions

View File

@@ -49,7 +49,7 @@ class Future(Generic[_T]):
def cancelled(self) -> bool: ...
def running(self) -> bool: ...
def done(self) -> bool: ...
def add_done_callback(self, fn: Callable[[Future[_T]], Any]) -> None: ...
def add_done_callback(self, fn: Callable[[Future[_T]], object]) -> None: ...
def result(self, timeout: float | None = ...) -> _T: ...
def set_running_or_notify_cancel(self) -> bool: ...
def set_result(self, result: _T) -> None: ...

View File

@@ -10,6 +10,8 @@ from weakref import ref
from ._base import BrokenExecutor, Executor, Future
_T = TypeVar("_T")
_threads_wakeups: MutableMapping[Any, Any]
_global_shutdown: bool
@@ -40,14 +42,12 @@ class _ExceptionWithTraceback:
def _rebuild_exc(exc: Exception, tb: str) -> Exception: ...
_S = TypeVar("_S")
class _WorkItem(Generic[_S]):
future: Future[_S]
fn: Callable[..., _S]
class _WorkItem(Generic[_T]):
future: Future[_T]
fn: Callable[..., _T]
args: Iterable[Any]
kwargs: Mapping[str, Any]
def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
def __init__(self, future: Future[_T], fn: Callable[..., _T], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
class _ResultItem:
work_id: int
@@ -90,7 +90,7 @@ class _SafeQueue(Queue[Future[Any]]):
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...], None, None]: ...
def _process_chunk(fn: Callable[..., Any], chunk: tuple[Any, None, None]) -> Generator[Any, None, None]: ...
def _process_chunk(fn: Callable[..., _T], chunk: Iterable[tuple[Any, ...]]) -> list[_T]: ...
if sys.version_info >= (3, 11):
def _sendback_result(