Use ConfigType instead of Config in async_setup type hint (#51037)

This commit is contained in:
uvjustin 2021-05-25 01:23:16 +08:00 committed by GitHub
parent ebf6e3d985
commit 1ec4332e25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -16,12 +16,13 @@ from homeassistant.const import (
CONF_USERNAME, CONF_USERNAME,
CONF_VERIFY_SSL, CONF_VERIFY_SSL,
) )
from homeassistant.core import Config, HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
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.dispatcher import async_dispatcher_send from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.event import async_track_time_interval
from homeassistant.helpers.typing import ConfigType
from .const import ( from .const import (
CONF_VERSION, CONF_VERSION,
@ -59,7 +60,7 @@ CONFIG_SCHEMA = vol.Schema(
) )
async def async_setup(hass: HomeAssistant, config: Config) -> bool: async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Configure Glances using config flow only.""" """Configure Glances using config flow only."""
if DOMAIN in config: if DOMAIN in config:
for entry in config[DOMAIN]: for entry in config[DOMAIN]:

View File

@ -22,10 +22,11 @@ from homeassistant.const import (
SERVICE_HOMEASSISTANT_RESTART, SERVICE_HOMEASSISTANT_RESTART,
SERVICE_HOMEASSISTANT_STOP, SERVICE_HOMEASSISTANT_STOP,
) )
from homeassistant.core import DOMAIN as HASS_DOMAIN, Config, HomeAssistant, callback from homeassistant.core import DOMAIN as HASS_DOMAIN, HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv, recorder from homeassistant.helpers import config_validation as cv, recorder
from homeassistant.helpers.device_registry import DeviceRegistry, async_get_registry from homeassistant.helpers.device_registry import DeviceRegistry, async_get_registry
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
from homeassistant.util.dt import utcnow from homeassistant.util.dt import utcnow
@ -338,7 +339,7 @@ def get_supervisor_ip():
return os.environ["SUPERVISOR"].partition(":")[0] return os.environ["SUPERVISOR"].partition(":")[0]
async def async_setup(hass: HomeAssistant, config: Config) -> bool: # noqa: C901 async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: C901
"""Set up the Hass.io component.""" """Set up the Hass.io component."""
# Check local setup # Check local setup
for env in ("HASSIO", "HASSIO_TOKEN"): for env in ("HASSIO", "HASSIO_TOKEN"):