@@ -22,13 +22,13 @@ class _BaseResultMixin:
2222
2323@dataclasses .dataclass
2424class _BaseSuccessMixin :
25- """Result returned when setting the power succeed for all batteries ."""
25+ """Result returned when setting the power succeed for all components ."""
2626
2727 succeeded_power : Power
2828 """The part of the requested power that was successfully set."""
2929
30- succeeded_batteries : abc .Set [int ]
31- """The subset of batteries for which power was set successfully."""
30+ succeeded_components : abc .Set [int ]
31+ """The subset of components for which power was set successfully."""
3232
3333 excess_power : Power
3434 """The part of the requested power that could not be fulfilled.
@@ -45,17 +45,17 @@ class _BaseSuccessMixin:
4545
4646@dataclasses .dataclass
4747class Success (_BaseSuccessMixin , _BaseResultMixin ): # Order matters here. See above.
48- """Result returned when setting the power succeeded for all batteries ."""
48+ """Result returned when setting the power was successful for all components ."""
4949
5050
5151@dataclasses .dataclass
5252class PartialFailure (_BaseSuccessMixin , _BaseResultMixin ):
53- """Result returned when any battery failed to perform the request ."""
53+ """Result returned when some of the components had an error setting the power ."""
5454
5555 failed_power : Power
5656 """The part of the requested power that failed to be set."""
5757
58- failed_batteries : abc .Set [int ]
58+ failed_components : abc .Set [int ]
5959 """The subset of batteries for which the request failed."""
6060
6161
@@ -69,31 +69,31 @@ class Error(_BaseResultMixin):
6969
7070@dataclasses .dataclass
7171class PowerBounds :
72- """Inclusion and exclusion power bounds for requested batteries ."""
72+ """Inclusion and exclusion power bounds for the requested components ."""
7373
7474 inclusion_lower : float
75- """The lower value of the inclusion power bounds for the requested batteries ."""
75+ """The lower value of the inclusion power bounds for the requested components ."""
7676
7777 exclusion_lower : float
78- """The lower value of the exclusion power bounds for the requested batteries ."""
78+ """The lower value of the exclusion power bounds for the requested components ."""
7979
8080 exclusion_upper : float
81- """The upper value of the exclusion power bounds for the requested batteries ."""
81+ """The upper value of the exclusion power bounds for the requested components ."""
8282
8383 inclusion_upper : float
84- """The upper value of the inclusion power bounds for the requested batteries ."""
84+ """The upper value of the inclusion power bounds for the requested components ."""
8585
8686
8787@dataclasses .dataclass
8888class OutOfBounds (_BaseResultMixin ):
8989 """Result returned when the power was not set because it was out of bounds.
9090
9191 This result happens when the originating request was done with
92- `adjust_power = False` and the requested power is not within the batteries bounds.
92+ `adjust_power = False` and the requested power is not within the available bounds.
9393 """
9494
9595 bounds : PowerBounds
96- """The power bounds for the requested batteries .
96+ """The power bounds for the requested components .
9797
9898 If the requested power negative, then this value is the lower bound.
9999 Otherwise it is upper bound.
@@ -135,26 +135,26 @@ def handle_power_request_result(result: Result) -> None:
135135 request = Request(
136136 namespace="TestChannel",
137137 power=Power.from_watts(123.4),
138- batteries ={8, 18},
138+ component_ids ={8, 18},
139139 )
140140
141141 results: list[Result] = [
142142 Success(
143143 request,
144144 succeeded_power=Power.from_watts(123.4),
145- succeeded_batteries ={8, 18},
145+ succeeded_components ={8, 18},
146146 excess_power=Power.zero(),
147147 ),
148148 PartialFailure(
149149 request,
150150 succeeded_power=Power.from_watts(103.4),
151- succeeded_batteries ={8},
151+ succeeded_components ={8},
152152 excess_power=Power.zero(),
153- failed_batteries ={18},
153+ failed_components ={18},
154154 failed_power=Power.from_watts(20.0),
155155 ),
156156 OutOfBounds(request, bounds=PowerBounds(0, 0, 0, 800)),
157- Error(request, msg="The batteries are not available"),
157+ Error(request, msg="The components are not available"),
158158 ]
159159
160160 for r in results:
0 commit comments