massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / asyncio / futures.pyi
1 import sys
2 from concurrent.futures._base import Error, Future as _ConcurrentFuture
3 from typing import Any, Awaitable, Callable, Generator, Iterable, TypeVar
4
5 from .events import AbstractEventLoop
6
7 if sys.version_info < (3, 8):
8     from concurrent.futures import CancelledError as CancelledError, TimeoutError as TimeoutError
9     class InvalidStateError(Error): ...
10
11 if sys.version_info >= (3, 7):
12     from contextvars import Context
13
14 if sys.version_info >= (3, 9):
15     from types import GenericAlias
16
17 _T = TypeVar("_T")
18 _S = TypeVar("_S")
19
20 if sys.version_info < (3, 7):
21     class _TracebackLogger:
22         exc: BaseException
23         tb: list[str]
24         def __init__(self, exc: Any, loop: AbstractEventLoop) -> None: ...
25         def activate(self) -> None: ...
26         def clear(self) -> None: ...
27         def __del__(self) -> None: ...
28
29 def isfuture(obj: object) -> bool: ...
30
31 class Future(Awaitable[_T], Iterable[_T]):
32     _state: str
33     _exception: BaseException
34     _blocking = False
35     _log_traceback = False
36     def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
37     def __repr__(self) -> str: ...
38     def __del__(self) -> None: ...
39     if sys.version_info >= (3, 7):
40         def get_loop(self) -> AbstractEventLoop: ...
41         def _callbacks(self: _S) -> list[tuple[Callable[[_S], Any], Context]]: ...
42         def add_done_callback(self: _S, __fn: Callable[[_S], Any], *, context: Context | None = ...) -> None: ...
43     else:
44         @property
45         def _callbacks(self: _S) -> list[Callable[[_S], Any]]: ...
46         def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ...
47     if sys.version_info >= (3, 9):
48         def cancel(self, msg: Any | None = ...) -> bool: ...
49     else:
50         def cancel(self) -> bool: ...
51     def cancelled(self) -> bool: ...
52     def done(self) -> bool: ...
53     def result(self) -> _T: ...
54     def exception(self) -> BaseException | None: ...
55     def remove_done_callback(self: _S, __fn: Callable[[_S], Any]) -> int: ...
56     def set_result(self, __result: _T) -> None: ...
57     def set_exception(self, __exception: type | BaseException) -> None: ...
58     def __iter__(self) -> Generator[Any, None, _T]: ...
59     def __await__(self) -> Generator[Any, None, _T]: ...
60     @property
61     def _loop(self) -> AbstractEventLoop: ...
62     if sys.version_info >= (3, 9):
63         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
64
65 def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ...