Skip to content

Commit 7fe1e1e

Browse files
committed
Rename _get_all() to _get_all_from_map()
The new name is more precise, that way we can use it in other modules without causing too much confusion. Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 93ee7e8 commit 7fe1e1e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
_logger = logging.getLogger(__name__)
5050

5151

52-
def _get_all(source: dict[int, frozenset[int]], keys: abc.Set[int]) -> set[int]:
52+
def _get_all_from_map(
53+
source: dict[int, frozenset[int]], keys: abc.Set[int]
54+
) -> set[int]:
5355
"""Get all values for the given keys from the given map.
5456
5557
Args:
@@ -338,7 +340,7 @@ def _get_power_distribution(
338340
Returns:
339341
the power distribution result.
340342
"""
341-
available_bat_ids = _get_all(
343+
available_bat_ids = _get_all_from_map(
342344
self._bat_bats_map, {pair.battery.component_id for pair in inv_bat_pairs}
343345
)
344346

@@ -495,16 +497,18 @@ def _get_components_data(self, batteries: abc.Set[int]) -> list[InvBatPair]:
495497
f"available batteries: {list(self._battery_receivers.keys())}"
496498
)
497499

498-
connected_inverters = _get_all(self._bat_inv_map, batteries)
500+
connected_inverters = _get_all_from_map(self._bat_invs_map, batteries)
499501

500502
# Check to see if inverters are involved that are connected to batteries
501503
# that were not requested.
502-
batteries_from_inverters = _get_all(self._inv_bat_map, connected_inverters)
504+
batteries_from_inverters = _get_all_from_map(
505+
self._inv_bats_map, connected_inverters
506+
)
503507

504508
if batteries_from_inverters != batteries:
505509
extra_batteries = batteries_from_inverters - batteries
506510
raise KeyError(
507-
f"Inverters {_get_all(self._bat_inv_map, extra_batteries)} "
511+
f"Inverters {_get_all_from_map(self._bat_invs_map, extra_batteries)} "
508512
f"are connected to batteries that were not requested: {extra_batteries}"
509513
)
510514

0 commit comments

Comments
 (0)