Skip to content

Commit 2b19da6

Browse files
committed
Move typing into the called functions, import annotations
1 parent 7061525 commit 2b19da6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

plugwise/helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""Use of this source code is governed by the MIT license found in the LICENSE file.
22
Plugwise Smile protocol helpers.
33
"""
4+
from __future__ import annotations
5+
46
import asyncio
57
import datetime as dt
68
from typing import Any
@@ -750,7 +752,7 @@ def _appliance_measurements(self, appliance, data, measurements):
750752

751753
return data
752754

753-
def _get_appliance_data(self, d_id):
755+
def _get_appliance_data(self, d_id) -> dict[str, Any]:
754756
"""Helper-function for smile.py: _get_device_data().
755757
Collect the appliance-data based on device id.
756758
Determined from APPLIANCES, for legacy from DOMAIN_OBJECTS.
@@ -989,7 +991,7 @@ def _power_data_peak_value(self, loc):
989991

990992
return loc
991993

992-
def _power_data_from_location(self, loc_id):
994+
def _power_data_from_location(self, loc_id) -> dict[str, Any] | None:
993995
"""Helper-function for smile.py: _get_device_data().
994996
Collect the power-data based on Location ID.
995997
"""

plugwise/smile.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _get_device_data(self, dev_id) -> dict[str, Any]:
184184
Provide device-data, based on Location ID (= dev_id), from APPLIANCES.
185185
"""
186186
details: dict[str, Any] = self._devices.get(dev_id)
187-
device_data: dict[str, Any] = self._get_appliance_data(dev_id)
187+
device_data = self._get_appliance_data(dev_id)
188188

189189
# Generic
190190
if details["class"] == "gateway" or dev_id == self.gateway_id:
@@ -198,9 +198,7 @@ def _get_device_data(self, dev_id) -> dict[str, Any]:
198198
device_data["outdoor_temperature"] = outdoor_temperature
199199

200200
# Get P1 data from LOCATIONS
201-
power_data: dict[str, Any] | None = self._power_data_from_location(
202-
details["location"]
203-
)
201+
power_data = self._power_data_from_location(details["location"])
204202
if power_data is not None:
205203
device_data.update(power_data)
206204

0 commit comments

Comments
 (0)