Enable ruff check for ANN (#1139)

This commit is contained in:
Teemu R.
2024-11-10 19:55:13 +01:00
committed by GitHub
parent 6b44fe6242
commit 66eb17057e
89 changed files with 596 additions and 452 deletions

View File

@@ -16,7 +16,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
REQUIRED_COMPONENT = "light_strip_lighting_effect"
def __init__(self, device: SmartDevice, module: str):
def __init__(self, device: SmartDevice, module: str) -> None:
super().__init__(device, module)
effect_list = [self.LIGHT_EFFECTS_OFF]
effect_list.extend(EFFECT_NAMES)
@@ -66,7 +66,9 @@ class LightStripEffect(SmartModule, SmartLightEffect):
eff = self.data["lighting_effect"]
return eff["brightness"]
async def set_brightness(self, brightness: int, *, transition: int | None = None):
async def set_brightness(
self, brightness: int, *, transition: int | None = None
) -> dict:
"""Set effect brightness."""
if brightness <= 0:
return await self.set_effect(self.LIGHT_EFFECTS_OFF)
@@ -91,7 +93,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
*,
brightness: int | None = None,
transition: int | None = None,
) -> None:
) -> dict:
"""Set an effect on the device.
If brightness or transition is defined,
@@ -115,8 +117,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
effect_dict = self._effect_mapping["Aurora"]
effect_dict = {**effect_dict}
effect_dict["enable"] = 0
await self.set_custom_effect(effect_dict)
return
return await self.set_custom_effect(effect_dict)
if effect not in self._effect_mapping:
raise ValueError(f"The effect {effect} is not a built in effect.")
@@ -134,13 +135,13 @@ class LightStripEffect(SmartModule, SmartLightEffect):
if transition is not None:
effect_dict["transition"] = transition
await self.set_custom_effect(effect_dict)
return await self.set_custom_effect(effect_dict)
@allow_update_after
async def set_custom_effect(
self,
effect_dict: dict,
) -> None:
) -> dict:
"""Set a custom effect on the device.
:param str effect_dict: The custom effect dict to set
@@ -155,7 +156,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
"""Return True if the device supports setting custom effects."""
return True
def query(self):
def query(self) -> dict:
"""Return the base query."""
return {}