Skip to content

Commit fe57721

Browse files
committed
Rename _battery_status.py → _battery_status_tracker.py
Also rename `BatteryStatusTracker`'s argument `battery_id` → `component_id`. Signed-off-by: Sahas Subramanian <[email protected]>
1 parent 979271d commit fe57721

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/frequenz/sdk/actor/power_distributing/_battery_status.py renamed to src/frequenz/sdk/actor/power_distributing/_battery_status_tracker.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class BatteryStatusTracker:
170170

171171
def __init__( # pylint: disable=too-many-arguments
172172
self,
173-
battery_id: int,
173+
component_id: int,
174174
max_data_age_sec: float,
175175
max_blocking_duration_sec: float,
176176
status_sender: Sender[ComponentStatus],
@@ -179,7 +179,7 @@ def __init__( # pylint: disable=too-many-arguments
179179
"""Create class instance.
180180
181181
Args:
182-
battery_id: Id of this battery
182+
component_id: Id of this battery
183183
max_data_age_sec: If component stopped sending data, then
184184
this is the maximum time when its last message should be considered as
185185
valid. After that time, component won't be used until it starts sending
@@ -201,12 +201,14 @@ def __init__( # pylint: disable=too-many-arguments
201201
1.0, max_blocking_duration_sec
202202
)
203203

204-
inverter_id = self._find_adjacent_inverter_id(battery_id)
204+
inverter_id = self._find_adjacent_inverter_id(component_id)
205205
if inverter_id is None:
206-
raise RuntimeError(f"Can't find inverter adjacent to battery: {battery_id}")
206+
raise RuntimeError(
207+
f"Can't find inverter adjacent to battery: {component_id}"
208+
)
207209

208210
self._battery: _ComponentStreamStatus = _ComponentStreamStatus(
209-
battery_id,
211+
component_id,
210212
data_recv_timer=Timer.timeout(timedelta(seconds=max_data_age_sec)),
211213
)
212214
self._inverter: _ComponentStreamStatus = _ComponentStreamStatus(

src/frequenz/sdk/actor/power_distributing/_component_pool_status_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from frequenz.channels.util import Merge
1313

1414
from ..._internal._asyncio import cancel_and_await
15-
from ._battery_status import BatteryStatusTracker, SetPowerResult
15+
from ._battery_status_tracker import BatteryStatusTracker, SetPowerResult
1616
from ._component_status import ComponentPoolStatus, ComponentStatus, ComponentStatusEnum
1717

1818
_logger = logging.getLogger(__name__)
@@ -93,7 +93,7 @@ def _make_merged_status_receiver(
9393
f"component_{component_id}_status"
9494
)
9595
tracker = BatteryStatusTracker(
96-
battery_id=component_id,
96+
component_id=component_id,
9797
max_data_age_sec=self._max_data_age_sec,
9898
max_blocking_duration_sec=self._max_blocking_duration_sec,
9999
status_sender=channel.new_sender(),

tests/actor/test_battery_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from frequenz.channels import Broadcast, Receiver
2929
from pytest_mock import MockerFixture
3030

31-
from frequenz.sdk.actor.power_distributing._battery_status import (
31+
from frequenz.sdk.actor.power_distributing._battery_status_tracker import (
3232
BatteryStatusTracker,
3333
SetPowerResult,
3434
)

0 commit comments

Comments
 (0)