remove unneeded use of AbstractContextManager from multiprocessing.synchronize (#12872)

This commit is contained in:
Stephen Morton
2024-10-22 01:20:15 -07:00
committed by GitHub
parent e8c2e5bb20
commit e74d9cf9c7

View File

@@ -1,6 +1,5 @@
import threading
from collections.abc import Callable
from contextlib import AbstractContextManager
from multiprocessing.context import BaseContext
from types import TracebackType
from typing_extensions import TypeAlias
@@ -14,7 +13,7 @@ class Barrier(threading.Barrier):
self, parties: int, action: Callable[[], object] | None = None, timeout: float | None = None, *ctx: BaseContext
) -> None: ...
class Condition(AbstractContextManager[bool, None]):
class Condition:
def __init__(self, lock: _LockLike | None = None, *, ctx: BaseContext) -> None: ...
def notify(self, n: int = 1) -> None: ...
def notify_all(self) -> None: ...
@@ -22,6 +21,7 @@ class Condition(AbstractContextManager[bool, None]):
def wait_for(self, predicate: Callable[[], bool], timeout: float | None = None) -> bool: ...
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, /
) -> None: ...
@@ -34,9 +34,10 @@ class Event:
def wait(self, timeout: float | None = None) -> bool: ...
# Not part of public API
class SemLock(AbstractContextManager[bool, None]):
class SemLock:
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None, /
) -> None: ...