Type check various base components (#25878)
* Type check various component base classes, disabling bunch of checks for now * Type hint fixes * Help mypy out some * Add more type hints
This commit is contained in:
1 parent
cf90e49b50
commit
b738082dad
59 files changed
+233
-34
No files matched your search
@@ -20,6 +20,9 @@ from homeassistant.const import (
|
||||
)
|
||||
from homeassistant.components import group
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
DOMAIN = "switch"
|
||||
SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Light support for switch entities."""
|
||||
import logging
|
||||
from typing import cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
@@ -18,6 +19,9 @@ from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
||||
from homeassistant.components.light import PLATFORM_SCHEMA, Light
|
||||
|
||||
|
||||
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_NAME = "Light Switch"
|
||||
@@ -35,7 +39,7 @@ async def async_setup_platform(
|
||||
) -> None:
|
||||
"""Initialize Light Switch platform."""
|
||||
async_add_entities(
|
||||
[LightSwitch(config.get(CONF_NAME), config[CONF_ENTITY_ID])], True
|
||||
[LightSwitch(cast(str, config.get(CONF_NAME)), config[CONF_ENTITY_ID])], True
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user