Skip to content

Commit ae36b7b

Browse files
committed
Rename internal protocols and generic types for clarity
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
1 parent 2f1bd68 commit ae36b7b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/frequenz/client/reporting/_types.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ class MetricSample(NamedTuple):
7373
)
7474

7575

76-
class _PbMgTelem(Protocol):
76+
class _PbMicrogridTelem(Protocol):
7777
"""Protocol for microgrid telemetry from the Reporting API client."""
7878

7979
@property
8080
def microgrid_id(self) -> int:
8181
"""Return the microgrid ID of the telemetry batch."""
8282

8383

84-
class _PbTelem(Protocol):
84+
class _PbComponentTelem(Protocol):
8585
"""Protocol for telemetry items in the Reporting API client."""
8686

8787
@property
@@ -93,15 +93,15 @@ def state_snapshots(self) -> MutableSequence[Any]:
9393
"""List of state snapshots associated with this telemetry item."""
9494

9595

96-
_MgTelemT = TypeVar("_MgTelemT", bound=_PbMgTelem)
97-
_TelemT = TypeVar("_TelemT", bound=_PbTelem)
96+
_MicrogridTelemT = TypeVar("_MicrogridTelemT", bound=_PbMicrogridTelem)
97+
_ComponentTelemT = TypeVar("_ComponentTelemT", bound=_PbComponentTelem)
9898
_StateSnapshotT = TypeVar(
9999
"_StateSnapshotT", bound=PbElectricalComponentStateSnapshot | PbSensorStateSnapshot
100100
)
101101

102102

103103
@dataclass(frozen=True)
104-
class GenericDataBatch(Generic[_MgTelemT, _TelemT, _StateSnapshotT]):
104+
class GenericDataBatch(Generic[_MicrogridTelemT, _ComponentTelemT, _StateSnapshotT]):
105105
"""Base class for batches of microgrid data (components or sensors).
106106
107107
This class serves as a base for handling batches of data related to microgrid
@@ -110,9 +110,9 @@ class GenericDataBatch(Generic[_MgTelemT, _TelemT, _StateSnapshotT]):
110110
functionality to work with bounds if applicable.
111111
"""
112112

113-
_data_pb: _MgTelemT
114-
id_fetcher: Callable[[_TelemT], int]
115-
items_fetcher: Callable[[_MgTelemT], MutableSequence[_TelemT]]
113+
_data_pb: _MicrogridTelemT
114+
id_fetcher: Callable[[_ComponentTelemT], int]
115+
items_fetcher: Callable[[_MicrogridTelemT], MutableSequence[_ComponentTelemT]]
116116
has_bounds: bool = False
117117

118118
def is_empty(self) -> bool:

0 commit comments

Comments
 (0)