mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Further reduce use of deprecated contextlib aliases (#6370)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user