Skip to content

Commit 483b4ce

Browse files
committed
Fix the new too-many-positional-arguments pylint errors
When appropriate, we just make arguments keyword-only, which is a good practice anyway. For tests, in general we just disabled the check. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent a3fe218 commit 483b4ce

File tree

22 files changed

+100
-46
lines changed

22 files changed

+100
-46
lines changed

src/frequenz/sdk/microgrid/_power_distributing/_component_pool_status_tracker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class ComponentPoolStatusTracker:
3333

3434
def __init__( # pylint: disable=too-many-arguments
3535
self,
36+
*,
3637
component_ids: abc.Set[int],
3738
component_status_sender: Sender[ComponentPoolStatus],
3839
max_data_age: timedelta,

src/frequenz/sdk/microgrid/_power_distributing/_component_status/_battery_status_tracker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class BatteryStatusTracker(ComponentStatusTracker, BackgroundService):
9999
@override
100100
def __init__( # pylint: disable=too-many-arguments
101101
self,
102+
*,
102103
component_id: int,
103104
max_data_age: timedelta,
104105
max_blocking_duration: timedelta,

src/frequenz/sdk/microgrid/_power_distributing/_component_status/_component_status.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class ComponentStatusTracker(BackgroundService, ABC):
8585
@abstractmethod
8686
def __init__( # pylint: disable=too-many-arguments,super-init-not-called
8787
self,
88+
*,
8889
component_id: int,
8990
max_data_age: timedelta,
9091
max_blocking_duration: timedelta,

src/frequenz/sdk/microgrid/_power_distributing/_component_status/_ev_charger_status_tracker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class EVChargerStatusTracker(ComponentStatusTracker, BackgroundService):
4646
@override
4747
def __init__( # pylint: disable=too-many-arguments
4848
self,
49+
*,
4950
component_id: int,
5051
max_data_age: timedelta,
5152
max_blocking_duration: timedelta,

src/frequenz/sdk/microgrid/_power_distributing/_component_status/_pv_inverter_status_tracker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class PVInverterStatusTracker(ComponentStatusTracker, BackgroundService):
4343
@override
4444
def __init__( # pylint: disable=too-many-arguments
4545
self,
46+
*,
4647
component_id: int,
4748
max_data_age: timedelta,
4849
max_blocking_duration: timedelta,

src/frequenz/sdk/microgrid/_power_distributing/_distribution_algorithm/_battery_distribution_algorithm.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ def _compute_battery_availability_ratio(
449449

450450
def _distribute_power( # pylint: disable=too-many-arguments
451451
self,
452+
*,
452453
components: list[InvBatPair],
453454
power_w: float,
454455
available_soc: dict[int, float],
@@ -730,7 +731,11 @@ def _distribute_consume_power(
730731
)
731732

732733
return self._distribute_power(
733-
components, power_w, available_soc, incl_bounds, excl_bounds
734+
components=components,
735+
power_w=power_w,
736+
available_soc=available_soc,
737+
incl_bounds=incl_bounds,
738+
excl_bounds=excl_bounds,
734739
)
735740

736741
def _distribute_supply_power(
@@ -761,7 +766,11 @@ def _distribute_supply_power(
761766
)
762767

763768
result: DistributionResult = self._distribute_power(
764-
components, -1 * power_w, available_soc, incl_bounds, excl_bounds
769+
components=components,
770+
power_w=-1 * power_w,
771+
available_soc=available_soc,
772+
incl_bounds=incl_bounds,
773+
excl_bounds=excl_bounds,
765774
)
766775

767776
for inverter_id in result.distribution.keys():

src/frequenz/sdk/microgrid/_power_managing/_power_managing_actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class PowerManagingActor(Actor): # pylint: disable=too-many-instance-attributes
3232

3333
def __init__( # pylint: disable=too-many-arguments
3434
self,
35+
*,
3536
proposals_receiver: Receiver[Proposal],
3637
bounds_subscription_receiver: Receiver[ReportRequest],
3738
power_distributing_requests_sender: Sender[_power_distributing.Request],
3839
power_distributing_results_receiver: Receiver[_power_distributing.Result],
3940
channel_registry: ChannelRegistry,
40-
*,
4141
component_category: ComponentCategory,
4242
component_type: ComponentType | None = None,
4343
# arguments to actors need to serializable, so we pass an enum for the algorithm

src/frequenz/sdk/timeseries/battery_pool/_battery_pool_reference_store.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class BatteryPoolReferenceStore: # pylint: disable=too-many-instance-attributes
3939

4040
def __init__( # pylint: disable=too-many-arguments
4141
self,
42+
*,
4243
channel_registry: ChannelRegistry,
4344
resampler_subscription_sender: Sender[ComponentMetricRequest],
4445
batteries_status_receiver: Receiver[ComponentPoolStatus],

src/frequenz/sdk/timeseries/ev_charger_pool/_ev_charger_pool_reference_store.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class EVChargerPoolReferenceStore:
3535

3636
def __init__( # pylint: disable=too-many-arguments
3737
self,
38+
*,
3839
channel_registry: ChannelRegistry,
3940
resampler_subscription_sender: Sender[ComponentMetricRequest],
4041
status_receiver: Receiver[ComponentPoolStatus],

src/frequenz/sdk/timeseries/formula_engine/_formula_engine_pool.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ def from_string(
8080
return self._string_engines[channel_key]
8181

8282
builder = ResampledFormulaBuilder(
83-
self._namespace,
84-
formula,
85-
self._channel_registry,
86-
self._resampler_subscription_sender,
87-
component_metric_id,
88-
Quantity,
83+
namespace=self._namespace,
84+
formula_name=formula,
85+
channel_registry=self._channel_registry,
86+
resampler_subscription_sender=self._resampler_subscription_sender,
87+
metric_id=component_metric_id,
88+
create_method=Quantity,
8989
)
9090
formula_engine = builder.from_string(formula, nones_are_zeros=nones_are_zeros)
9191
self._string_engines[channel_key] = formula_engine

0 commit comments

Comments
 (0)