Skip to content

Commit 22a87e0

Browse files
indykoningsteinmn
andauthored
Only import OpenApiV1 when type checking
Co-authored-by: steinmn <46349253+steinmn@users.noreply.github.com>
1 parent 170c6c9 commit 22a87e0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

growattServer/open_api_v1/devices/abstract_device.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
"""Abstract device file for centralising shared device logic."""
2-
from typing import TypedDict
2+
from typing import TYPE_CHECKING, TypedDict
33

44
from growattServer.exceptions import GrowattParameterError
5-
from growattServer.open_api_v1 import OpenApiV1
5+
6+
if TYPE_CHECKING:
7+
from growattServer.open_api_v1 import OpenApiV1
68

79

810
class ReadParamResponse(TypedDict):
@@ -15,7 +17,7 @@ class ReadParamResponse(TypedDict):
1517
class AbstractDevice:
1618
"""Abstract device type. Must not be used directly."""
1719

18-
def __init__(self, api: OpenApiV1, device_sn: str) -> None:
20+
def __init__(self, api: "OpenApiV1", device_sn: str) -> None:
1921
"""
2022
Initialize the device with the bare minimum being the device_sn.
2123

0 commit comments

Comments
 (0)