Add init type hints [b-c] (#63100)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
5d037a079d
commit
9e16f87ddc
15 changed files with 45 additions and 23 deletions
|
@ -4,13 +4,15 @@ import logging
|
|||
from Adafruit_BBIO import GPIO # pylint: disable=import-error
|
||||
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "bbb_gpio"
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the BeagleBone Black GPIO component."""
|
||||
_LOGGER.warning(
|
||||
"The BeagleBone Black GPIO integration is deprecated and will be removed "
|
||||
|
|
|
@ -7,9 +7,9 @@ from blinkpy.blinkpy import Blink
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import persistent_notification
|
||||
from homeassistant.config_entries import SOURCE_REAUTH
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntry
|
||||
from homeassistant.const import CONF_FILENAME, CONF_NAME, CONF_PIN, CONF_SCAN_INTERVAL
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
|
@ -60,7 +60,7 @@ def _reauth_flow_wrapper(hass, data):
|
|||
)
|
||||
|
||||
|
||||
async def async_migrate_entry(hass, entry):
|
||||
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Handle migration of a previous version config entry."""
|
||||
_LOGGER.debug("Migrating from version %s", entry.version)
|
||||
data = {**entry.data}
|
||||
|
@ -74,7 +74,7 @@ async def async_migrate_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry):
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Blink via config entry."""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
|
||||
|
@ -125,7 +125,7 @@ def _async_import_options_from_data_if_missing(hass, entry):
|
|||
hass.config_entries.async_update_entry(entry, options=options)
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry):
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload Blink entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_API_KEY, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -27,7 +29,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the BloomSky integration."""
|
||||
api_key = config[DOMAIN][CONF_API_KEY]
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
"""The blueprint integration."""
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import websocket_api
|
||||
from .const import DOMAIN # noqa: F401
|
||||
from .errors import ( # noqa: F401
|
||||
|
@ -13,7 +16,7 @@ from .models import Blueprint, BlueprintInputs, DomainBlueprints # noqa: F401
|
|||
from .schemas import is_blueprint_instance_config # noqa: F401
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the blueprint integration."""
|
||||
websocket_api.async_setup(hass)
|
||||
return True
|
||||
|
|
|
@ -5,7 +5,9 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_SCAN_INTERVAL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, discovery
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import (
|
||||
CONF_DELTA_TEMP,
|
||||
|
@ -89,7 +91,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up BME280 component."""
|
||||
_LOGGER.warning(
|
||||
"The Bosch BME280 Environmental Sensor integration is deprecated and "
|
||||
|
|
|
@ -21,6 +21,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401
|
|||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.template import DATE_STR_FORMAT
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util import dt
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
@ -32,7 +33,7 @@ ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
|||
SCAN_INTERVAL = timedelta(seconds=60)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Track states and offer events for calendars."""
|
||||
component = hass.data[DOMAIN] = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
|
||||
|
|
|
@ -55,7 +55,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry):
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Unload a config entry."""
|
||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_NAME, CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, discovery
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "circuit"
|
||||
CONF_WEBHOOK = "webhook"
|
||||
|
@ -21,7 +23,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Unify Circuit component."""
|
||||
webhooks = config[DOMAIN][CONF_WEBHOOK]
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@ from homeassistant.const import (
|
|||
CONF_REGION,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import ServiceCall, callback
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import config_validation as cv, entityfilter
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import bind_hass
|
||||
from homeassistant.util.aiohttp import MockRequest
|
||||
|
||||
|
@ -168,7 +169,7 @@ def is_cloudhook_request(request):
|
|||
return isinstance(request, MockRequest)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Initialize the Home Assistant cloud."""
|
||||
# Process configs
|
||||
if DOMAIN in config:
|
||||
|
|
|
@ -15,9 +15,10 @@ from homeassistant.components.light import (
|
|||
LIGHT_TURN_ON_SCHEMA,
|
||||
SERVICE_TURN_ON as LIGHT_SERVICE_TURN_ON,
|
||||
)
|
||||
from homeassistant.core import ServiceCall
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import aiohttp_client
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import ATTR_PATH, ATTR_URL, DOMAIN, SERVICE_TURN_ON
|
||||
|
||||
|
@ -56,7 +57,7 @@ def _get_color(file_handler) -> tuple:
|
|||
return color
|
||||
|
||||
|
||||
async def async_setup(hass, hass_config):
|
||||
async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
|
||||
"""Set up services for color_extractor integration."""
|
||||
|
||||
async def async_handle_service(service_call: ServiceCall) -> None:
|
||||
|
|
|
@ -11,9 +11,11 @@ from homeassistant.const import (
|
|||
CONF_TOKEN,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -48,7 +50,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the ComfoConnect bridge."""
|
||||
|
||||
conf = config[DOMAIN]
|
||||
|
|
|
@ -8,8 +8,9 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.const import CONF_ID, EVENT_COMPONENT_LOADED
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import ATTR_COMPONENT
|
||||
from homeassistant.util.file import write_utf8_file_atomic
|
||||
from homeassistant.util.yaml import dump, load_yaml
|
||||
|
@ -33,7 +34,7 @@ ACTION_CREATE_UPDATE = "create_update"
|
|||
ACTION_DELETE = "delete"
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the config component."""
|
||||
hass.components.frontend.async_register_built_in_panel(
|
||||
"config", "config", "hass:cog", require_admin=True
|
||||
|
|
|
@ -8,7 +8,9 @@ import voluptuous as vol
|
|||
from homeassistant import core
|
||||
from homeassistant.components import http, websocket_api
|
||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv, intent
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
from .agent import AbstractConversationAgent
|
||||
|
@ -51,7 +53,7 @@ def async_set_agent(hass: core.HomeAssistant, agent: AbstractConversationAgent):
|
|||
hass.data[DATA_AGENT] = agent
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Register the process service."""
|
||||
hass.data[DATA_CONFIG] = config
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ import logging
|
|||
from pycoolmasternet_async import CoolMasterNet
|
||||
|
||||
from homeassistant.components.climate import SCAN_INTERVAL
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
|
@ -15,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
PLATFORMS = [Platform.CLIMATE]
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry):
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Coolmaster from a config entry."""
|
||||
host = entry.data[CONF_HOST]
|
||||
port = entry.data[CONF_PORT]
|
||||
|
@ -38,7 +40,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 Coolmaster config entry."""
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
if unload_ok:
|
||||
|
|
|
@ -34,6 +34,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401
|
|||
)
|
||||
from homeassistant.helpers.entity import Entity, EntityDescription
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
||||
|
@ -99,7 +100,7 @@ def is_closed(hass, entity_id):
|
|||
return hass.states.is_state(entity_id, STATE_CLOSED)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Track states and offer events for covers."""
|
||||
component = hass.data[DOMAIN] = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
|
||||
|
|
Loading…
Add table
Reference in a new issue