File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/frequenz/sdk/microgrid/component Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 22# Copyright © 2022 Frequenz Energy-as-a-Service GmbH
33
44"""Defines the components that can be used in a microgrid."""
5+ from __future__ import annotations
56
67from dataclasses import dataclass
78from enum import Enum
9+ from typing import TYPE_CHECKING
810
911import frequenz .api .common .components_pb2 as components_pb
1012import frequenz .api .microgrid .grid_pb2 as grid_pb
1113import frequenz .api .microgrid .inverter_pb2 as inverter_pb
1214
13- from ...timeseries import Current , Fuse
15+ if TYPE_CHECKING :
16+ # Break circular import by enclosing these type hints in a `TYPE_CHECKING` block.
17+ from ...timeseries import Fuse
1418
1519
1620class ComponentType (Enum ):
@@ -139,6 +143,8 @@ def _component_metadata_from_protobuf(
139143 component_category : components_pb .ComponentCategory .ValueType ,
140144 component_metadata : grid_pb .Metadata ,
141145) -> GridMetadata | None :
146+ from ...timeseries import Current , Fuse # pylint: disable=import-outside-toplevel
147+
142148 if component_category == components_pb .ComponentCategory .COMPONENT_CATEGORY_GRID :
143149 max_current = Current .from_amperes (component_metadata .rated_fuse_current )
144150 fuse = Fuse (max_current )
You can’t perform that action at this time.
0 commit comments