diff --git a/libp2p/stream_muxer/mplex/mplex_stream.py b/libp2p/stream_muxer/mplex/mplex_stream.py index 547d7b8..19a2637 100644 --- a/libp2p/stream_muxer/mplex/mplex_stream.py +++ b/libp2p/stream_muxer/mplex/mplex_stream.py @@ -8,6 +8,7 @@ from .datastructures import StreamID from .exceptions import MplexStreamClosed, MplexStreamEOF, MplexStreamReset if TYPE_CHECKING: + from typing import Any # noqa: F401 from libp2p.stream_muxer.mplex.mplex import Mplex @@ -67,8 +68,9 @@ class MplexStream(IMuxedStream): fut.cancel() if self.event_reset.is_set(): raise MplexStreamReset - done_task = tuple(done)[0] - if done_task._coro.__qualname__ == "Queue.get": + done_task = cast("asyncio.Task[Any]", tuple(done)[0]) + # TODO: `_coro` is not in `asyncio.Task`'s typeshed. + if done_task._coro.__qualname__ == "Queue.get": # type: ignore data = done_task.result() self._buf.extend(data) return diff --git a/tests/factories.py b/tests/factories.py index e161e25..0f69707 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -15,7 +15,6 @@ from libp2p.security.base_transport import BaseSecureTransport from libp2p.security.insecure.transport import PLAINTEXT_PROTOCOL_ID, InsecureTransport import libp2p.security.secio.transport as secio from libp2p.stream_muxer.mplex.mplex import Mplex -from libp2p.stream_muxer.mplex.mplex_stream import MplexStream from libp2p.typing import TProtocol from tests.configs import LISTEN_MADDR from tests.pubsub.configs import (