mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
asyncio: updates for 3.11 (#7844)
CPython changes: -13c10bfb77-9523c0d84f-9f04ee569c-d03acd7270-195a46d6ffCo-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import enum
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from collections import deque
|
||||
from collections.abc import Callable, Generator
|
||||
from types import TracebackType
|
||||
@@ -8,7 +10,12 @@ from typing_extensions import Literal
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
if sys.version_info >= (3, 11):
|
||||
from .mixins import _LoopBoundMixin
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore", "Barrier")
|
||||
elif sys.version_info >= (3, 7):
|
||||
__all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore")
|
||||
else:
|
||||
__all__ = ["Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore"]
|
||||
@@ -40,20 +47,32 @@ else:
|
||||
) -> None: ...
|
||||
|
||||
class Lock(_ContextManagerMixin):
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(self) -> None: ...
|
||||
else:
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
|
||||
def locked(self) -> bool: ...
|
||||
async def acquire(self) -> Literal[True]: ...
|
||||
def release(self) -> None: ...
|
||||
|
||||
class Event:
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(self) -> None: ...
|
||||
else:
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
|
||||
def is_set(self) -> bool: ...
|
||||
def set(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
async def wait(self) -> Literal[True]: ...
|
||||
|
||||
class Condition(_ContextManagerMixin):
|
||||
def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(self, lock: Lock | None = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
|
||||
def locked(self) -> bool: ...
|
||||
async def acquire(self) -> Literal[True]: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -65,11 +84,39 @@ class Condition(_ContextManagerMixin):
|
||||
class Semaphore(_ContextManagerMixin):
|
||||
_value: int
|
||||
_waiters: deque[Future[Any]]
|
||||
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(self, value: int = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
|
||||
def locked(self) -> bool: ...
|
||||
async def acquire(self) -> Literal[True]: ...
|
||||
def release(self) -> None: ...
|
||||
def _wake_up_next(self) -> None: ...
|
||||
|
||||
class BoundedSemaphore(Semaphore):
|
||||
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(self, value: int = ...) -> None: ...
|
||||
else:
|
||||
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class _BarrierState(enum.Enum): # undocumented
|
||||
FILLING: str
|
||||
DRAINING: str
|
||||
RESETTING: str
|
||||
BROKEN: str
|
||||
|
||||
class Barrier(_LoopBoundMixin):
|
||||
def __init__(self, parties: int) -> None: ...
|
||||
async def __aenter__(self: Self) -> Self: ...
|
||||
async def __aexit__(self, *args: object) -> None: ...
|
||||
async def wait(self) -> int: ...
|
||||
async def abort(self) -> None: ...
|
||||
async def reset(self) -> None: ...
|
||||
@property
|
||||
def parties(self) -> int: ...
|
||||
@property
|
||||
def n_waiting(self) -> int: ...
|
||||
@property
|
||||
def broken(self) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user