stdlib: Improve a bunch of __(a)exit__ methods (#7571)

This commit is contained in:
Alex Waygood
2022-04-01 07:05:25 +01:00
committed by GitHub
parent 85f060b26d
commit da3e69d093
20 changed files with 47 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ from _typeshed import Self
from abc import abstractmethod
from collections.abc import Container, Iterable, Iterator, Sequence
from logging import Logger
from types import TracebackType
from typing import Any, Callable, Generic, Protocol, TypeVar, overload
from typing_extensions import Literal, ParamSpec, SupportsIndex
@@ -73,7 +74,9 @@ class Executor:
def shutdown(self, wait: bool = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool | None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ...
@@ -127,4 +130,4 @@ class _AcquireFutures:
futures: Iterable[Future[Any]]
def __init__(self, futures: Iterable[Future[Any]]) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: Any) -> None: ...
def __exit__(self, *args: object) -> None: ...