-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Description
Class AbstractQueueIterator, seemingly has wrong __aenter__ method's signature.
@abstractmethod
def __aenter__(self) -> Awaitable["AbstractQueueIterator"]:
raise NotImplementedErrorFor some reason, async is missing here. Although, it should be here according to contextlib context manager:
class AbstractAsyncContextManager(abc.ABC):
"""An abstract base class for asynchronous context managers."""
__class_getitem__ = classmethod(GenericAlias)
async def __aenter__(self):
"""Return `self` upon entering the runtime context."""
return self
@abc.abstractmethod
async def __aexit__(self, exc_type, exc_value, traceback):
"""Raise any exception triggered within the runtime context."""
return None
@classmethod
def __subclasshook__(cls, C):
if cls is AbstractAsyncContextManager:
return _collections_abc._check_methods(C, "__aenter__",
"__aexit__")
return NotImplementedAnd is then implemented in QueueIterator,
class QueueIterator(AbstractQueueIterator):
DEFAULT_CLOSE_TIMEOUT = 5
# ...
async def __aenter__(self) -> "AbstractQueueIterator":
if not hasattr(self, "_consumer_tag"):
await self.consume()
return selfNot big of an issue since abstract classes are never instantiated, but still.
Python 3.9, aio-pika==9.5.4
Metadata
Metadata
Assignees
Labels
No labels