Skip to content

Commit 2c8cfc3

Browse files
authored
Merge pull request #144 from JohanAlvedal/chore/remove-comprehension
chore: remove unneeded comprehension
2 parents 75715b2 + 8d724b5 commit 2c8cfc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

custom_components/pumpsteer/electricity_price.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def find_cheapest_hours(price_list: List[float], num_hours: int = 1) -> List[int
323323
return []
324324

325325
# Pair each price with its original index
326-
indexed_prices = [(i, price) for i, price in enumerate(price_list)]
326+
indexed_prices = list(enumerate(price_list))
327327

328328
indexed_prices.sort(key=lambda x: x[1])
329329
return [i for i, _ in indexed_prices[: min(num_hours, len(indexed_prices))]]
@@ -337,7 +337,7 @@ def find_most_expensive_hours(price_list: List[float], num_hours: int = 1) -> Li
337337
if not price_list or num_hours <= 0:
338338
return []
339339

340-
indexed_prices = [(i, price) for i, price in enumerate(price_list)]
340+
indexed_prices = list(enumerate(price_list))
341341
indexed_prices.sort(key=lambda x: x[1], reverse=True)
342342
return [i for i, _ in indexed_prices[: min(num_hours, len(indexed_prices))]]
343343

0 commit comments

Comments
 (0)