Fix:
type object not subscriptable
This commit is contained in:
parent
60d6703964
commit
437b7665c4
|
@ -36,16 +36,16 @@ class Pubsub:
|
|||
|
||||
router: 'IPubsubRouter'
|
||||
|
||||
peer_queue: asyncio.Queue[ID]
|
||||
peer_queue: 'asyncio.Queue[ID]'
|
||||
|
||||
protocols: List[str]
|
||||
|
||||
incoming_msgs_from_peers: asyncio.Queue[rpc_pb2.Message]
|
||||
outgoing_messages: asyncio.Queue[rpc_pb2.Message]
|
||||
incoming_msgs_from_peers: 'asyncio.Queue[rpc_pb2.Message]'
|
||||
outgoing_messages: 'asyncio.Queue[rpc_pb2.Message]'
|
||||
|
||||
seen_messages: LRU
|
||||
|
||||
my_topics: Dict[str, asyncio.Queue[rpc_pb2.Message]]
|
||||
my_topics: Dict[str, 'asyncio.Queue[rpc_pb2.Message]']
|
||||
|
||||
# FIXME: Should be changed to `Dict[str, List[ID]]`
|
||||
peer_topics: Dict[str, List[str]]
|
||||
|
@ -251,7 +251,7 @@ class Pubsub:
|
|||
# for each topic
|
||||
await self.my_topics[topic].put(publish_message)
|
||||
|
||||
async def subscribe(self, topic_id: str) -> asyncio.Queue[rpc_pb2.Message]:
|
||||
async def subscribe(self, topic_id: str) -> 'asyncio.Queue[rpc_pb2.Message]':
|
||||
"""
|
||||
Subscribe ourself to a topic
|
||||
:param topic_id: topic_id to subscribe to
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
import asyncio
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
)
|
||||
|
||||
from multiaddr import Multiaddr
|
||||
|
||||
from libp2p.network.network_interface import INetwork
|
||||
from libp2p.network.notifee_interface import INotifee
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import asyncio
|
||||
from libp2p.peer.id import ID
|
||||
|
||||
|
||||
class PubsubNotifee(INotifee):
|
||||
# pylint: disable=too-many-instance-attributes, cell-var-from-loop, unsubscriptable-object
|
||||
|
||||
initiator_peers_queue: asyncio.Queue[ID]
|
||||
initiator_peers_queue: 'asyncio.Queue[ID]'
|
||||
|
||||
def __init__(self, initiator_peers_queue: asyncio.Queue[ID]) -> None:
|
||||
def __init__(self, initiator_peers_queue: 'asyncio.Queue[ID]') -> None:
|
||||
"""
|
||||
:param initiator_peers_queue: queue to add new peers to so that pubsub
|
||||
can process new peers after we connect to them
|
||||
|
|
Loading…
Reference in New Issue
Block a user