Skip to content

Commit f3034fc

Browse files
committed
helper.py: add & improve typing hints
1 parent 3874487 commit f3034fc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

plugwise/helper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def schemas_schedule_temp(schedules: dict[str, Any], name: str) -> float | None:
126126
return schema_list[i][2]
127127

128128

129-
def types_finder(data: etree) -> set:
129+
def types_finder(data: etree) -> set[str]:
130130
"""Detect types within locations from logs."""
131131
types = set()
132132
for measure, attrs in HOME_MEASUREMENTS.items():
@@ -414,7 +414,7 @@ def _get_module_data(
414414
"""Helper-function for _energy_device_info_finder() and _appliance_info_finder().
415415
Collect requested info from MODULES.
416416
"""
417-
model_data = {
417+
model_data: dict[str, Any] = {
418418
"contents": False,
419419
"vendor_name": None,
420420
"vendor_model": None,
@@ -1018,8 +1018,8 @@ def _heating_valves(self) -> int | None:
10181018
Collect amount of open valves indicating active direct heating.
10191019
For cases where the heat is provided from an external shared source (city heating).
10201020
"""
1021-
loc_found = 0
1022-
open_valve_count = 0
1021+
loc_found: int = 0
1022+
open_valve_count: int = 0
10231023
for appliance in self._appliances.findall("./appliance"):
10241024
locator = './logs/point_log[type="valve_position"]/period/measurement'
10251025
if (appl_loc := appliance.find(locator)) is not None:
@@ -1077,8 +1077,8 @@ def _power_data_from_location(self, loc_id: str) -> dict[str, Any] | None:
10771077
return
10781078

10791079
search = self._locations
1080-
log_list = ["point_log", "cumulative_log", "interval_log"]
1081-
peak_list = ["nl_peak", "nl_offpeak"]
1080+
log_list: list[str] = ["point_log", "cumulative_log", "interval_log"]
1081+
peak_list: list[str] = ["nl_peak", "nl_offpeak"]
10821082
t_string = "tariff"
10831083
if self._smile_legacy:
10841084
t_string = "tariff_indicator"
@@ -1153,7 +1153,7 @@ def _schemas(self, location: str) -> tuple[str, ...]:
11531153
Obtain the available schemas/schedules. Adam: a schedule can be connected to more than one location.
11541154
NEW: when a location_id is present then the schedule is active. Valid for both Adam and non-legacy Anna.
11551155
"""
1156-
available = ["None"]
1156+
available: list[str] = ["None"]
11571157
last_used: str | None = None
11581158
rule_ids: dict[str] = {}
11591159
schedule_temperature: str | None = None
@@ -1233,7 +1233,7 @@ def _last_used_schedule(self, loc_id: str, rule_ids: dict[str]) -> str | None:
12331233

12341234
return last_used
12351235

1236-
def _object_value(self, obj_id: str, measurement: str) -> float | int | bool | None:
1236+
def _object_value(self, obj_id: str, measurement: str) -> float | int | None:
12371237
"""Helper-function for smile.py: _get_device_data() and _device_data_anna().
12381238
Obtain the value/state for the given object from DOMAIN_OBJECTS.
12391239
"""

0 commit comments

Comments
 (0)