mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Replace *args and **kwargs type hint collections with value types (#54955)
This commit is contained in:
parent
726acc38c6
commit
de6e7ea016
@ -201,7 +201,7 @@ class ValveControllerSwitch(ValveControllerEntity, SwitchEntity):
|
||||
except GuardianError as err:
|
||||
LOGGER.error("Error while upgrading firmware: %s", err)
|
||||
|
||||
async def async_turn_off(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the valve off (closed)."""
|
||||
try:
|
||||
async with self._client:
|
||||
@ -213,7 +213,7 @@ class ValveControllerSwitch(ValveControllerEntity, SwitchEntity):
|
||||
self._attr_is_on = False
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_turn_on(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the valve on (open)."""
|
||||
try:
|
||||
async with self._client:
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import cast
|
||||
from typing import Any, cast
|
||||
|
||||
import pyatmo
|
||||
import voluptuous as vol
|
||||
@ -439,7 +439,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity):
|
||||
"""Return a list of available preset modes."""
|
||||
return SUPPORT_PRESET
|
||||
|
||||
async def async_set_temperature(self, **kwargs: dict) -> None:
|
||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||
"""Set new target temperature for 2 hours."""
|
||||
temp = kwargs.get(ATTR_TEMPERATURE)
|
||||
if temp is None:
|
||||
@ -589,7 +589,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity):
|
||||
|
||||
return {}
|
||||
|
||||
async def _async_service_set_schedule(self, **kwargs: dict) -> None:
|
||||
async def _async_service_set_schedule(self, **kwargs: Any) -> None:
|
||||
schedule_name = kwargs.get(ATTR_SCHEDULE_NAME)
|
||||
schedule_id = None
|
||||
for sid, name in self.hass.data[DOMAIN][DATA_SCHEDULES][self._home_id].items():
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import cast
|
||||
from typing import Any, cast
|
||||
|
||||
import pyatmo
|
||||
|
||||
@ -141,7 +141,7 @@ class NetatmoLight(NetatmoBase, LightEntity):
|
||||
"""Return true if light is on."""
|
||||
return self._is_on
|
||||
|
||||
async def async_turn_on(self, **kwargs: dict) -> None:
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn camera floodlight on."""
|
||||
_LOGGER.debug("Turn camera '%s' on", self.name)
|
||||
await self._data.async_set_state(
|
||||
@ -150,7 +150,7 @@ class NetatmoLight(NetatmoBase, LightEntity):
|
||||
floodlight="on",
|
||||
)
|
||||
|
||||
async def async_turn_off(self, **kwargs: dict) -> None:
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn camera floodlight into auto mode."""
|
||||
_LOGGER.debug("Turn camera '%s' to auto mode", self.name)
|
||||
await self._data.async_set_state(
|
||||
|
@ -313,13 +313,13 @@ class RainMachineProgram(RainMachineSwitch):
|
||||
"""Return a list of active zones associated with this program."""
|
||||
return [z for z in self._data["wateringTimes"] if z["active"]]
|
||||
|
||||
async def async_turn_off(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the program off."""
|
||||
await self._async_run_switch_coroutine(
|
||||
self._controller.programs.stop(self._uid)
|
||||
)
|
||||
|
||||
async def async_turn_on(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the program on."""
|
||||
await self._async_run_switch_coroutine(
|
||||
self._controller.programs.start(self._uid)
|
||||
@ -353,11 +353,11 @@ class RainMachineProgram(RainMachineSwitch):
|
||||
class RainMachineZone(RainMachineSwitch):
|
||||
"""A RainMachine zone."""
|
||||
|
||||
async def async_turn_off(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the zone off."""
|
||||
await self._async_run_switch_coroutine(self._controller.zones.stop(self._uid))
|
||||
|
||||
async def async_turn_on(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the zone on."""
|
||||
await self._async_run_switch_coroutine(
|
||||
self._controller.zones.start(
|
||||
|
@ -46,7 +46,7 @@ class SimpliSafeLock(SimpliSafeEntity, LockEntity):
|
||||
|
||||
self._lock = lock
|
||||
|
||||
async def async_lock(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_lock(self, **kwargs: Any) -> None:
|
||||
"""Lock the lock."""
|
||||
try:
|
||||
await self._lock.lock()
|
||||
@ -57,7 +57,7 @@ class SimpliSafeLock(SimpliSafeEntity, LockEntity):
|
||||
self._attr_is_locked = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_unlock(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_unlock(self, **kwargs: Any) -> None:
|
||||
"""Unlock the lock."""
|
||||
try:
|
||||
await self._lock.unlock()
|
||||
|
@ -137,13 +137,13 @@ class SwitcherBaseSwitchEntity(CoordinatorEntity, SwitchEntity):
|
||||
|
||||
return bool(self.wrapper.data.device_state == DeviceState.ON)
|
||||
|
||||
async def async_turn_on(self, **kwargs: dict) -> None:
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the entity on."""
|
||||
await self._async_call_api("control_device", Command.ON)
|
||||
self.control_result = True
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_turn_off(self, **kwargs: dict) -> None:
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the entity off."""
|
||||
await self._async_call_api("control_device", Command.OFF)
|
||||
self.control_result = False
|
||||
|
@ -103,9 +103,7 @@ class ZWaveLock(ZWaveBaseEntity, LockEntity):
|
||||
]
|
||||
) == int(self.info.primary_value.value)
|
||||
|
||||
async def _set_lock_state(
|
||||
self, target_state: str, **kwargs: dict[str, Any]
|
||||
) -> None:
|
||||
async def _set_lock_state(self, target_state: str, **kwargs: Any) -> None:
|
||||
"""Set the lock state."""
|
||||
target_value: ZwaveValue = self.get_zwave_value(
|
||||
LOCK_CMD_CLASS_TO_PROPERTY_MAP[self.info.primary_value.command_class]
|
||||
@ -116,11 +114,11 @@ class ZWaveLock(ZWaveBaseEntity, LockEntity):
|
||||
STATE_TO_ZWAVE_MAP[self.info.primary_value.command_class][target_state],
|
||||
)
|
||||
|
||||
async def async_lock(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_lock(self, **kwargs: Any) -> None:
|
||||
"""Lock the lock."""
|
||||
await self._set_lock_state(STATE_LOCKED)
|
||||
|
||||
async def async_unlock(self, **kwargs: dict[str, Any]) -> None:
|
||||
async def async_unlock(self, **kwargs: Any) -> None:
|
||||
"""Unlock the lock."""
|
||||
await self._set_lock_state(STATE_UNLOCKED)
|
||||
|
||||
|
@ -87,7 +87,7 @@ def deprecated_class(replacement: str) -> Any:
|
||||
"""Decorate class as deprecated."""
|
||||
|
||||
@functools.wraps(cls)
|
||||
def deprecated_cls(*args: tuple, **kwargs: dict[str, Any]) -> Any:
|
||||
def deprecated_cls(*args: Any, **kwargs: Any) -> Any:
|
||||
"""Wrap for the original class."""
|
||||
_print_deprecation_warning(cls, replacement, "class")
|
||||
return cls(*args, **kwargs)
|
||||
@ -104,7 +104,7 @@ def deprecated_function(replacement: str) -> Callable[..., Callable]:
|
||||
"""Decorate function as deprecated."""
|
||||
|
||||
@functools.wraps(func)
|
||||
def deprecated_func(*args: tuple, **kwargs: dict[str, Any]) -> Any:
|
||||
def deprecated_func(*args: Any, **kwargs: Any) -> Any:
|
||||
"""Wrap for the original function."""
|
||||
_print_deprecation_warning(func, replacement, "function")
|
||||
return func(*args, **kwargs)
|
||||
|
@ -151,7 +151,7 @@ def gen_result_wrapper(kls):
|
||||
class Wrapper(kls, ResultWrapper):
|
||||
"""Wrapper of a kls that can store render_result."""
|
||||
|
||||
def __init__(self, *args: tuple, render_result: str | None = None) -> None:
|
||||
def __init__(self, *args: Any, render_result: str | None = None) -> None:
|
||||
super().__init__(*args)
|
||||
self.render_result = render_result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user