Add init type hints [r] (#63192)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/63224/head
parent
0d7b531285
commit
95537166e8
|
@ -33,7 +33,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
return unload_ok
|
||||
|
||||
|
||||
async def async_remove_entry(hass, entry):
|
||||
async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Remove a rachio config entry."""
|
||||
if CONF_CLOUDHOOK_URL in entry.data:
|
||||
await hass.components.cloud.async_delete_cloudhook(entry.data[CONF_WEBHOOK_ID])
|
||||
|
|
|
@ -15,8 +15,10 @@ from homeassistant.const import (
|
|||
CONF_PASSWORD,
|
||||
CONF_TRIGGER_TIME,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
CONF_ZONES = "zones"
|
||||
|
||||
|
@ -82,7 +84,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Rain Bird component."""
|
||||
|
||||
hass.data[DATA_RAINBIRD] = []
|
||||
|
|
|
@ -15,10 +15,12 @@ from homeassistant.const import (
|
|||
TIME_DAYS,
|
||||
TIME_MINUTES,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -92,7 +94,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Melnor RainCloud component."""
|
||||
conf = config[DOMAIN]
|
||||
username = conf.get(CONF_USERNAME)
|
||||
|
|
|
@ -4,6 +4,8 @@ import threading
|
|||
import time
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -29,7 +31,7 @@ I2C_HAT_NAMES = [
|
|||
I2C_HATS_MANAGER = "I2CH_MNG"
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the raspihats component."""
|
||||
hass.data[I2C_HATS_MANAGER] = I2CHatsManager()
|
||||
|
||||
|
|
|
@ -7,9 +7,11 @@ from rtmapi import Rtm, RtmRequestFailedException
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_API_KEY, CONF_ID, CONF_NAME, CONF_TOKEN, STATE_OK
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
# httplib2 is a transitive dependency from RtmAPI. If this dependency is not
|
||||
# set explicitly, the library does not work.
|
||||
|
@ -47,7 +49,7 @@ SERVICE_SCHEMA_CREATE_TASK = vol.Schema(
|
|||
SERVICE_SCHEMA_COMPLETE_TASK = vol.Schema({vol.Required(CONF_ID): cv.string})
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Remember the milk component."""
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass)
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
from gpiozero import LED, DigitalInputDevice
|
||||
from gpiozero.pins.pigpio import PiGPIOFactory
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
CONF_BOUNCETIME = "bouncetime"
|
||||
CONF_INVERT_LOGIC = "invert_logic"
|
||||
CONF_PULL_MODE = "pull_mode"
|
||||
|
@ -13,7 +16,7 @@ DEFAULT_PULL_MODE = "UP"
|
|||
DOMAIN = "remote_rpi_gpio"
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Raspberry Pi Remote GPIO component."""
|
||||
return True
|
||||
|
||||
|
|
|
@ -19,10 +19,12 @@ from homeassistant.const import (
|
|||
PERCENTAGE,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.discovery import load_platform
|
||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import slugify as util_slugify
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -215,7 +217,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Repetier Server component."""
|
||||
hass.data[REPETIER_API] = {}
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@ from homeassistant.const import (
|
|||
CONF_USERNAME,
|
||||
CONF_VERIFY_SSL,
|
||||
)
|
||||
from homeassistant.core import ServiceCall, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "rest_command"
|
||||
|
||||
|
@ -54,7 +55,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the REST command component."""
|
||||
|
||||
@callback
|
||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.const import (
|
|||
EVENT_HOMEASSISTANT_STOP,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import CoreState, ServiceCall, callback
|
||||
from homeassistant.core import CoreState, HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import (
|
||||
|
@ -27,6 +27,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .utils import brightness_to_rflink
|
||||
|
||||
|
@ -121,7 +122,7 @@ def identify_event_type(event):
|
|||
return "unknown"
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Rflink component."""
|
||||
# Allow entities to register themselves by device_id to be looked up when
|
||||
# new rflink events arrive to be handled
|
||||
|
|
|
@ -11,9 +11,11 @@ from oauthlib.oauth2 import AccessDeniedError
|
|||
import requests
|
||||
from ring_doorbell import Auth, Ring
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform, __version__
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util.async_ import run_callback_threadsafe
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -35,7 +37,7 @@ PLATFORMS = [
|
|||
]
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Ring component."""
|
||||
if DOMAIN not in config:
|
||||
return True
|
||||
|
@ -51,7 +53,7 @@ async def async_setup(hass, config):
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry):
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up a config entry."""
|
||||
|
||||
def token_updater(token):
|
||||
|
@ -125,7 +127,7 @@ async def async_setup_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry):
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload Ring entry."""
|
||||
if not await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||
return False
|
||||
|
|
|
@ -6,6 +6,7 @@ import async_timeout
|
|||
from roombapy import RoombaConnectionError, RoombaFactory
|
||||
|
||||
from homeassistant import exceptions
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_DELAY,
|
||||
CONF_HOST,
|
||||
|
@ -13,6 +14,7 @@ from homeassistant.const import (
|
|||
CONF_PASSWORD,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from .const import (
|
||||
BLID,
|
||||
|
@ -27,7 +29,7 @@ from .const import (
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry):
|
||||
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Set the config entry up."""
|
||||
# Set up roomba platforms with config entry
|
||||
|
||||
|
@ -114,7 +116,7 @@ async def async_update_options(hass, config_entry):
|
|||
await hass.config_entries.async_reload(config_entry.entry_id)
|
||||
|
||||
|
||||
async def async_unload_entry(hass, config_entry):
|
||||
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(
|
||||
config_entry, PLATFORMS
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
"""Roon (www.roonlabs.com) component."""
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from .const import DOMAIN
|
||||
from .server import RoonServer
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry):
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up a roonserver from a config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
host = entry.data[CONF_HOST]
|
||||
|
@ -26,7 +28,7 @@ async def async_setup_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry):
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
roonserver = hass.data[DOMAIN].pop(entry.entry_id)
|
||||
return await roonserver.async_reset()
|
||||
|
|
|
@ -10,9 +10,10 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_DOMAIN, CONF_TTL, CONF_ZONE
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -42,7 +43,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Route53 component."""
|
||||
domain = config[DOMAIN][CONF_DOMAIN]
|
||||
records = config[DOMAIN][CONF_RECORDS]
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, discovery
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
CONF_HORIZONTAL_FLIP,
|
||||
|
@ -63,7 +65,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the rpi_camera integration."""
|
||||
config_domain = config[DOMAIN]
|
||||
hass.data[DOMAIN] = {
|
||||
|
|
|
@ -6,6 +6,8 @@ from homeassistant.const import (
|
|||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "rpi_gpio"
|
||||
PLATFORMS = [
|
||||
|
@ -15,7 +17,7 @@ PLATFORMS = [
|
|||
]
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Raspberry PI GPIO component."""
|
||||
|
||||
def cleanup_gpio(event):
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
import pifacedigitalio as PFIO
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "rpi_pfio"
|
||||
|
||||
DATA_PFIO_LISTENER = "pfio_listener"
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Raspberry PI PFIO component."""
|
||||
pifacedigital = PFIO.PiFaceDigital()
|
||||
hass.data[DATA_PFIO_LISTENER] = PFIO.InputEventListener(chip=pifacedigital)
|
||||
|
|
|
@ -5,7 +5,9 @@ from aiohttp import web
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
CONTENT_TYPE_XML = "text/xml"
|
||||
DOMAIN = "rss_feed_template"
|
||||
|
@ -36,7 +38,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the RSS feed template component."""
|
||||
for (feeduri, feedconfig) in config[DOMAIN].items():
|
||||
url = f"/api/rss_template/{feeduri}"
|
||||
|
|
Loading…
Reference in New Issue