mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
Fix: Add typing in functions
This commit is contained in:
@ -249,8 +249,9 @@ class Pubsub:
|
|||||||
# Force context switch
|
# Force context switch
|
||||||
await asyncio.sleep(0)
|
await asyncio.sleep(0)
|
||||||
|
|
||||||
# FIXME: `sub_message` can be further type hinted with mypy_protobuf
|
def handle_subscription(
|
||||||
def handle_subscription(self, origin_id: ID, sub_message: Any) -> None:
|
self, origin_id: ID, sub_message: rpc_pb2.RPC.SubOpts
|
||||||
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Handle an incoming subscription message from a peer. Update internal
|
Handle an incoming subscription message from a peer. Update internal
|
||||||
mapping to mark the peer as subscribed or unsubscribed to topics as
|
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)
|
self.peer_topics[sub_message.topicid].remove(origin_id)
|
||||||
|
|
||||||
# FIXME(mhchia): Change the function name?
|
# 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: rpc_pb2.Message) -> None:
|
||||||
async def handle_talk(self, publish_message: Any) -> None:
|
|
||||||
"""
|
"""
|
||||||
Put incoming message from a peer onto my blocking queue
|
Put incoming message from a peer onto my blocking queue
|
||||||
:param publish_message: RPC.Message format
|
:param publish_message: RPC.Message format
|
||||||
|
|||||||
Reference in New Issue
Block a user