mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-03-22 13:11:27 +00:00
enforced f-strings everywhere, %s on logging
extended _multiaddr_from_socket to support UDP and IPv6 automatically changed TCPListener to use _ip4_or_6_from_multiaddr to get host, and not ip4 only enforced `from error` everywhere with raises added call braces to exceptions
This commit is contained in:
@ -56,7 +56,7 @@ class P2PDProcess:
|
||||
is_pubsub_signing: bool = False,
|
||||
is_pubsub_signing_strict: bool = False,
|
||||
) -> None:
|
||||
args = [f"-listen={str(control_maddr)}"]
|
||||
args = [f"-listen={control_maddr!s}"]
|
||||
# NOTE: To support `-insecure`, we need to hack `go-libp2p-daemon`.
|
||||
if not is_secure:
|
||||
args.append("-insecure=true")
|
||||
|
||||
@ -81,7 +81,7 @@ class DummyAccountNode:
|
||||
:param dest_user: user to send crypto to
|
||||
:param amount: amount of crypto to send
|
||||
"""
|
||||
msg_contents = "send," + source_user + "," + dest_user + "," + str(amount)
|
||||
msg_contents = f"send,{source_user},{dest_user},{amount!s}"
|
||||
await self.pubsub.publish(CRYPTO_TOPIC, msg_contents.encode())
|
||||
|
||||
async def publish_set_crypto(self, user: str, amount: int) -> None:
|
||||
@ -92,7 +92,7 @@ class DummyAccountNode:
|
||||
:param user: user to set crypto for
|
||||
:param amount: amount of crypto
|
||||
"""
|
||||
msg_contents = "set," + user + "," + str(amount)
|
||||
msg_contents = f"set,{user},{amount!s}"
|
||||
await self.pubsub.publish(CRYPTO_TOPIC, msg_contents.encode())
|
||||
|
||||
def handle_send_crypto(self, source_user: str, dest_user: str, amount: int) -> None:
|
||||
|
||||
@ -51,7 +51,7 @@ async def echo_stream_handler(stream: INetStream) -> None:
|
||||
while True:
|
||||
read_string = (await stream.read(MAX_READ_LEN)).decode()
|
||||
|
||||
resp = "ack:" + read_string
|
||||
resp = f"ack:{read_string}"
|
||||
await stream.write(resp.encode())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user