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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user