Further reduce use of deprecated contextlib aliases (#6370)

This commit is contained in:
Alex Waygood
2021-11-23 23:25:39 +00:00
committed by GitHub
parent b459329cec
commit a9cfd23fc3
5 changed files with 18 additions and 14 deletions

View File

@@ -1,7 +1,8 @@
import sys
import threading
from contextlib import AbstractContextManager
from multiprocessing.context import BaseContext
from typing import Any, Callable, ContextManager, Union
from typing import Any, Callable, Union
_LockLike = Union[Lock, RLock]
@@ -13,7 +14,7 @@ class Barrier(threading.Barrier):
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ...
class Condition(ContextManager[bool]):
class Condition(AbstractContextManager[bool]):
def __init__(self, lock: _LockLike | None = ..., *, ctx: BaseContext) -> None: ...
if sys.version_info >= (3, 7):
def notify(self, n: int = ...) -> None: ...
@@ -25,7 +26,7 @@ class Condition(ContextManager[bool]):
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...
class Event(ContextManager[bool]):
class Event(AbstractContextManager[bool]):
def __init__(self, lock: _LockLike | None = ..., *, ctx: BaseContext) -> None: ...
def is_set(self) -> bool: ...
def set(self) -> None: ...
@@ -42,6 +43,6 @@ class Semaphore(SemLock):
def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ...
# Not part of public API
class SemLock(ContextManager[bool]):
class SemLock(AbstractContextManager[bool]):
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...