From f17d66228c84d2d66c05997ff00e30091e3b5584 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 10 Feb 2022 09:04:36 +0100 Subject: [PATCH] Enable basic type checking in demo init (#66218) * Enable basic type checking in demo init * Remove from mypy ignore list --- homeassistant/components/demo/__init__.py | 16 ++++++++-------- mypy.ini | 3 --- script/hassfest/mypy_config.py | 1 - 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/demo/__init__.py b/homeassistant/components/demo/__init__.py index 3ad84825090..abee8310e17 100644 --- a/homeassistant/components/demo/__init__.py +++ b/homeassistant/components/demo/__init__.py @@ -3,7 +3,7 @@ import asyncio import datetime from random import random -from homeassistant import bootstrap, config_entries +from homeassistant import config_entries, setup from homeassistant.components import persistent_notification from homeassistant.components.recorder.statistics import ( async_add_external_statistics, @@ -83,11 +83,11 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if not hass.config.longitude: hass.config.longitude = 117.22743 - tasks = [bootstrap.async_setup_component(hass, "sun", config)] + tasks = [setup.async_setup_component(hass, "sun", config)] # Set up input select tasks.append( - bootstrap.async_setup_component( + setup.async_setup_component( hass, "input_select", { @@ -108,7 +108,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # Set up input boolean tasks.append( - bootstrap.async_setup_component( + setup.async_setup_component( hass, "input_boolean", { @@ -125,7 +125,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # Set up input button tasks.append( - bootstrap.async_setup_component( + setup.async_setup_component( hass, "input_button", { @@ -141,7 +141,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # Set up input number tasks.append( - bootstrap.async_setup_component( + setup.async_setup_component( hass, "input_number", { @@ -280,7 +280,7 @@ async def finish_setup(hass, config): lights = sorted(hass.states.async_entity_ids("light")) # Set up scripts - await bootstrap.async_setup_component( + await setup.async_setup_component( hass, "script", { @@ -309,7 +309,7 @@ async def finish_setup(hass, config): ) # Set up scenes - await bootstrap.async_setup_component( + await setup.async_setup_component( hass, "scene", { diff --git a/mypy.ini b/mypy.ini index e2b406301da..c5afffd5638 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2196,9 +2196,6 @@ ignore_errors = true [mypy-homeassistant.components.deconz.switch] ignore_errors = true -[mypy-homeassistant.components.demo] -ignore_errors = true - [mypy-homeassistant.components.demo.fan] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 19bd3ee77f3..376f33de65b 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -38,7 +38,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.deconz.services", "homeassistant.components.deconz.siren", "homeassistant.components.deconz.switch", - "homeassistant.components.demo", "homeassistant.components.demo.fan", "homeassistant.components.demo.light", "homeassistant.components.demo.number",