mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 21:01:52 +08:00
Fix type stubs in locks.pyi (#1250)
This commit is contained in:
committed by
Matthias Kramm
parent
367743adf0
commit
e6af58a4cc
@@ -1,8 +1,9 @@
|
||||
from typing import Any, Callable, Generator, Iterable, Iterator, List, TypeVar, Union, Optional
|
||||
from typing import Any, Callable, Generator, Iterable, Iterator, List, Type, TypeVar, Union, Optional
|
||||
|
||||
from .coroutines import coroutine
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
from .futures import Future, Awaitable
|
||||
from types import TracebackType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -17,18 +18,18 @@ class _ContextManagerMixin(Future[_ContextManager]):
|
||||
# Apparently this exists to *prohibit* use as a context manager.
|
||||
def __enter__(self) -> object: ...
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
def __aenter__(self): ...
|
||||
def __aexit__(self, exc_type, exc, tb): ...
|
||||
def __aenter__(self) -> Awaitable[None]: ...
|
||||
def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...
|
||||
|
||||
class Lock(_ContextManagerMixin):
|
||||
def __init__(self, *, loop: AbstractEventLoop = None) -> None: ...
|
||||
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
@coroutine
|
||||
def acquire(self) -> Generator[Any, None, bool]: ...
|
||||
def release(self) -> None: ...
|
||||
|
||||
class Event:
|
||||
def __init__(self, *, loop: AbstractEventLoop = None) -> None: ...
|
||||
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
||||
def is_set(self) -> bool: ...
|
||||
def set(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
@@ -36,7 +37,7 @@ class Event:
|
||||
def wait(self) -> Generator[Any, None, bool]: ...
|
||||
|
||||
class Condition(_ContextManagerMixin):
|
||||
def __init__(self, lock: Lock = None, *, loop: AbstractEventLoop = None) -> None: ...
|
||||
def __init__(self, lock: Lock = None, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
@coroutine
|
||||
def acquire(self) -> Generator[Any, None, bool]: ...
|
||||
|
||||
Reference in New Issue
Block a user