Skip to content

Commit afb253b

Browse files
committed
Use zip() to simplify the matching of sources and results
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent ecc6693 commit afb253b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/frequenz/sdk/timeseries/_resampling.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ async def resample(self, *, one_shot: bool = False) -> None:
512512
exceptions = cast(
513513
dict[Source, Exception | asyncio.CancelledError],
514514
{
515-
source: results[i]
516-
for i, source in enumerate(resampler_sources)
515+
source: result
516+
for source, result in zip(resampler_sources, results)
517517
# CancelledError inherits from BaseException, but we don't want
518518
# to catch *all* BaseExceptions here.
519-
if isinstance(results[i], (Exception, asyncio.CancelledError))
519+
if isinstance(result, (Exception, asyncio.CancelledError))
520520
},
521521
)
522522
if exceptions:

0 commit comments

Comments
 (0)