From d168749a51540b6225569ebeb603ba286bdf7559 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 23 Apr 2021 10:34:02 +0200 Subject: [PATCH] Integrations: HomeAssistantType --> HomeAssistant. Last batch. (#49591) --- .../components/garmin_connect/sensor.py | 4 +-- .../components/geniushub/__init__.py | 8 +++--- .../components/geniushub/binary_sensor.py | 5 ++-- homeassistant/components/geniushub/climate.py | 5 ++-- homeassistant/components/geniushub/sensor.py | 5 ++-- homeassistant/components/geniushub/switch.py | 5 ++-- .../components/geniushub/water_heater.py | 5 ++-- .../components/gpslogger/device_tracker.py | 5 ++-- homeassistant/components/gtfs/sensor.py | 9 +++---- homeassistant/components/hassio/__init__.py | 27 ++++++++----------- .../components/hassio/addon_panel.py | 4 +-- homeassistant/components/hassio/auth.py | 7 +++-- homeassistant/components/hassio/ingress.py | 5 ++-- 13 files changed, 44 insertions(+), 50 deletions(-) diff --git a/homeassistant/components/garmin_connect/sensor.py b/homeassistant/components/garmin_connect/sensor.py index 46db6e615f1..5cabb96c8e9 100644 --- a/homeassistant/components/garmin_connect/sensor.py +++ b/homeassistant/components/garmin_connect/sensor.py @@ -13,7 +13,7 @@ from garminconnect import ( from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_ATTRIBUTION, CONF_ID -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from .alarm_util import calculate_next_active_alarms from .const import ATTRIBUTION, DOMAIN, GARMIN_ENTITY_LIST @@ -22,7 +22,7 @@ _LOGGER = logging.getLogger(__name__) async def async_setup_entry( - hass: HomeAssistantType, entry: ConfigEntry, async_add_entities + hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up Garmin Connect sensor based on a config entry.""" garmin_data = hass.data[DOMAIN][entry.entry_id] diff --git a/homeassistant/components/geniushub/__init__.py b/homeassistant/components/geniushub/__init__.py index f1d2a1d47c1..bf5fc03ded5 100644 --- a/homeassistant/components/geniushub/__init__.py +++ b/homeassistant/components/geniushub/__init__.py @@ -19,7 +19,7 @@ from homeassistant.const import ( CONF_USERNAME, TEMP_CELSIUS, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.discovery import async_load_platform @@ -30,7 +30,7 @@ from homeassistant.helpers.dispatcher import ( from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.service import verify_domain_control -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util _LOGGER = logging.getLogger(__name__) @@ -96,7 +96,7 @@ SET_ZONE_OVERRIDE_SCHEMA = vol.Schema( ) -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Create a Genius Hub system.""" hass.data[DOMAIN] = {} @@ -129,7 +129,7 @@ async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: @callback -def setup_service_functions(hass: HomeAssistantType, broker): +def setup_service_functions(hass: HomeAssistant, broker): """Set up the service functions.""" @verify_domain_control(hass, DOMAIN) diff --git a/homeassistant/components/geniushub/binary_sensor.py b/homeassistant/components/geniushub/binary_sensor.py index d935192f97d..dd39189bd38 100644 --- a/homeassistant/components/geniushub/binary_sensor.py +++ b/homeassistant/components/geniushub/binary_sensor.py @@ -1,6 +1,7 @@ """Support for Genius Hub binary_sensor devices.""" from homeassistant.components.binary_sensor import BinarySensorEntity -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from . import DOMAIN, GeniusDevice @@ -8,7 +9,7 @@ GH_STATE_ATTR = "outputOnOff" async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub sensor entities.""" if discovery_info is None: diff --git a/homeassistant/components/geniushub/climate.py b/homeassistant/components/geniushub/climate.py index 089fd964835..b60132b9e4c 100644 --- a/homeassistant/components/geniushub/climate.py +++ b/homeassistant/components/geniushub/climate.py @@ -13,7 +13,8 @@ from homeassistant.components.climate.const import ( SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, ) -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from . import DOMAIN, GeniusHeatingZone @@ -28,7 +29,7 @@ GH_ZONES = ["radiator", "wet underfloor"] async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub climate entities.""" if discovery_info is None: diff --git a/homeassistant/components/geniushub/sensor.py b/homeassistant/components/geniushub/sensor.py index 3234ccd577f..0c96ec595b6 100644 --- a/homeassistant/components/geniushub/sensor.py +++ b/homeassistant/components/geniushub/sensor.py @@ -6,7 +6,8 @@ from typing import Any from homeassistant.components.sensor import SensorEntity from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType import homeassistant.util.dt as dt_util from . import DOMAIN, GeniusDevice, GeniusEntity @@ -21,7 +22,7 @@ GH_LEVEL_MAPPING = { async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub sensor entities.""" if discovery_info is None: diff --git a/homeassistant/components/geniushub/switch.py b/homeassistant/components/geniushub/switch.py index cb45911d250..faff6b8e2f9 100644 --- a/homeassistant/components/geniushub/switch.py +++ b/homeassistant/components/geniushub/switch.py @@ -5,8 +5,9 @@ import voluptuous as vol from homeassistant.components.switch import DEVICE_CLASS_OUTLET, SwitchEntity from homeassistant.const import ATTR_ENTITY_ID +from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv, entity_platform -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.helpers.typing import ConfigType from . import ATTR_DURATION, DOMAIN, GeniusZone @@ -26,7 +27,7 @@ SET_SWITCH_OVERRIDE_SCHEMA = vol.Schema( async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub switch entities.""" if discovery_info is None: diff --git a/homeassistant/components/geniushub/water_heater.py b/homeassistant/components/geniushub/water_heater.py index bb775432d8e..8dcbce7c1bd 100644 --- a/homeassistant/components/geniushub/water_heater.py +++ b/homeassistant/components/geniushub/water_heater.py @@ -7,7 +7,8 @@ from homeassistant.components.water_heater import ( WaterHeaterEntity, ) from homeassistant.const import STATE_OFF -from homeassistant.helpers.typing import ConfigType, HomeAssistantType +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from . import DOMAIN, GeniusHeatingZone @@ -32,7 +33,7 @@ GH_HEATERS = ["hot water temperature"] async def async_setup_platform( - hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None + hass: HomeAssistant, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub water_heater entities.""" if discovery_info is None: diff --git a/homeassistant/components/gpslogger/device_tracker.py b/homeassistant/components/gpslogger/device_tracker.py index 25701e8c2e7..5bce10ab088 100644 --- a/homeassistant/components/gpslogger/device_tracker.py +++ b/homeassistant/components/gpslogger/device_tracker.py @@ -7,11 +7,10 @@ from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUDE, ) -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import device_registry from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import HomeAssistantType from . import DOMAIN as GPL_DOMAIN, TRACKER_UPDATE from .const import ( @@ -23,7 +22,7 @@ from .const import ( ) -async def async_setup_entry(hass: HomeAssistantType, entry, async_add_entities): +async def async_setup_entry(hass: HomeAssistant, entry, async_add_entities): """Configure a dispatcher connection based on a config entry.""" @callback diff --git a/homeassistant/components/gtfs/sensor.py b/homeassistant/components/gtfs/sensor.py index 61f0bb7d9c1..d71a2fab67d 100644 --- a/homeassistant/components/gtfs/sensor.py +++ b/homeassistant/components/gtfs/sensor.py @@ -19,12 +19,9 @@ from homeassistant.const import ( DEVICE_CLASS_TIMESTAMP, STATE_UNKNOWN, ) +from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.typing import ( - ConfigType, - DiscoveryInfoType, - HomeAssistantType, -) +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.util import slugify import homeassistant.util.dt as dt_util @@ -482,7 +479,7 @@ def get_next_departure( def setup_platform( - hass: HomeAssistantType, + hass: HomeAssistant, config: ConfigType, add_entities: Callable[[list], None], discovery_info: DiscoveryInfoType | None = None, diff --git a/homeassistant/components/hassio/__init__.py b/homeassistant/components/hassio/__init__.py index 6dd2a067c89..4889c7c137a 100644 --- a/homeassistant/components/hassio/__init__.py +++ b/homeassistant/components/hassio/__init__.py @@ -24,7 +24,6 @@ from homeassistant.core import DOMAIN as HASS_DOMAIN, Config, HomeAssistant, cal from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.device_registry import DeviceRegistry, async_get_registry -from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.loader import bind_hass from homeassistant.util.dt import utcnow @@ -152,7 +151,7 @@ MAP_SERVICE_API = { @bind_hass -async def async_get_addon_info(hass: HomeAssistantType, slug: str) -> dict: +async def async_get_addon_info(hass: HomeAssistant, slug: str) -> dict: """Return add-on info. The caller of the function should handle HassioAPIError. @@ -162,7 +161,7 @@ async def async_get_addon_info(hass: HomeAssistantType, slug: str) -> dict: @bind_hass -async def async_update_diagnostics(hass: HomeAssistantType, diagnostics: bool) -> dict: +async def async_update_diagnostics(hass: HomeAssistant, diagnostics: bool) -> dict: """Update Supervisor diagnostics toggle. The caller of the function should handle HassioAPIError. @@ -173,7 +172,7 @@ async def async_update_diagnostics(hass: HomeAssistantType, diagnostics: bool) - @bind_hass @api_data -async def async_install_addon(hass: HomeAssistantType, slug: str) -> dict: +async def async_install_addon(hass: HomeAssistant, slug: str) -> dict: """Install add-on. The caller of the function should handle HassioAPIError. @@ -185,7 +184,7 @@ async def async_install_addon(hass: HomeAssistantType, slug: str) -> dict: @bind_hass @api_data -async def async_uninstall_addon(hass: HomeAssistantType, slug: str) -> dict: +async def async_uninstall_addon(hass: HomeAssistant, slug: str) -> dict: """Uninstall add-on. The caller of the function should handle HassioAPIError. @@ -197,7 +196,7 @@ async def async_uninstall_addon(hass: HomeAssistantType, slug: str) -> dict: @bind_hass @api_data -async def async_update_addon(hass: HomeAssistantType, slug: str) -> dict: +async def async_update_addon(hass: HomeAssistant, slug: str) -> dict: """Update add-on. The caller of the function should handle HassioAPIError. @@ -209,7 +208,7 @@ async def async_update_addon(hass: HomeAssistantType, slug: str) -> dict: @bind_hass @api_data -async def async_start_addon(hass: HomeAssistantType, slug: str) -> dict: +async def async_start_addon(hass: HomeAssistant, slug: str) -> dict: """Start add-on. The caller of the function should handle HassioAPIError. @@ -221,7 +220,7 @@ async def async_start_addon(hass: HomeAssistantType, slug: str) -> dict: @bind_hass @api_data -async def async_stop_addon(hass: HomeAssistantType, slug: str) -> dict: +async def async_stop_addon(hass: HomeAssistant, slug: str) -> dict: """Stop add-on. The caller of the function should handle HassioAPIError. @@ -234,7 +233,7 @@ async def async_stop_addon(hass: HomeAssistantType, slug: str) -> dict: @bind_hass @api_data async def async_set_addon_options( - hass: HomeAssistantType, slug: str, options: dict + hass: HomeAssistant, slug: str, options: dict ) -> dict: """Set add-on options. @@ -246,9 +245,7 @@ async def async_set_addon_options( @bind_hass -async def async_get_addon_discovery_info( - hass: HomeAssistantType, slug: str -) -> dict | None: +async def async_get_addon_discovery_info(hass: HomeAssistant, slug: str) -> dict | None: """Return discovery data for an add-on.""" hassio = hass.data[DOMAIN] data = await hassio.retrieve_discovery_messages() @@ -259,7 +256,7 @@ async def async_get_addon_discovery_info( @bind_hass @api_data async def async_create_snapshot( - hass: HomeAssistantType, payload: dict, partial: bool = False + hass: HomeAssistant, payload: dict, partial: bool = False ) -> dict: """Create a full or partial snapshot. @@ -536,9 +533,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b return True -async def async_unload_entry( - hass: HomeAssistantType, config_entry: ConfigEntry -) -> bool: +async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Unload a config entry.""" unload_ok = all( await asyncio.gather( diff --git a/homeassistant/components/hassio/addon_panel.py b/homeassistant/components/hassio/addon_panel.py index a48c8b4d05b..d540479d779 100644 --- a/homeassistant/components/hassio/addon_panel.py +++ b/homeassistant/components/hassio/addon_panel.py @@ -6,7 +6,7 @@ from aiohttp import web from homeassistant.components.http import HomeAssistantView from homeassistant.const import ATTR_ICON, HTTP_BAD_REQUEST -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant from .const import ATTR_ADMIN, ATTR_ENABLE, ATTR_PANELS, ATTR_TITLE from .handler import HassioAPIError @@ -14,7 +14,7 @@ from .handler import HassioAPIError _LOGGER = logging.getLogger(__name__) -async def async_setup_addon_panel(hass: HomeAssistantType, hassio): +async def async_setup_addon_panel(hass: HomeAssistant, hassio): """Add-on Ingress Panel setup.""" hassio_addon_panel = HassIOAddonPanel(hass, hassio) hass.http.register_view(hassio_addon_panel) diff --git a/homeassistant/components/hassio/auth.py b/homeassistant/components/hassio/auth.py index a1c032fe0fe..6c9b36fb3a0 100644 --- a/homeassistant/components/hassio/auth.py +++ b/homeassistant/components/hassio/auth.py @@ -13,9 +13,8 @@ from homeassistant.components.http import HomeAssistantView from homeassistant.components.http.const import KEY_HASS_USER from homeassistant.components.http.data_validator import RequestDataValidator from homeassistant.const import HTTP_OK -from homeassistant.core import callback +from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.typing import HomeAssistantType from .const import ATTR_ADDON, ATTR_PASSWORD, ATTR_USERNAME @@ -23,7 +22,7 @@ _LOGGER = logging.getLogger(__name__) @callback -def async_setup_auth_view(hass: HomeAssistantType, user: User): +def async_setup_auth_view(hass: HomeAssistant, user: User): """Auth setup.""" hassio_auth = HassIOAuth(hass, user) hassio_password_reset = HassIOPasswordReset(hass, user) @@ -35,7 +34,7 @@ def async_setup_auth_view(hass: HomeAssistantType, user: User): class HassIOBaseAuth(HomeAssistantView): """Hass.io view to handle auth requests.""" - def __init__(self, hass: HomeAssistantType, user: User): + def __init__(self, hass: HomeAssistant, user: User): """Initialize WebView.""" self.hass = hass self.user = user diff --git a/homeassistant/components/hassio/ingress.py b/homeassistant/components/hassio/ingress.py index 1f0a49ae497..7519c860398 100644 --- a/homeassistant/components/hassio/ingress.py +++ b/homeassistant/components/hassio/ingress.py @@ -12,8 +12,7 @@ from aiohttp.web_exceptions import HTTPBadGateway from multidict import CIMultiDict from homeassistant.components.http import HomeAssistantView -from homeassistant.core import callback -from homeassistant.helpers.typing import HomeAssistantType +from homeassistant.core import HomeAssistant, callback from .const import X_HASSIO, X_INGRESS_PATH @@ -21,7 +20,7 @@ _LOGGER = logging.getLogger(__name__) @callback -def async_setup_ingress_view(hass: HomeAssistantType, host: str): +def async_setup_ingress_view(hass: HomeAssistant, host: str): """Auth setup.""" websession = hass.helpers.aiohttp_client.async_get_clientsession()