Various asyncio classes: remove the loop argument on 3.10 (#9630)

This commit is contained in:
Alex Waygood
2023-01-31 00:55:08 +00:00
committed by GitHub
parent 94065d3aa5
commit 8a098a8601
3 changed files with 26 additions and 10 deletions

View File

@@ -45,20 +45,20 @@ else:
) -> None: ...
class Lock(_ContextManagerMixin):
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 10):
def __init__(self) -> None: ...
else:
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> Literal[True]: ...
def release(self) -> None: ...
class Event:
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 10):
def __init__(self) -> None: ...
else:
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
def is_set(self) -> bool: ...
def set(self) -> None: ...
@@ -66,10 +66,10 @@ class Event:
async def wait(self) -> Literal[True]: ...
class Condition(_ContextManagerMixin):
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 10):
def __init__(self, lock: Lock | None = None) -> None: ...
else:
def __init__(self, lock: Lock | None = None, *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, lock: Lock | None = None, *, loop: AbstractEventLoop | None = None) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> Literal[True]: ...
@@ -82,10 +82,10 @@ class Condition(_ContextManagerMixin):
class Semaphore(_ContextManagerMixin):
_value: int
_waiters: deque[Future[Any]]
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 10):
def __init__(self, value: int = 1) -> None: ...
else:
def __init__(self, value: int = 1, *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, value: int = 1, *, loop: AbstractEventLoop | None = None) -> None: ...
def locked(self) -> bool: ...
async def acquire(self) -> Literal[True]: ...

View File

@@ -13,10 +13,10 @@ class QueueFull(Exception): ...
_T = TypeVar("_T")
class Queue(Generic[_T]):
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 10):
def __init__(self, maxsize: int = 0) -> None: ...
else:
def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop | None = ...) -> None: ...
def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop | None = None) -> None: ...
def _init(self, maxsize: int) -> None: ...
def _get(self) -> _T: ...

View File

@@ -65,6 +65,22 @@ tempfile.SpooledTemporaryFile.readable
tempfile.SpooledTemporaryFile.seekable
tempfile.SpooledTemporaryFile.writable
# The "loop" argument exists at runtime,
# but raises TypeError if you try to provide any value for it
asyncio.BoundedSemaphore.__init__
asyncio.Condition.__init__
asyncio.Event.__init__
asyncio.Lock.__init__
asyncio.Queue.__init__
asyncio.Semaphore.__init__
asyncio.locks.BoundedSemaphore.__init__
asyncio.locks.Semaphore.__init__
asyncio.locks.Condition.__init__
asyncio.locks.Event.__init__
asyncio.locks.Lock.__init__
asyncio.locks.Semaphore.__init__
asyncio.queues.Queue.__init__
# Exists at runtime, but missing from stubs
_collections_abc.AsyncIterable.__class_getitem__
_collections_abc.Awaitable.__class_getitem__