Skip to content

Commit d639c71

Browse files
committed
Use min() instead of if to calculate ev_to_deallocate
This accepts a suggestion made by pylint. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 86656b3 commit d639c71

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/frequenz/sdk/actor/power_distributing/_component_managers/_ev_charger_manager/_ev_charger_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@ def _deallocate_unused_power(self, to_deallocate: Power) -> dict[int, Power]:
389389
ev_to_deallocate = evc.last_allocation - evc.power
390390
if ev_to_deallocate <= Power.zero():
391391
continue
392-
if ev_to_deallocate >= to_deallocate - deallocated_power:
393-
ev_to_deallocate = to_deallocate - deallocated_power
392+
ev_to_deallocate = min(ev_to_deallocate, to_deallocate - deallocated_power)
394393
tgt_power = evc.last_allocation - ev_to_deallocate
395394
if tgt_power < min_power:
396395
tgt_power = Power.zero()

0 commit comments

Comments
 (0)