Typing tweak to the Elgato integration (#47471)
This commit is contained in:
parent
b3c33fc1be
commit
02e723f206
2 changed files with 14 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Config flow to configure the Elgato Key Light integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
from elgato import Elgato, ElgatoError
|
||||
import voluptuous as vol
|
||||
|
@ -25,8 +25,8 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
serial_number: str
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: Dict[str, Any] | None = None
|
||||
) -> Dict[str, Any]:
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
"""Handle a flow initiated by the user."""
|
||||
if user_input is None:
|
||||
return self._async_show_setup_form()
|
||||
|
@ -42,8 +42,8 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
return self._async_create_entry()
|
||||
|
||||
async def async_step_zeroconf(
|
||||
self, discovery_info: Dict[str, Any]
|
||||
) -> Dict[str, Any]:
|
||||
self, discovery_info: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
"""Handle zeroconf discovery."""
|
||||
self.host = discovery_info[CONF_HOST]
|
||||
self.port = discovery_info[CONF_PORT]
|
||||
|
@ -59,15 +59,15 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
|
||||
async def async_step_zeroconf_confirm(
|
||||
self, _: Dict[str, Any] | None = None
|
||||
) -> Dict[str, Any]:
|
||||
self, _: dict[str, Any] | None = None
|
||||
) -> dict[str, Any]:
|
||||
"""Handle a flow initiated by zeroconf."""
|
||||
return self._async_create_entry()
|
||||
|
||||
@callback
|
||||
def _async_show_setup_form(
|
||||
self, errors: Dict[str, str] | None = None
|
||||
) -> Dict[str, Any]:
|
||||
self, errors: dict[str, str] | None = None
|
||||
) -> dict[str, Any]:
|
||||
"""Show the setup form to the user."""
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
|
@ -81,7 +81,7 @@ class ElgatoFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
|
||||
@callback
|
||||
def _async_create_entry(self) -> Dict[str, Any]:
|
||||
def _async_create_entry(self) -> dict[str, Any]:
|
||||
return self.async_create_entry(
|
||||
title=self.serial_number,
|
||||
data={
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, Callable, Dict, List
|
||||
from typing import Any, Callable
|
||||
|
||||
from elgato import Elgato, ElgatoError, Info, State
|
||||
|
||||
|
@ -38,7 +38,7 @@ SCAN_INTERVAL = timedelta(seconds=10)
|
|||
async def async_setup_entry(
|
||||
hass: HomeAssistantType,
|
||||
entry: ConfigEntry,
|
||||
async_add_entities: Callable[[List[Entity], bool], None],
|
||||
async_add_entities: Callable[[list[Entity], bool], None],
|
||||
) -> None:
|
||||
"""Set up Elgato Key Light based on a config entry."""
|
||||
elgato: Elgato = hass.data[DOMAIN][entry.entry_id][DATA_ELGATO_CLIENT]
|
||||
|
@ -116,7 +116,7 @@ class ElgatoLight(LightEntity):
|
|||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn on the light."""
|
||||
data: Dict[str, bool | int] = {ATTR_ON: True}
|
||||
data: dict[str, bool | int] = {ATTR_ON: True}
|
||||
|
||||
if ATTR_ON in kwargs:
|
||||
data[ATTR_ON] = kwargs[ATTR_ON]
|
||||
|
@ -149,7 +149,7 @@ class ElgatoLight(LightEntity):
|
|||
self._temperature = state.temperature
|
||||
|
||||
@property
|
||||
def device_info(self) -> Dict[str, Any]:
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
"""Return device information about this Elgato Key Light."""
|
||||
return {
|
||||
ATTR_IDENTIFIERS: {(DOMAIN, self._info.serial_number)},
|
||||
|
|
Loading…
Add table
Reference in a new issue