PR feedback

- Use f-string
- Fix wrongly indented comments
- Add dep `trio-typing`
This commit is contained in:
mhchia 2020-01-28 15:48:41 +08:00
parent 095a848f30
commit e57d01f360
No known key found for this signature in database
GPG Key ID: 389EFBEA1362589A
3 changed files with 3 additions and 2 deletions

View File

@ -63,7 +63,7 @@ async def run(port: int, destination: str) -> None:
nursery.start_soon(read_data, stream) nursery.start_soon(read_data, stream)
nursery.start_soon(write_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() await trio.sleep_forever()

View File

@ -60,9 +60,9 @@ class SwarmConn(INetConn):
while True: while True:
try: try:
stream = await self.muxed_conn.accept_stream() stream = await self.muxed_conn.accept_stream()
# Asynchronously handle the accepted stream, to avoid blocking the next stream.
except MuxedConnUnavailable: except MuxedConnUnavailable:
break break
# Asynchronously handle the accepted stream, to avoid blocking the next stream.
self.swarm.manager.run_task(self._handle_muxed_stream, stream) self.swarm.manager.run_task(self._handle_muxed_stream, stream)
await self.close() await self.close()

View File

@ -77,6 +77,7 @@ install_requires = [
"trio>=0.13.0", "trio>=0.13.0",
"async-service>=0.1.0a4", "async-service>=0.1.0a4",
"async-exit-stack==1.0.1", "async-exit-stack==1.0.1",
"trio-typing>=0.3.0,<1.0.0",
] ]