Avoid unnecessary forward refs in class definitions (#10124)

This commit is contained in:
Alex Waygood
2023-05-01 15:50:50 +01:00
committed by GitHub
parent 277532219f
commit e816acffdd
5 changed files with 98 additions and 99 deletions

View File

@@ -14,9 +14,6 @@ class Barrier(threading.Barrier):
self, parties: int, action: Callable[[], object] | None = None, timeout: float | None = None, *ctx: BaseContext
) -> None: ...
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...
class Condition(AbstractContextManager[bool]):
def __init__(self, lock: _LockLike | None = None, *, ctx: BaseContext) -> None: ...
def notify(self, n: int = 1) -> None: ...
@@ -36,6 +33,14 @@ class Event:
def clear(self) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...
# Not part of public API
class SemLock(AbstractContextManager[bool]):
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...
def __exit__(
self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
) -> None: ...
class Lock(SemLock):
def __init__(self, *, ctx: BaseContext) -> None: ...
@@ -45,10 +50,5 @@ class RLock(SemLock):
class Semaphore(SemLock):
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...
# Not part of public API
class SemLock(AbstractContextManager[bool]):
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...
def __exit__(
self, __exc_type: type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
) -> None: ...
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ...