massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / coc-python-data / languageServer.0.5.59 / Typeshed / stdlib / 3.4 / asyncio / locks.pyi
1 from typing import Any, Callable, Generator, Iterable, Iterator, List, Type, TypeVar, Union, Optional, Awaitable\r
2 \r
3 from .coroutines import coroutine\r
4 from .events import AbstractEventLoop\r
5 from .futures import Future\r
6 from types import TracebackType\r
7 \r
8 _T = TypeVar('_T')\r
9 \r
10 __all__: List[str]\r
11 \r
12 class _ContextManager:\r
13     def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...\r
14     def __enter__(self) -> object: ...\r
15     def __exit__(self, *args: Any) -> None: ...\r
16 \r
17 class _ContextManagerMixin(Future[_ContextManager]):\r
18     # Apparently this exists to *prohibit* use as a context manager.\r
19     def __enter__(self) -> object: ...\r
20     def __exit__(self, *args: Any) -> None: ...\r
21     def __aenter__(self) -> Awaitable[None]: ...\r
22     def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...\r
23 \r
24 class Lock(_ContextManagerMixin):\r
25     def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...\r
26     def locked(self) -> bool: ...\r
27     @coroutine\r
28     def acquire(self) -> Generator[Any, None, bool]: ...\r
29     def release(self) -> None: ...\r
30 \r
31 class Event:\r
32     def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...\r
33     def is_set(self) -> bool: ...\r
34     def set(self) -> None: ...\r
35     def clear(self) -> None: ...\r
36     @coroutine\r
37     def wait(self) -> Generator[Any, None, bool]: ...\r
38 \r
39 class Condition(_ContextManagerMixin):\r
40     def __init__(self, lock: Optional[Lock] = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...\r
41     def locked(self) -> bool: ...\r
42     @coroutine\r
43     def acquire(self) -> Generator[Any, None, bool]: ...\r
44     def release(self) -> None: ...\r
45     @coroutine\r
46     def wait(self) -> Generator[Any, None, bool]: ...\r
47     @coroutine\r
48     def wait_for(self, predicate: Callable[[], _T]) -> Generator[Any, None, _T]: ...\r
49     def notify(self, n: int = ...) -> None: ...\r
50     def notify_all(self) -> None: ...\r
51 \r
52 class Semaphore(_ContextManagerMixin):\r
53     def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...\r
54     def locked(self) -> bool: ...\r
55     @coroutine\r
56     def acquire(self) -> Generator[Any, None, bool]: ...\r
57     def release(self) -> None: ...\r
58 \r
59 class BoundedSemaphore(Semaphore):\r
60     def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...\r