refactor(linux): drop redundant double-await of adapters_from_hci_future#282
Draft
bluetoothbot wants to merge 1 commit into
Draft
Conversation
LinuxAdapters.refresh() already awaits adapters_from_hci_future via asyncio.gather(), so the subsequent `await adapters_from_hci_future` is a no-op that re-suspends a completed future. Replace with `.result()` — the idiomatic way to extract a sync result from a done Future, signaling intent more clearly. No behavior change; 51 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #282 +/- ##
=======================================
Coverage 99.61% 99.61%
=======================================
Files 14 14
Lines 522 522
Branches 48 48
=======================================
Hits 520 520
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
LinuxAdapters.refresh()awaitsadapters_from_hci_futuretwice — once implicitly viaasyncio.gather(*futures)(the future is infutures), and once explicitly on the next line. Replace the second await with.result()on the already-done future.Why
The double-await is a no-op on a completed Future (the second
awaitreturns the cached result immediately), but it muddies intent: a reader has to verify the future is in the gather list to know the explicit await is redundant..result()is the idiomatic way to pull a sync value out of a finished Future and reads as "extract result," not "await again."Found via the "redundant-await" survey lens — same family as #272 (dead duplicate-guard) and #276 (dead ret-check). Pure cleanup, no behavior change.
How
1-line change in
systems/linux.py. The future is guaranteed done by the precedinggather(), so.result()returns synchronously without raisingInvalidStateError.Testing
poetry run pytest -q)Quality Report
Changes: 1 file changed, 1 insertion(+), 1 deletion(-)
Code scan: clean
Tests: passed (1
PASSED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline