Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)

This commit is contained in:
Alex Waygood
2022-01-18 15:14:03 +00:00
committed by GitHub
parent aa885ecd65
commit 8af5e0d340
264 changed files with 2217 additions and 2411 deletions

View File

@@ -3,7 +3,7 @@ from _typeshed import Self
from abc import abstractmethod
from logging import Logger
from types import TracebackType
from typing import Any, Callable, Container, Generic, Iterable, Iterator, List, Optional, Protocol, Set, Tuple, TypeVar
from typing import Any, Callable, Container, Generic, Iterable, Iterator, Optional, Protocol, TypeVar
FIRST_COMPLETED: str
FIRST_EXCEPTION: str
@@ -41,7 +41,7 @@ class Future(Generic[_T]):
def set_running_or_notify_cancel(self) -> bool: ...
def set_result(self, result: _T) -> None: ...
def exception(self, timeout: Optional[float] = ...) -> Any: ...
def exception_info(self, timeout: Optional[float] = ...) -> Tuple[Any, Optional[TracebackType]]: ...
def exception_info(self, timeout: Optional[float] = ...) -> tuple[Any, Optional[TracebackType]]: ...
def set_exception(self, exception: Any) -> None: ...
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
@@ -55,11 +55,11 @@ class Executor:
def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ...
def wait(
fs: _Collection[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...
) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ...
) -> tuple[set[Future[_T]], set[Future[_T]]]: ...
class _Waiter:
event: threading.Event
finished_futures: List[Future[Any]]
finished_futures: list[Future[Any]]
def __init__(self) -> None: ...
def add_result(self, future: Future[Any]) -> None: ...
def add_exception(self, future: Future[Any]) -> None: ...