Skip to content

Commit

Permalink
Improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
mhthies committed Nov 30, 2023
1 parent 43e7c0e commit 34e21ff
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions knxdclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,8 @@ async def iterate_group_telegrams(self) -> AsyncIterator[ReceivedGroupAPDU]:
while True:
try:
next_message_task = asyncio.create_task(queue.get())
done, _pending = await asyncio.wait(
[next_message_task, run_exited],
return_when=asyncio.FIRST_COMPLETED
)
done, _pending = await asyncio.wait((next_message_task, run_exited),
return_when=asyncio.FIRST_COMPLETED)

if run_exited in done:
raise ConnectionAbortedError("KNXDConnection was closed and is no longer sending messages")
Expand Down Expand Up @@ -304,7 +302,7 @@ async def open_group_socket(self, write_only=False) -> None:
run_exited = asyncio.create_task(self._run_exited.wait())
response_ready = asyncio.create_task(self._response_ready.wait())

done, _pending = await asyncio.wait([run_exited, response_ready], return_when=asyncio.FIRST_COMPLETED)
done, _pending = await asyncio.wait((run_exited, response_ready), return_when=asyncio.FIRST_COMPLETED)

if run_exited in done:
response_ready.cancel()
Expand Down

0 comments on commit 34e21ff

Please sign in to comment.