Skip to content

Commit 4b2908b

Browse files
authored
Merge branch 'lint' into main
2 parents 85253bf + f1f8baa commit 4b2908b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

pyhilo/api.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from aiohttp import ClientSession
1313
from aiohttp.client_exceptions import ClientResponseError
1414
import backoff
15+
from homeassistant.helpers.config_entry_oauth2_flow import OAuth2Session
1516

1617
from pyhilo.const import (
1718
ANDROID_CLIENT_ENDPOINT,
@@ -66,7 +67,7 @@ def __init__(
6667
self,
6768
*,
6869
session: ClientSession,
69-
oauth_session,
70+
oauth_session: OAuth2Session,
7071
request_retries: int = REQUEST_RETRY,
7172
log_traces: bool = False,
7273
) -> None:
@@ -97,7 +98,7 @@ async def async_create(
9798
cls,
9899
*,
99100
session: ClientSession,
100-
oauth_session,
101+
oauth_session: OAuth2Session,
101102
request_retries: int = REQUEST_RETRY,
102103
log_traces: bool = False,
103104
) -> API:
@@ -140,7 +141,7 @@ async def async_get_access_token(self) -> str:
140141
await self._oauth_session.async_ensure_token_valid()
141142

142143
access_token = str(self._oauth_session.token["access_token"])
143-
LOG.debug("Websocket access token is %s", access_token)
144+
LOG.debug("LOCALLY Websocket access token is %s", access_token)
144145

145146
return str(self._oauth_session.token["access_token"])
146147

@@ -382,11 +383,12 @@ async def _async_post_init(self) -> None:
382383
# Create both websocket clients
383384
# ic-dev21 need to work on this as it can't lint as is, may need to
384385
# instantiate differently
385-
self.websocket_devices = WebsocketClient(self.websocket_manager.devicehub)
386+
# TODO: fix type ignore after refactor
387+
self.websocket_devices = WebsocketClient(self.websocket_manager.devicehub) # type: ignore
386388

387389
# For backward compatibility during the transition to challengehub websocket
388390
self.websocket = self.websocket_devices
389-
self.websocket_challenges = WebsocketClient(self.websocket_manager.challengehub)
391+
self.websocket_challenges = WebsocketClient(self.websocket_manager.challengehub) # type: ignore
390392

391393
async def refresh_ws_token(self) -> None:
392394
"""Refresh the websocket token."""

pyhilo/devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _map_readings_to_devices(
5555
"""Uses the dict from parse_values_received to map the values to devices."""
5656
updated_devices = []
5757
for reading in readings:
58-
device_identifier = reading.device_id
58+
device_identifier: Union[int, str] = reading.device_id
5959
if device_identifier == 0:
6060
device_identifier = reading.hilo_id
6161
if device := self.find_device(device_identifier):
@@ -69,7 +69,7 @@ def _map_readings_to_devices(
6969
)
7070
return updated_devices
7171

72-
def find_device(self, device_identifier: int | str) -> HiloDevice:
72+
def find_device(self, device_identifier: int | str) -> HiloDevice | None:
7373
"""Makes sure the devices received have an identifier, this means some need to be hardcoded
7474
like the unknown power meter.
7575
"""

0 commit comments

Comments
 (0)