1 from typing import Any, Callable, Generator, Iterable, Iterator, List, Type, TypeVar, Union, Optional, Awaitable
\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
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
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
24 class Lock(_ContextManagerMixin):
\r
25 def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
\r
26 def locked(self) -> bool: ...
\r
28 def acquire(self) -> Generator[Any, None, bool]: ...
\r
29 def release(self) -> None: ...
\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
37 def wait(self) -> Generator[Any, None, bool]: ...
\r
39 class Condition(_ContextManagerMixin):
\r
40 def __init__(self, lock: Optional[Lock] = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
\r
41 def locked(self) -> bool: ...
\r
43 def acquire(self) -> Generator[Any, None, bool]: ...
\r
44 def release(self) -> None: ...
\r
46 def wait(self) -> Generator[Any, None, bool]: ...
\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
52 class Semaphore(_ContextManagerMixin):
\r
53 def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
\r
54 def locked(self) -> bool: ...
\r
56 def acquire(self) -> Generator[Any, None, bool]: ...
\r
57 def release(self) -> None: ...
\r
59 class BoundedSemaphore(Semaphore):
\r
60 def __init__(self, value: int = ..., *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
\r