From 1cd969a2d5b991f6531b8291fcc0482b4791376a Mon Sep 17 00:00:00 2001 From: mhchia Date: Fri, 6 Sep 2019 20:02:35 +0800 Subject: [PATCH] Fix: Add typing in functions --- libp2p/pubsub/pubsub.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libp2p/pubsub/pubsub.py b/libp2p/pubsub/pubsub.py index b181293..c55a183 100644 --- a/libp2p/pubsub/pubsub.py +++ b/libp2p/pubsub/pubsub.py @@ -249,8 +249,9 @@ class Pubsub: # Force context switch await asyncio.sleep(0) - # FIXME: `sub_message` can be further type hinted with mypy_protobuf - def handle_subscription(self, origin_id: ID, sub_message: Any) -> None: + def handle_subscription( + self, origin_id: ID, sub_message: rpc_pb2.RPC.SubOpts + ) -> None: """ Handle an incoming subscription message from a peer. Update internal mapping to mark the peer as subscribed or unsubscribed to topics as @@ -270,8 +271,7 @@ class Pubsub: self.peer_topics[sub_message.topicid].remove(origin_id) # FIXME(mhchia): Change the function name? - # FIXME(mhchia): `publish_message` can be further type hinted with mypy_protobuf - async def handle_talk(self, publish_message: Any) -> None: + async def handle_talk(self, publish_message: rpc_pb2.Message) -> None: """ Put incoming message from a peer onto my blocking queue :param publish_message: RPC.Message format