Skip to content

Commit

Permalink
fix: add typings to update_with methods
Browse files Browse the repository at this point in the history
  • Loading branch information
muhlba91 committed Dec 14, 2023
1 parent e560027 commit 4dd841c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion onyx_client/data/animation_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create(properties: dict):
],
)

def update_with(self, other: Optional):
def update_with(self, other: Optional["AnimationValue"]):
"""Updates this value with the target.
other: the other value"""
Expand Down
2 changes: 1 addition & 1 deletion onyx_client/data/boolean_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create(properties: dict):
properties.get("read_only", "false") == "true",
)

def update_with(self, other: Optional):
def update_with(self, other: Optional["BooleanValue"]):
"""Updates this value with the target.
other: the other value"""
Expand Down
2 changes: 1 addition & 1 deletion onyx_client/data/numeric_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create(properties: dict):
AnimationValue.create(properties.get("animation", None)),
)

def update_with(self, other: Optional):
def update_with(self, other: Optional["NumericValue"]):
"""Updates this value with the target.
other: the other value"""
Expand Down
4 changes: 3 additions & 1 deletion onyx_client/device/device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Device class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.enum.device_type import DeviceType
from onyx_client.exception.update_exception import UpdateException
Expand Down Expand Up @@ -37,7 +39,7 @@ def __eq__(self, other):
return self.identifier == other.identifier
return False

def update_with(self, update):
def update_with(self, update: Optional["Device"]):
"""Update the device with an update patch.
update: the update patch"""
Expand Down
4 changes: 3 additions & 1 deletion onyx_client/device/light.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Light class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.device import Device
Expand Down Expand Up @@ -37,7 +39,7 @@ def __init__(
def __str__(self):
return f"Light({super().__str__()}, actual_brightness={self.actual_brightness}, target_brightness={self.target_brightness}, dim_duration={self.dim_duration})"

def update_with(self, update):
def update_with(self, update: Optional["Light"]):
"""Update the device with a patch.
update: the update patch"""
Expand Down
4 changes: 3 additions & 1 deletion onyx_client/device/shutter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Shutter class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.device import Device
Expand Down Expand Up @@ -56,7 +58,7 @@ def __init__(
def __str__(self):
return f"Shutter({super().__str__()}, actual_position={self.actual_position}, actual_angle={self.actual_angle}, target_position={self.target_position}, target_angle={self.target_angle})"

def update_with(self, update):
def update_with(self, update: Optional["Shutter"]):
"""Update the device with an update patch.
update: the update patch"""
Expand Down
4 changes: 3 additions & 1 deletion onyx_client/device/switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Switch class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.device.device import Device
from onyx_client.enum.device_type import DeviceType
Expand All @@ -21,7 +23,7 @@ def __init__(self, identifier: str, name: str, device_type: DeviceType):
list(),
)

def update_with(self, update):
def update_with(self, update: Optional["Switch"]):
"""Update the device with an update patch.
update: the update patch"""
Expand Down
4 changes: 3 additions & 1 deletion onyx_client/device/weather.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Weather class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.device import Device
Expand Down Expand Up @@ -47,7 +49,7 @@ def __init__(
def __str__(self):
return f"Weather({super().__str__()}, wind_peak={self.wind_peak}, sun_brightness_peak={self.sun_brightness_peak}, sun_brightness_sink={self.sun_brightness_sink}, air_pressure={self.air_pressure}, humidity={self.humidity}, temperature={self.temperature})"

def update_with(self, update):
def update_with(self, update: Optional["Weather"]):
"""Update the device with an update patch.
update: the update patch"""
Expand Down

0 comments on commit 4dd841c

Please sign in to comment.