mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
use _LoopBoundMixin in asyncio when appropriate (#11127)
related to https://github.com/python/typeshed/issues/3968
This commit is contained in:
@@ -5,6 +5,11 @@ from typing import Any, Generic, TypeVar
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from .mixins import _LoopBoundMixin
|
||||
else:
|
||||
_LoopBoundMixin = object
|
||||
|
||||
__all__ = ("Queue", "PriorityQueue", "LifoQueue", "QueueFull", "QueueEmpty")
|
||||
|
||||
class QueueEmpty(Exception): ...
|
||||
@@ -12,7 +17,9 @@ class QueueFull(Exception): ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class Queue(Generic[_T]):
|
||||
# If Generic[_T] is last and _LoopBoundMixin is object, pyright is unhappy.
|
||||
# We can remove the noqa pragma when dropping 3.9 support.
|
||||
class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, maxsize: int = 0) -> None: ...
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user