Skip to content

Commit 3d8f31c

Browse files
Move Fuse to timeseries module
The Grid class is the only class that uses `Fuse` as it is used to represent the fuse of a grid. It is not a microgrid-specific class. Therefore, it is moved to the timeseries module. Signed-off-by: Daniel Zullo <[email protected]>
1 parent 0e19bf4 commit 3d8f31c

File tree

9 files changed

+15
-12
lines changed

9 files changed

+15
-12
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
- The `BatteryPool.power_status` method now streams objects of type `BatteryPoolReport`. They're identical to the previous `Report` objects, except for the name of the class.
1010

11+
- The `Fuse` class has been moved to the `frequenz.sdk.timeseries` module.
12+
1113
## New Features
1214

1315
<!-- Here goes the main new features and examples or instructions on how to use them -->

src/frequenz/sdk/microgrid/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124

125125
from ..actor import ResamplerConfig
126126
from ..timeseries.grid import initialize as initialize_grid
127-
from . import _data_pipeline, client, component, connection_manager, fuse, metadata
127+
from . import _data_pipeline, client, component, connection_manager, metadata
128128
from ._data_pipeline import (
129129
battery_pool,
130130
ev_charger_pool,
@@ -157,7 +157,6 @@ async def initialize(host: str, port: int, resampler_config: ResamplerConfig) ->
157157
"component",
158158
"battery_pool",
159159
"ev_charger_pool",
160-
"fuse",
161160
"grid",
162161
"frequency",
163162
"logical_meter",

src/frequenz/sdk/microgrid/component/_component.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import frequenz.api.microgrid.grid_pb2 as grid_pb
1111
import frequenz.api.microgrid.inverter_pb2 as inverter_pb
1212

13-
from ...timeseries import Current
14-
from ..fuse import Fuse
13+
from ...timeseries import Current, Fuse
1514

1615

1716
class ComponentType(Enum):

src/frequenz/sdk/timeseries/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
from .._internal._channels import ReceiverFetcher
3939
from ._base_types import UNIX_EPOCH, Bounds, Sample, Sample3Phase
40+
from ._fuse import Fuse
4041
from ._moving_window import MovingWindow
4142
from ._periodic_feature_extractor import PeriodicFeatureExtractor
4243
from ._quantities import (
@@ -53,6 +54,7 @@
5354

5455
__all__ = [
5556
"Bounds",
57+
"Fuse",
5658
"MovingWindow",
5759
"PeriodicFeatureExtractor",
5860
"ResamplerConfig",
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH
33

44
"""Fuse data class."""
5+
from __future__ import annotations
56

67
from dataclasses import dataclass
8+
from typing import TYPE_CHECKING
79

8-
from ..timeseries import Current
10+
if TYPE_CHECKING:
11+
# Break circular import by enclosing these type hints in a `TYPE_CHECKING` block.
12+
from . import Current
913

1014

1115
@dataclass(frozen=True)

src/frequenz/sdk/timeseries/grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from ..microgrid.component import Component
1515
from ..microgrid.component._component import ComponentCategory
16-
from ..microgrid.fuse import Fuse
16+
from . import Fuse
1717

1818
_logger = logging.getLogger(__name__)
1919

tests/microgrid/test_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
InverterType,
2727
MeterData,
2828
)
29-
from frequenz.sdk.microgrid.fuse import Fuse
30-
from frequenz.sdk.timeseries import Current
29+
from frequenz.sdk.timeseries import Current, Fuse
3130

3231
from . import mock_api
3332

tests/microgrid/test_graph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
GridMetadata,
2222
InverterType,
2323
)
24-
from frequenz.sdk.microgrid.fuse import Fuse
25-
from frequenz.sdk.timeseries import Current
24+
from frequenz.sdk.timeseries import Current, Fuse
2625

2726
from .mock_api import MockGrpcServer, MockMicrogridServicer
2827

tests/microgrid/test_grid.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"""Tests for the `Grid` module."""
55

66
from frequenz.sdk.microgrid.component import Component, ComponentCategory, GridMetadata
7-
from frequenz.sdk.microgrid.fuse import Fuse
8-
from frequenz.sdk.timeseries import Current
7+
from frequenz.sdk.timeseries import Current, Fuse
98
from frequenz.sdk.timeseries import grid as _grid
109

1110

0 commit comments

Comments
 (0)