ConfigType and async_setup/setup type hint improvements (#54739)

This commit is contained in:
Ville Skyttä 2021-08-18 14:22:05 +03:00 committed by GitHub
parent dcb2a211e5
commit 939fde0a50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 114 additions and 71 deletions

View file

@ -1,8 +1,6 @@
"""The NEW_NAME integration."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
@ -13,6 +11,7 @@ from homeassistant.helpers import (
config_entry_oauth2_flow,
config_validation as cv,
)
from homeassistant.helpers.typing import ConfigType
from . import api, config_flow
from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN
@ -34,7 +33,7 @@ CONFIG_SCHEMA = vol.Schema(
PLATFORMS = ["light"]
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the NEW_NAME component."""
hass.data[DOMAIN] = {}

View file

@ -1,17 +1,16 @@
"""The NEW_NAME integration."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN
CONFIG_SCHEMA = vol.Schema({vol.Optional(DOMAIN): {}}, extra=vol.ALLOW_EXTRA)
async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the NEW_NAME integration."""
return True