mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from concurrent.futures._base import Error, Future as _ConcurrentFuture
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Optional, Tuple, TypeVar, Union
|
||||
from typing import Any, Awaitable, Callable, Generator, Iterable, List, Tuple, TypeVar
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
@@ -33,28 +33,28 @@ class Future(Awaitable[_T], Iterable[_T]):
|
||||
_exception: BaseException
|
||||
_blocking = False
|
||||
_log_traceback = False
|
||||
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __del__(self) -> None: ...
|
||||
if sys.version_info >= (3, 7):
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
def _callbacks(self: _S) -> List[Tuple[Callable[[_S], Any], Context]]: ...
|
||||
def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Optional[Context] = ...) -> None: ...
|
||||
def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ...
|
||||
else:
|
||||
@property
|
||||
def _callbacks(self: _S) -> List[Callable[[_S], Any]]: ...
|
||||
def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def cancel(self, msg: Optional[str] = ...) -> bool: ...
|
||||
def cancel(self, msg: str | None = ...) -> bool: ...
|
||||
else:
|
||||
def cancel(self) -> bool: ...
|
||||
def cancelled(self) -> bool: ...
|
||||
def done(self) -> bool: ...
|
||||
def result(self) -> _T: ...
|
||||
def exception(self) -> Optional[BaseException]: ...
|
||||
def exception(self) -> BaseException | None: ...
|
||||
def remove_done_callback(self: _S, __fn: Callable[[_S], Any]) -> int: ...
|
||||
def set_result(self, __result: _T) -> None: ...
|
||||
def set_exception(self, __exception: Union[type, BaseException]) -> None: ...
|
||||
def set_exception(self, __exception: type | BaseException) -> None: ...
|
||||
def __iter__(self) -> Generator[Any, None, _T]: ...
|
||||
def __await__(self) -> Generator[Any, None, _T]: ...
|
||||
@property
|
||||
@@ -62,4 +62,4 @@ class Future(Awaitable[_T], Iterable[_T]):
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
def wrap_future(future: Union[_ConcurrentFuture[_T], Future[_T]], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
|
||||
def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...
|
||||
|
||||
Reference in New Issue
Block a user