Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
flz committed Jul 6, 2024
1 parent dbf112c commit 99de7a1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/iaqualink/systems/exo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from . import device, system
from iaqualink.systems.exo import device, system

__all__ = ["device", "system"]
13 changes: 6 additions & 7 deletions src/iaqualink/systems/exo/device.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import annotations

import logging
from collections.abc import Callable
from enum import Enum, unique
from typing import TYPE_CHECKING, Any, Coroutine, Type, cast
from typing import TYPE_CHECKING, Any, cast

from iaqualink.device import (
AqualinkDevice,
Expand All @@ -12,10 +11,12 @@
AqualinkThermostat,
)
from iaqualink.exception import AqualinkInvalidParameterException
from iaqualink.typing import DeviceData

if TYPE_CHECKING:
from collections.abc import Callable, Coroutine

from iaqualink.systems.exo.system import ExoSystem
from iaqualink.typing import DeviceData

EXO_TEMP_CELSIUS_LOW = 1
EXO_TEMP_CELSIUS_HIGH = 40
Expand Down Expand Up @@ -59,7 +60,7 @@ def model(self) -> str:

@classmethod
def from_data(cls, system: ExoSystem, data: DeviceData) -> ExoDevice:
class_: Type[ExoDevice]
class_: type[ExoDevice]

if data["name"].startswith("aux_"):
class_ = ExoAuxSwitch
Expand Down Expand Up @@ -94,16 +95,14 @@ def label(self) -> str:

@property
def name(self) -> str:
# XXX - We're using the label as name rather than "sns_#".
# XXX: We're using the label as name rather than "sns_#".
# Might revisit later.
return self.data["sensor_type"].lower().replace(" ", "_")


class ExoAttributeSensor(ExoDevice, AqualinkSensor):
"""These sensors are a simple key/value in equipment->swc_0."""

pass


# This is an abstract class, not to be instantiated directly.
class ExoSwitch(ExoDevice, AqualinkSwitch):
Expand Down
15 changes: 8 additions & 7 deletions src/iaqualink/systems/exo/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import logging
import time
from typing import TYPE_CHECKING, Any, Dict

import httpx
from typing import TYPE_CHECKING, Any

from iaqualink.const import MIN_SECS_TO_REFRESH
from iaqualink.exception import (
Expand All @@ -13,10 +11,12 @@
)
from iaqualink.system import AqualinkSystem
from iaqualink.systems.exo.device import ExoDevice
from iaqualink.typing import Payload

if TYPE_CHECKING:
import httpx

from iaqualink.client import AqualinkClient
from iaqualink.typing import Payload

EXO_DEVICES_URL = "https://prod.zodiac-io.com/devices/v1"

Expand All @@ -29,10 +29,12 @@ class ExoSystem(AqualinkSystem):

def __init__(self, aqualink: AqualinkClient, data: Payload):
super().__init__(aqualink, data)
# This lives in the parent class but mypy complains.
self.last_refresh: int = 0

def __repr__(self) -> str:
attrs = ["name", "serial", "data"]
attrs = ["%s=%r" % (i, getattr(self, i)) for i in attrs]
attrs = [f"{i}={getattr(self, i)!r}" for i in attrs]
return f'{self.__class__.__name__}({" ".join(attrs)})'

async def send_devices_request(self, **kwargs: Any) -> httpx.Response:
Expand All @@ -44,7 +46,7 @@ async def send_reported_state_request(self) -> httpx.Response:
return await self.send_devices_request()

async def send_desired_state_request(
self, state: Dict[str, Any]
self, state: dict[str, Any]
) -> httpx.Response:
return await self.send_devices_request(
method="post", json={"state": {"desired": state}}
Expand Down Expand Up @@ -103,7 +105,6 @@ def _parse_shadow_response(self, response: httpx.Response) -> None:
devices.update({name: attrs})

LOGGER.debug(f"devices: {devices}")
print(devices)

for k, v in devices.items():
if k in self.devices:
Expand Down

0 comments on commit 99de7a1

Please sign in to comment.