mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
Add init type hints [misc] (#63261)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
929da2154a
commit
e5ba34b9f9
@ -33,6 +33,7 @@ from homeassistant.helpers import (
|
|||||||
network,
|
network,
|
||||||
storage,
|
storage,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
from . import config_flow
|
from . import config_flow
|
||||||
from .const import DOMAIN, TYPE_LOCAL, TYPE_OAUTH2
|
from .const import DOMAIN, TYPE_LOCAL, TYPE_OAUTH2
|
||||||
@ -66,7 +67,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Almond component."""
|
"""Set up the Almond component."""
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ from homeassistant.const import (
|
|||||||
CONF_PROFILE_NAME,
|
CONF_PROFILE_NAME,
|
||||||
CONF_SERVICE,
|
CONF_SERVICE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
from homeassistant.helpers import config_validation as cv, discovery
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -81,7 +83,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up AWS component."""
|
"""Set up AWS component."""
|
||||||
hass.data[DATA_HASS_CONFIG] = config
|
hass.data[DATA_HASS_CONFIG] = config
|
||||||
|
|
||||||
|
@ -14,8 +14,14 @@ from homeassistant.const import (
|
|||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
EVENT_TIME_CHANGED,
|
EVENT_TIME_CHANGED,
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, ServiceCall, callback as async_callback
|
from homeassistant.core import (
|
||||||
|
Event,
|
||||||
|
HomeAssistant,
|
||||||
|
ServiceCall,
|
||||||
|
callback as async_callback,
|
||||||
|
)
|
||||||
from homeassistant.helpers.entity import async_generate_entity_id
|
from homeassistant.helpers.entity import async_generate_entity_id
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.util.async_ import run_callback_threadsafe
|
from homeassistant.util.async_ import run_callback_threadsafe
|
||||||
|
|
||||||
@ -123,7 +129,7 @@ def request_done(hass, request_id):
|
|||||||
).result()
|
).result()
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the configurator component."""
|
"""Set up the configurator component."""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -6,7 +6,9 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.conversation.util import create_matcher
|
from homeassistant.components.conversation.util import create_matcher
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import dispatcher, intent
|
from homeassistant.helpers import dispatcher, intent
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
@ -95,7 +97,7 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, config):
|
async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
|
||||||
"""Set up a config entry."""
|
"""Set up a config entry."""
|
||||||
try:
|
try:
|
||||||
bot = HangoutsBot(
|
bot = HangoutsBot(
|
||||||
@ -152,7 +154,7 @@ async def async_setup_entry(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, _):
|
async def async_unload_entry(hass: HomeAssistant, _: ConfigEntry) -> bool:
|
||||||
"""Unload a config entry."""
|
"""Unload a config entry."""
|
||||||
bot = hass.data[DOMAIN].pop(CONF_BOT)
|
bot = hass.data[DOMAIN].pop(CONF_BOT)
|
||||||
await bot.async_disconnect()
|
await bot.async_disconnect()
|
||||||
|
@ -9,6 +9,7 @@ from homeassistant.components.device_tracker import (
|
|||||||
from homeassistant.components.device_tracker.const import (
|
from homeassistant.components.device_tracker.const import (
|
||||||
SCAN_INTERVAL as DEFAULT_SCAN_INTERVAL,
|
SCAN_INTERVAL as DEFAULT_SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_EXCLUDE,
|
CONF_EXCLUDE,
|
||||||
CONF_INCLUDE,
|
CONF_INCLUDE,
|
||||||
@ -16,6 +17,7 @@ from homeassistant.const import (
|
|||||||
CONF_PREFIX,
|
CONF_PREFIX,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
@ -193,7 +195,7 @@ def setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up config entry."""
|
"""Set up config entry."""
|
||||||
hass.data[DOMAIN]["apis"][entry.data[CONF_USERNAME]] = get_api(
|
hass.data[DOMAIN]["apis"][entry.data[CONF_USERNAME]] = get_api(
|
||||||
entry.data[CONF_AUTHORIZATION]
|
entry.data[CONF_AUTHORIZATION]
|
||||||
@ -201,7 +203,7 @@ async def async_setup_entry(hass, entry):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload config entry."""
|
"""Unload config entry."""
|
||||||
try:
|
try:
|
||||||
hass.data[DOMAIN]["apis"].pop(entry.data[CONF_USERNAME])
|
hass.data[DOMAIN]["apis"].pop(entry.data[CONF_USERNAME])
|
||||||
|
@ -36,6 +36,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import (
|
from homeassistant.core import (
|
||||||
DOMAIN as HA_DOMAIN,
|
DOMAIN as HA_DOMAIN,
|
||||||
|
HomeAssistant,
|
||||||
ServiceCall,
|
ServiceCall,
|
||||||
callback,
|
callback,
|
||||||
split_entity_id,
|
split_entity_id,
|
||||||
@ -50,6 +51,7 @@ from homeassistant.helpers.entityfilter import (
|
|||||||
from homeassistant.helpers.integration_platform import (
|
from homeassistant.helpers.integration_platform import (
|
||||||
async_process_integration_platforms,
|
async_process_integration_platforms,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
@ -130,7 +132,7 @@ def async_log_entry(hass, name, message, domain=None, entity_id=None, context=No
|
|||||||
hass.bus.async_fire(EVENT_LOGBOOK_ENTRY, data, context=context)
|
hass.bus.async_fire(EVENT_LOGBOOK_ENTRY, data, context=context)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Logbook setup."""
|
"""Logbook setup."""
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ from homeassistant.components.media_player.const import (
|
|||||||
ATTR_MEDIA_TITLE,
|
ATTR_MEDIA_TITLE,
|
||||||
MEDIA_TYPE_GAME,
|
MEDIA_TYPE_GAME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_COMMAND,
|
ATTR_COMMAND,
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
@ -22,6 +23,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, ServiceCall, split_entity_id
|
from homeassistant.core import HomeAssistant, ServiceCall, split_entity_id
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import config_validation as cv, entity_registry
|
from homeassistant.helpers import config_validation as cv, entity_registry
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util import location
|
from homeassistant.util import location
|
||||||
from homeassistant.util.json import load_json, save_json
|
from homeassistant.util.json import load_json, save_json
|
||||||
|
|
||||||
@ -58,7 +60,7 @@ class PS4Data:
|
|||||||
self.protocol = None
|
self.protocol = None
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the PS4 Component."""
|
"""Set up the PS4 Component."""
|
||||||
hass.data[PS4_DATA] = PS4Data()
|
hass.data[PS4_DATA] = PS4Data()
|
||||||
|
|
||||||
@ -69,13 +71,13 @@ async def async_setup(hass, config):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up PS4 from a config entry."""
|
"""Set up PS4 from a config entry."""
|
||||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass, entry):
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload a PS4 config entry."""
|
"""Unload a PS4 config entry."""
|
||||||
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ from homeassistant import config_entries
|
|||||||
from homeassistant.components import http, websocket_api
|
from homeassistant.components import http, websocket_api
|
||||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||||
from homeassistant.const import ATTR_NAME
|
from homeassistant.const import ATTR_NAME
|
||||||
from homeassistant.core import ServiceCall, callback
|
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util.json import load_json, save_json
|
from homeassistant.util.json import load_json, save_json
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -61,7 +62,7 @@ SCHEMA_WEBSOCKET_CLEAR_ITEMS = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Initialize the shopping list."""
|
"""Initialize the shopping list."""
|
||||||
|
|
||||||
if DOMAIN not in config:
|
if DOMAIN not in config:
|
||||||
|
@ -5,16 +5,19 @@ import logging
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import tibber
|
import tibber
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ACCESS_TOKEN,
|
CONF_ACCESS_TOKEN,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
Platform,
|
Platform,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from .const import DATA_HASS_CONFIG, DOMAIN
|
from .const import DATA_HASS_CONFIG, DOMAIN
|
||||||
@ -26,14 +29,14 @@ CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Tibber component."""
|
"""Set up the Tibber component."""
|
||||||
|
|
||||||
hass.data[DATA_HASS_CONFIG] = config
|
hass.data[DATA_HASS_CONFIG] = config
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up a config entry."""
|
"""Set up a config entry."""
|
||||||
|
|
||||||
tibber_connection = tibber.Tibber(
|
tibber_connection = tibber.Tibber(
|
||||||
|
@ -23,13 +23,14 @@ from homeassistant.const import (
|
|||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import event as event_helper, state as state_helper
|
from homeassistant.helpers import event as event_helper, state as state_helper
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entityfilter import (
|
from homeassistant.helpers.entityfilter import (
|
||||||
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA,
|
INCLUDE_EXCLUDE_BASE_FILTER_SCHEMA,
|
||||||
convert_include_exclude_filter,
|
convert_include_exclude_filter,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the Zabbix component."""
|
"""Set up the Zabbix component."""
|
||||||
|
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
|
Loading…
Reference in New Issue
Block a user