massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / concurrent / futures / thread.pyi
1 import queue
2 import sys
3 from collections.abc import Iterable, Mapping, Set  # equivalent to typing.AbstractSet, not builtins.set
4 from threading import Lock, Semaphore, Thread
5 from typing import Any, Callable, Generic, Tuple, TypeVar
6 from weakref import ref
7
8 from ._base import Executor, Future
9
10 _threads_queues: Mapping[Any, Any]
11 _shutdown: bool
12 _global_shutdown_lock: Lock
13
14 def _python_exit() -> None: ...
15
16 if sys.version_info >= (3, 9):
17     from types import GenericAlias
18
19 _S = TypeVar("_S")
20
21 class _WorkItem(Generic[_S]):
22     future: Future[_S]
23     fn: Callable[..., _S]
24     args: Iterable[Any]
25     kwargs: Mapping[str, Any]
26     def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
27     def run(self) -> None: ...
28     if sys.version_info >= (3, 9):
29         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
30
31 if sys.version_info >= (3, 7):
32     def _worker(
33         executor_reference: ref[Any],
34         work_queue: queue.SimpleQueue[Any],
35         initializer: Callable[..., None],
36         initargs: Tuple[Any, ...],
37     ) -> None: ...
38
39 else:
40     def _worker(executor_reference: ref[Any], work_queue: queue.Queue[Any]) -> None: ...
41
42 if sys.version_info >= (3, 7):
43     from ._base import BrokenExecutor
44     class BrokenThreadPool(BrokenExecutor): ...
45
46 class ThreadPoolExecutor(Executor):
47     _max_workers: int
48     _idle_semaphore: Semaphore
49     _threads: Set[Thread]
50     _broken: bool
51     _shutdown: bool
52     _shutdown_lock: Lock
53     _thread_name_prefix: str | None = ...
54     _initializer: Callable[..., None] | None = ...
55     _initargs: Tuple[Any, ...] = ...
56     if sys.version_info >= (3, 7):
57         _work_queue: queue.SimpleQueue[_WorkItem[Any]]
58     else:
59         _work_queue: queue.Queue[_WorkItem[Any]]
60     if sys.version_info >= (3, 7):
61         def __init__(
62             self,
63             max_workers: int | None = ...,
64             thread_name_prefix: str = ...,
65             initializer: Callable[..., None] | None = ...,
66             initargs: Tuple[Any, ...] = ...,
67         ) -> None: ...
68     else:
69         def __init__(self, max_workers: int | None = ..., thread_name_prefix: str = ...) -> None: ...
70     def _adjust_thread_count(self) -> None: ...
71     if sys.version_info >= (3, 7):
72         def _initializer_failed(self) -> None: ...