Add basic type hints to zwave_me (#69322)

pull/69347/head
epenet 2022-04-05 13:44:20 +02:00 committed by GitHub
parent e5c1cc35e1
commit ad98bedd4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 12 deletions

View File

@ -17,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
ZWAVE_ME_PLATFORMS = [platform.value for platform in ZWaveMePlatform]
async def async_setup_entry(hass, entry):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Z-Wave-Me from a config entry."""
hass.data.setdefault(DOMAIN, {})
controller = hass.data[DOMAIN][entry.entry_id] = ZWaveMeController(hass, entry)
@ -27,7 +27,7 @@ async def async_setup_entry(hass, entry):
raise ConfigEntryNotReady()
async def async_unload_entry(hass, entry):
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

View File

@ -2,8 +2,10 @@
from typing import Any
from homeassistant.components.button import ButtonEntity
from homeassistant.core import callback
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ZWaveMeEntity
from .const import DOMAIN, ZWaveMePlatform
@ -11,7 +13,11 @@ from .const import DOMAIN, ZWaveMePlatform
DEVICE_NAME = ZWaveMePlatform.BUTTON
async def async_setup_entry(hass, config_entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the number platform."""
@callback

View File

@ -10,8 +10,10 @@ from homeassistant.components.cover import (
SUPPORT_SET_POSITION,
CoverEntity,
)
from homeassistant.core import callback
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ZWaveMeEntity
from .const import DOMAIN, ZWaveMePlatform
@ -19,7 +21,11 @@ from .const import DOMAIN, ZWaveMePlatform
DEVICE_NAME = ZWaveMePlatform.COVER
async def async_setup_entry(hass, config_entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the cover platform."""
@callback

View File

@ -1,7 +1,9 @@
"""Representation of a switchMultilevel."""
from homeassistant.components.number import NumberEntity
from homeassistant.core import callback
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ZWaveMeEntity
from .const import DOMAIN, ZWaveMePlatform
@ -9,7 +11,11 @@ from .const import DOMAIN, ZWaveMePlatform
DEVICE_NAME = ZWaveMePlatform.NUMBER
async def async_setup_entry(hass, config_entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the number platform."""
@callback

View File

@ -2,8 +2,10 @@
from typing import Any
from homeassistant.components.siren import SirenEntity
from homeassistant.core import callback
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ZWaveMeEntity
from .const import DOMAIN, ZWaveMePlatform
@ -11,7 +13,11 @@ from .const import DOMAIN, ZWaveMePlatform
DEVICE_NAME = ZWaveMePlatform.SIREN
async def async_setup_entry(hass, config_entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the siren platform."""
@callback

View File

@ -7,8 +7,10 @@ from homeassistant.components.switch import (
SwitchEntity,
SwitchEntityDescription,
)
from homeassistant.core import callback
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ZWaveMeEntity
from .const import DOMAIN, ZWaveMePlatform
@ -24,7 +26,11 @@ SWITCH_MAP: dict[str, SwitchEntityDescription] = {
}
async def async_setup_entry(hass, config_entry, async_add_entities):
async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up the switch platform."""
@callback