Add setup type hints [v-y] (#63614)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
0700c73bd0
commit
ecb921949a
8 changed files with 41 additions and 15 deletions
|
@ -11,7 +11,10 @@ from homeassistant.components.sensor import (
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, DATA_GIGABYTES
|
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, DATA_GIGABYTES
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
ATTR_CURRENT_BANDWIDTH_USED,
|
ATTR_CURRENT_BANDWIDTH_USED,
|
||||||
|
@ -50,7 +53,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up the Vultr subscription (server) sensor."""
|
"""Set up the Vultr subscription (server) sensor."""
|
||||||
vultr = hass.data[DATA_VULTR]
|
vultr = hass.data[DATA_VULTR]
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
"""Support for interacting with Vultr subscriptions."""
|
"""Support for interacting with Vultr subscriptions."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||||
from homeassistant.const import CONF_NAME
|
from homeassistant.const import CONF_NAME
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
ATTR_ALLOWED_BANDWIDTH,
|
ATTR_ALLOWED_BANDWIDTH,
|
||||||
|
@ -36,7 +41,12 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
def setup_platform(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config: ConfigType,
|
||||||
|
add_entities: AddEntitiesCallback,
|
||||||
|
discovery_info: DiscoveryInfoType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Set up the Vultr subscription switch."""
|
"""Set up the Vultr subscription switch."""
|
||||||
vultr = hass.data[DATA_VULTR]
|
vultr = hass.data[DATA_VULTR]
|
||||||
|
|
||||||
|
@ -45,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
|
|
||||||
if subscription not in vultr.data:
|
if subscription not in vultr.data:
|
||||||
_LOGGER.error("Subscription %s not found", subscription)
|
_LOGGER.error("Subscription %s not found", subscription)
|
||||||
return False
|
return
|
||||||
|
|
||||||
add_entities([VultrSwitch(vultr, subscription, name)], True)
|
add_entities([VultrSwitch(vultr, subscription, name)], True)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Support for WiLight Cover."""
|
"""Support for WiLight Cover."""
|
||||||
|
|
||||||
from pywilight.const import (
|
from pywilight.const import (
|
||||||
COVER_V1,
|
COVER_V1,
|
||||||
ITEM_COVER,
|
ITEM_COVER,
|
||||||
|
@ -14,13 +13,14 @@ from pywilight.const import (
|
||||||
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
|
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import DOMAIN, WiLightDevice
|
from . import DOMAIN, WiLightDevice
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
):
|
) -> None:
|
||||||
"""Set up WiLight covers from a config entry."""
|
"""Set up WiLight covers from a config entry."""
|
||||||
parent = hass.data[DOMAIN][entry.entry_id]
|
parent = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ from homeassistant.components.fan import (
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.util.percentage import (
|
from homeassistant.util.percentage import (
|
||||||
ordered_list_item_to_percentage,
|
ordered_list_item_to_percentage,
|
||||||
percentage_to_ordered_list_item,
|
percentage_to_ordered_list_item,
|
||||||
|
@ -33,8 +34,8 @@ SUPPORTED_FEATURES = SUPPORT_SET_SPEED | SUPPORT_DIRECTION
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
):
|
) -> None:
|
||||||
"""Set up WiLight lights from a config entry."""
|
"""Set up WiLight lights from a config entry."""
|
||||||
parent = hass.data[DOMAIN][entry.entry_id]
|
parent = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Support for WiLight lights."""
|
"""Support for WiLight lights."""
|
||||||
|
|
||||||
from pywilight.const import (
|
from pywilight.const import (
|
||||||
ITEM_LIGHT,
|
ITEM_LIGHT,
|
||||||
LIGHT_COLOR,
|
LIGHT_COLOR,
|
||||||
|
@ -17,6 +16,7 @@ from homeassistant.components.light import (
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import DOMAIN, WiLightDevice
|
from . import DOMAIN, WiLightDevice
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ def entities_from_discovered_wilight(hass, api_device):
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
):
|
) -> None:
|
||||||
"""Set up WiLight lights from a config entry."""
|
"""Set up WiLight lights from a config entry."""
|
||||||
parent = hass.data[DOMAIN][entry.entry_id]
|
parent = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ from functools import partial
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.entity_registry import (
|
from homeassistant.helpers.entity_registry import (
|
||||||
async_get_registry as async_get_entity_registry,
|
async_get_registry as async_get_entity_registry,
|
||||||
)
|
)
|
||||||
|
@ -18,8 +19,8 @@ PRESENCE_ATTRIBUTES = ["online", "in_party", "in_game", "in_multiplayer"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
):
|
) -> None:
|
||||||
"""Set up Xbox Live friends."""
|
"""Set up Xbox Live friends."""
|
||||||
coordinator: XboxUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
coordinator: XboxUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
||||||
"coordinator"
|
"coordinator"
|
||||||
|
|
|
@ -5,6 +5,7 @@ from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .const import DATA_CONFIG_ENTRIES, DATA_DEVICE, DATA_UPDATED, DOMAIN
|
from .const import DATA_CONFIG_ENTRIES, DATA_DEVICE, DATA_UPDATED, DOMAIN
|
||||||
from .entity import YeelightEntity
|
from .entity import YeelightEntity
|
||||||
|
@ -13,7 +14,9 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Yeelight from a config entry."""
|
"""Set up Yeelight from a config entry."""
|
||||||
device = hass.data[DOMAIN][DATA_CONFIG_ENTRIES][config_entry.entry_id][DATA_DEVICE]
|
device = hass.data[DOMAIN][DATA_CONFIG_ENTRIES][config_entry.entry_id][DATA_DEVICE]
|
||||||
|
|
|
@ -40,6 +40,7 @@ from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
from homeassistant.util.color import (
|
from homeassistant.util.color import (
|
||||||
|
@ -276,7 +277,9 @@ def _async_cmd(func):
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Yeelight from a config entry."""
|
"""Set up Yeelight from a config entry."""
|
||||||
custom_effects = _parse_custom_effects(hass.data[DOMAIN][DATA_CUSTOM_EFFECTS])
|
custom_effects = _parse_custom_effects(hass.data[DOMAIN][DATA_CUSTOM_EFFECTS])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue