mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Enforce pre-summary newline in docstrings
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
"""Test Notify and Notifee by ensuring that the proper events get called, and
|
||||
that the stream passed into opened_stream is correct.
|
||||
"""
|
||||
Test Notify and Notifee by ensuring that the proper events get called, and that
|
||||
the stream passed into opened_stream is correct.
|
||||
|
||||
Note: Listen event does not get hit because MyNotifee is passed
|
||||
into network after network has already started listening
|
||||
|
||||
@ -20,7 +20,8 @@ CRYPTO_TOPIC = "ethereum"
|
||||
|
||||
|
||||
class DummyAccountNode:
|
||||
"""Node which has an internal balance mapping, meant to serve as a dummy
|
||||
"""
|
||||
Node which has an internal balance mapping, meant to serve as a dummy
|
||||
crypto blockchain.
|
||||
|
||||
There is no actual blockchain, just a simple map indicating how much
|
||||
@ -41,8 +42,9 @@ class DummyAccountNode:
|
||||
|
||||
@classmethod
|
||||
async def create(cls):
|
||||
"""Create a new DummyAccountNode and attach a libp2p node, a floodsub,
|
||||
and a pubsub instance to this new node.
|
||||
"""
|
||||
Create a new DummyAccountNode and attach a libp2p node, a floodsub, and
|
||||
a pubsub instance to this new node.
|
||||
|
||||
We use create as this serves as a factory function and allows us
|
||||
to use async await, unlike the init function
|
||||
@ -71,7 +73,8 @@ class DummyAccountNode:
|
||||
asyncio.ensure_future(self.handle_incoming_msgs())
|
||||
|
||||
async def publish_send_crypto(self, source_user, dest_user, amount):
|
||||
"""Create a send crypto message and publish that message to all other
|
||||
"""
|
||||
Create a send crypto message and publish that message to all other
|
||||
nodes.
|
||||
|
||||
:param source_user: user to send crypto from
|
||||
@ -82,7 +85,8 @@ class DummyAccountNode:
|
||||
await self.pubsub.publish(CRYPTO_TOPIC, msg_contents.encode())
|
||||
|
||||
async def publish_set_crypto(self, user, amount):
|
||||
"""Create a set crypto message and publish that message to all other
|
||||
"""
|
||||
Create a set crypto message and publish that message to all other
|
||||
nodes.
|
||||
|
||||
:param user: user to set crypto for
|
||||
@ -92,7 +96,8 @@ class DummyAccountNode:
|
||||
await self.pubsub.publish(CRYPTO_TOPIC, msg_contents.encode())
|
||||
|
||||
def handle_send_crypto(self, source_user, dest_user, amount):
|
||||
"""Handle incoming send_crypto message.
|
||||
"""
|
||||
Handle incoming send_crypto message.
|
||||
|
||||
:param source_user: user to send crypto from
|
||||
:param dest_user: user to send crypto to
|
||||
@ -109,7 +114,8 @@ class DummyAccountNode:
|
||||
self.balances[dest_user] = amount
|
||||
|
||||
def handle_set_crypto(self, dest_user, amount):
|
||||
"""Handle incoming set_crypto message.
|
||||
"""
|
||||
Handle incoming set_crypto message.
|
||||
|
||||
:param dest_user: user to set crypto for
|
||||
:param amount: amount of crypto
|
||||
@ -117,7 +123,8 @@ class DummyAccountNode:
|
||||
self.balances[dest_user] = amount
|
||||
|
||||
def get_balance(self, user):
|
||||
"""Get balance in crypto for a particular user.
|
||||
"""
|
||||
Get balance in crypto for a particular user.
|
||||
|
||||
:param user: user to get balance for
|
||||
:return: balance of user
|
||||
|
||||
@ -16,7 +16,8 @@ def create_setup_in_new_thread_func(dummy_node):
|
||||
|
||||
|
||||
async def perform_test(num_nodes, adjacency_map, action_func, assertion_func):
|
||||
"""Helper function to allow for easy construction of custom tests for dummy
|
||||
"""
|
||||
Helper function to allow for easy construction of custom tests for dummy
|
||||
account nodes in various network topologies.
|
||||
|
||||
:param num_nodes: number of nodes in the test
|
||||
|
||||
@ -7,7 +7,8 @@ from tests.utils import connect
|
||||
|
||||
|
||||
def message_id_generator(start_val):
|
||||
"""Generate a unique message id.
|
||||
"""
|
||||
Generate a unique message id.
|
||||
|
||||
:param start_val: value to start generating messages at
|
||||
:return: message id
|
||||
|
||||
Reference in New Issue
Block a user