From e57d01f360de9fb101adffa686cf5aff414fc8f8 Mon Sep 17 00:00:00 2001 From: mhchia Date: Tue, 28 Jan 2020 15:48:41 +0800 Subject: [PATCH] PR feedback - Use f-string - Fix wrongly indented comments - Add dep `trio-typing` --- examples/chat/chat.py | 2 +- libp2p/network/connection/swarm_connection.py | 2 +- setup.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/chat/chat.py b/examples/chat/chat.py index 41aad92..81f3891 100755 --- a/examples/chat/chat.py +++ b/examples/chat/chat.py @@ -63,7 +63,7 @@ async def run(port: int, destination: str) -> None: nursery.start_soon(read_data, stream) nursery.start_soon(write_data, stream) - print("Connected to peer %s" % info.addrs[0]) + print(f"Connected to peer {info.addrs[0]}") await trio.sleep_forever() diff --git a/libp2p/network/connection/swarm_connection.py b/libp2p/network/connection/swarm_connection.py index 7cf3c0f..b84db8e 100644 --- a/libp2p/network/connection/swarm_connection.py +++ b/libp2p/network/connection/swarm_connection.py @@ -60,9 +60,9 @@ class SwarmConn(INetConn): while True: try: stream = await self.muxed_conn.accept_stream() - # Asynchronously handle the accepted stream, to avoid blocking the next stream. except MuxedConnUnavailable: break + # Asynchronously handle the accepted stream, to avoid blocking the next stream. self.swarm.manager.run_task(self._handle_muxed_stream, stream) await self.close() diff --git a/setup.py b/setup.py index fe3b5ae..2d36c70 100644 --- a/setup.py +++ b/setup.py @@ -77,6 +77,7 @@ install_requires = [ "trio>=0.13.0", "async-service>=0.1.0a4", "async-exit-stack==1.0.1", + "trio-typing>=0.3.0,<1.0.0", ]