From 8393a215e919859612c7791ef431f3e42001e558 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 30 Mar 2021 01:22:33 +0200 Subject: [PATCH] Clean up superfluous integration setup - part 1 (#48476) --- homeassistant/components/acmeda/__init__.py | 5 ----- homeassistant/components/agent_dvr/__init__.py | 5 ----- homeassistant/components/airly/__init__.py | 6 ------ homeassistant/components/alarmdecoder/__init__.py | 5 ----- homeassistant/components/apple_tv/__init__.py | 5 ----- homeassistant/components/atag/__init__.py | 5 ----- homeassistant/components/awair/__init__.py | 6 ------ homeassistant/components/axis/__init__.py | 5 ----- homeassistant/components/azure_devops/__init__.py | 5 ----- homeassistant/components/blebox/__init__.py | 5 ----- homeassistant/components/braviatv/__init__.py | 5 ----- homeassistant/components/brother/__init__.py | 7 +------ homeassistant/components/cert_expiry/__init__.py | 5 ----- homeassistant/components/devolo_home_control/__init__.py | 5 ----- homeassistant/components/dialogflow/__init__.py | 5 ----- homeassistant/components/dunehd/__init__.py | 5 ----- homeassistant/components/ipma/__init__.py | 7 ------- tests/components/alarmdecoder/test_config_flow.py | 3 --- tests/components/azure_devops/test_config_flow.py | 3 --- tests/components/devolo_home_control/test_config_flow.py | 8 -------- 20 files changed, 1 insertion(+), 104 deletions(-) diff --git a/homeassistant/components/acmeda/__init__.py b/homeassistant/components/acmeda/__init__.py index ede6751a6fe..926208fba40 100644 --- a/homeassistant/components/acmeda/__init__.py +++ b/homeassistant/components/acmeda/__init__.py @@ -11,11 +11,6 @@ CONF_HUBS = "hubs" PLATFORMS = ["cover", "sensor"] -async def async_setup(hass: core.HomeAssistant, config: dict): - """Set up the Rollease Acmeda Automate component.""" - return True - - async def async_setup_entry( hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry ): diff --git a/homeassistant/components/agent_dvr/__init__.py b/homeassistant/components/agent_dvr/__init__.py index fc52ee0ef36..3623f4f702a 100644 --- a/homeassistant/components/agent_dvr/__init__.py +++ b/homeassistant/components/agent_dvr/__init__.py @@ -16,11 +16,6 @@ DEFAULT_BRAND = "Agent DVR by ispyconnect.com" FORWARDS = ["alarm_control_panel", "camera"] -async def async_setup(hass, config): - """Old way to set up integrations.""" - return True - - async def async_setup_entry(hass, config_entry): """Set up the Agent component.""" hass.data.setdefault(AGENT_DOMAIN, {}) diff --git a/homeassistant/components/airly/__init__.py b/homeassistant/components/airly/__init__.py index b373750e7b1..41a7c03e636 100644 --- a/homeassistant/components/airly/__init__.py +++ b/homeassistant/components/airly/__init__.py @@ -10,7 +10,6 @@ from airly.exceptions import AirlyError import async_timeout from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE -from homeassistant.core import Config, HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -43,11 +42,6 @@ def set_update_interval(hass, instances): return interval -async def async_setup(hass: HomeAssistant, config: Config) -> bool: - """Set up configured Airly.""" - return True - - async def async_setup_entry(hass, config_entry): """Set up Airly as config entry.""" api_key = config_entry.data[CONF_API_KEY] diff --git a/homeassistant/components/alarmdecoder/__init__.py b/homeassistant/components/alarmdecoder/__init__.py index 34493b3b9d0..849aae9b3cc 100644 --- a/homeassistant/components/alarmdecoder/__init__.py +++ b/homeassistant/components/alarmdecoder/__init__.py @@ -39,11 +39,6 @@ _LOGGER = logging.getLogger(__name__) PLATFORMS = ["alarm_control_panel", "sensor", "binary_sensor"] -async def async_setup(hass, config): - """Set up for the AlarmDecoder devices.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up AlarmDecoder config flow.""" undo_listener = entry.add_update_listener(_update_listener) diff --git a/homeassistant/components/apple_tv/__init__.py b/homeassistant/components/apple_tv/__init__.py index 6a78e0b451c..6f95fb56c4f 100644 --- a/homeassistant/components/apple_tv/__init__.py +++ b/homeassistant/components/apple_tv/__init__.py @@ -42,11 +42,6 @@ SIGNAL_DISCONNECTED = "apple_tv_disconnected" PLATFORMS = [MP_DOMAIN, REMOTE_DOMAIN] -async def async_setup(hass, config): - """Set up the Apple TV integration.""" - return True - - async def async_setup_entry(hass, entry): """Set up a config entry for Apple TV.""" manager = AppleTVManager(hass, entry) diff --git a/homeassistant/components/atag/__init__.py b/homeassistant/components/atag/__init__.py index f5507ff01bc..017e9968d1e 100644 --- a/homeassistant/components/atag/__init__.py +++ b/homeassistant/components/atag/__init__.py @@ -23,11 +23,6 @@ DOMAIN = "atag" PLATFORMS = [CLIMATE, WATER_HEATER, SENSOR] -async def async_setup(hass: HomeAssistant, config): - """Set up the Atag component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Atag integration from a config entry.""" diff --git a/homeassistant/components/awair/__init__.py b/homeassistant/components/awair/__init__.py index 76c3e95f897..a6969962be9 100644 --- a/homeassistant/components/awair/__init__.py +++ b/homeassistant/components/awair/__init__.py @@ -9,7 +9,6 @@ from python_awair import Awair from python_awair.exceptions import AuthError from homeassistant.const import CONF_ACCESS_TOKEN -from homeassistant.core import Config, HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -18,11 +17,6 @@ from .const import API_TIMEOUT, DOMAIN, LOGGER, UPDATE_INTERVAL, AwairResult PLATFORMS = ["sensor"] -async def async_setup(hass: HomeAssistant, config: Config) -> bool: - """Set up Awair integration.""" - return True - - async def async_setup_entry(hass, config_entry) -> bool: """Set up Awair integration from a config entry.""" session = async_get_clientsession(hass) diff --git a/homeassistant/components/axis/__init__.py b/homeassistant/components/axis/__init__.py index 8722c41c3e0..378d02bcccd 100644 --- a/homeassistant/components/axis/__init__.py +++ b/homeassistant/components/axis/__init__.py @@ -13,11 +13,6 @@ from .device import AxisNetworkDevice _LOGGER = logging.getLogger(__name__) -async def async_setup(hass, config): - """Old way to set up Axis devices.""" - return True - - async def async_setup_entry(hass, config_entry): """Set up the Axis component.""" hass.data.setdefault(AXIS_DOMAIN, {}) diff --git a/homeassistant/components/azure_devops/__init__.py b/homeassistant/components/azure_devops/__init__.py index e10bb4df886..ddafe33be8c 100644 --- a/homeassistant/components/azure_devops/__init__.py +++ b/homeassistant/components/azure_devops/__init__.py @@ -22,11 +22,6 @@ from homeassistant.helpers.typing import ConfigType, HomeAssistantType _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool: - """Set up the Azure DevOps components.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up Azure DevOps from a config entry.""" client = DevOpsClient() diff --git a/homeassistant/components/blebox/__init__.py b/homeassistant/components/blebox/__init__.py index e0b5a3c4f5d..c5f723b6858 100644 --- a/homeassistant/components/blebox/__init__.py +++ b/homeassistant/components/blebox/__init__.py @@ -22,11 +22,6 @@ PLATFORMS = ["cover", "sensor", "switch", "air_quality", "light", "climate"] PARALLEL_UPDATES = 0 -async def async_setup(hass: HomeAssistant, config: dict): - """Set up the BleBox devices component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up BleBox devices from a config entry.""" diff --git a/homeassistant/components/braviatv/__init__.py b/homeassistant/components/braviatv/__init__.py index 95debd9170d..d8f6d64b15f 100644 --- a/homeassistant/components/braviatv/__init__.py +++ b/homeassistant/components/braviatv/__init__.py @@ -10,11 +10,6 @@ from .const import BRAVIARC, DOMAIN, UNDO_UPDATE_LISTENER PLATFORMS = ["media_player"] -async def async_setup(hass, config): - """Set up the Bravia TV component.""" - return True - - async def async_setup_entry(hass, config_entry): """Set up a config entry.""" host = config_entry.data[CONF_HOST] diff --git a/homeassistant/components/brother/__init__.py b/homeassistant/components/brother/__init__.py index cfca805d51d..cd5a8b444b3 100644 --- a/homeassistant/components/brother/__init__.py +++ b/homeassistant/components/brother/__init__.py @@ -7,7 +7,7 @@ from brother import Brother, SnmpError, UnsupportedModel from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_TYPE -from homeassistant.core import Config, HomeAssistant +from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .const import DATA_CONFIG_ENTRY, DOMAIN, SNMP @@ -20,11 +20,6 @@ SCAN_INTERVAL = timedelta(seconds=30) _LOGGER = logging.getLogger(__name__) -async def async_setup(hass: HomeAssistant, config: Config): - """Set up the Brother component.""" - return True - - async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): """Set up Brother from a config entry.""" host = entry.data[CONF_HOST] diff --git a/homeassistant/components/cert_expiry/__init__.py b/homeassistant/components/cert_expiry/__init__.py index e8bc4c672ff..22b3ce56129 100644 --- a/homeassistant/components/cert_expiry/__init__.py +++ b/homeassistant/components/cert_expiry/__init__.py @@ -18,11 +18,6 @@ _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(hours=12) -async def async_setup(hass, config): - """Platform setup, do nothing.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): """Load the saved entities.""" host = entry.data[CONF_HOST] diff --git a/homeassistant/components/devolo_home_control/__init__.py b/homeassistant/components/devolo_home_control/__init__.py index e5ee9029302..e6f802348cd 100644 --- a/homeassistant/components/devolo_home_control/__init__.py +++ b/homeassistant/components/devolo_home_control/__init__.py @@ -15,11 +15,6 @@ from homeassistant.helpers.typing import HomeAssistantType from .const import CONF_MYDEVOLO, DOMAIN, GATEWAY_SERIAL_PATTERN, PLATFORMS -async def async_setup(hass, config): - """Get all devices and add them to hass.""" - return True - - async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool: """Set up the devolo account from a config entry.""" hass.data.setdefault(DOMAIN, {}) diff --git a/homeassistant/components/dialogflow/__init__.py b/homeassistant/components/dialogflow/__init__.py index e623919f099..6003f17c9e9 100644 --- a/homeassistant/components/dialogflow/__init__.py +++ b/homeassistant/components/dialogflow/__init__.py @@ -24,11 +24,6 @@ class DialogFlowError(HomeAssistantError): """Raised when a DialogFlow error happens.""" -async def async_setup(hass, config): - """Set up the Dialogflow component.""" - return True - - async def handle_webhook(hass, webhook_id, request): """Handle incoming webhook with Dialogflow requests.""" message = await request.json() diff --git a/homeassistant/components/dunehd/__init__.py b/homeassistant/components/dunehd/__init__.py index 68a6f0d83de..10c66c3bfb0 100644 --- a/homeassistant/components/dunehd/__init__.py +++ b/homeassistant/components/dunehd/__init__.py @@ -10,11 +10,6 @@ from .const import DOMAIN PLATFORMS = ["media_player"] -async def async_setup(hass, config): - """Set up the Dune HD component.""" - return True - - async def async_setup_entry(hass, config_entry): """Set up a config entry.""" host = config_entry.data[CONF_HOST] diff --git a/homeassistant/components/ipma/__init__.py b/homeassistant/components/ipma/__init__.py index a00941624f5..9a4d7f932e1 100644 --- a/homeassistant/components/ipma/__init__.py +++ b/homeassistant/components/ipma/__init__.py @@ -1,17 +1,10 @@ """Component for the Portuguese weather service - IPMA.""" -from homeassistant.core import Config, HomeAssistant - from .config_flow import IpmaFlowHandler # noqa: F401 from .const import DOMAIN # noqa: F401 DEFAULT_NAME = "ipma" -async def async_setup(hass: HomeAssistant, config: Config) -> bool: - """Set up configured IPMA.""" - return True - - async def async_setup_entry(hass, config_entry): """Set up IPMA station as config entry.""" hass.async_create_task( diff --git a/tests/components/alarmdecoder/test_config_flow.py b/tests/components/alarmdecoder/test_config_flow.py index 52d1686691c..2ab965023bd 100644 --- a/tests/components/alarmdecoder/test_config_flow.py +++ b/tests/components/alarmdecoder/test_config_flow.py @@ -76,8 +76,6 @@ async def test_setups(hass: HomeAssistant, protocol, connection, title): with patch("homeassistant.components.alarmdecoder.config_flow.AdExt.open"), patch( "homeassistant.components.alarmdecoder.config_flow.AdExt.close" ), patch( - "homeassistant.components.alarmdecoder.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.alarmdecoder.async_setup_entry", return_value=True, ) as mock_setup_entry: @@ -92,7 +90,6 @@ async def test_setups(hass: HomeAssistant, protocol, connection, title): } await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 diff --git a/tests/components/azure_devops/test_config_flow.py b/tests/components/azure_devops/test_config_flow.py index 4cda9076b98..744d04042e0 100644 --- a/tests/components/azure_devops/test_config_flow.py +++ b/tests/components/azure_devops/test_config_flow.py @@ -228,8 +228,6 @@ async def test_reauth_flow(hass: HomeAssistant) -> None: async def test_full_flow_implementation(hass: HomeAssistant) -> None: """Test registering an integration and finishing flow works.""" with patch( - "homeassistant.components.azure_devops.async_setup", return_value=True - ) as mock_setup, patch( "homeassistant.components.azure_devops.async_setup_entry", return_value=True, ) as mock_setup_entry, patch( @@ -255,7 +253,6 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None: FIXTURE_USER_INPUT, ) await hass.async_block_till_done() - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY diff --git a/tests/components/devolo_home_control/test_config_flow.py b/tests/components/devolo_home_control/test_config_flow.py index 7d2c9ce40f6..370d86c7c94 100644 --- a/tests/components/devolo_home_control/test_config_flow.py +++ b/tests/components/devolo_home_control/test_config_flow.py @@ -20,9 +20,6 @@ async def test_form(hass): assert result["errors"] == {} with patch( - "homeassistant.components.devolo_home_control.async_setup", - return_value=True, - ) as mock_setup, patch( "homeassistant.components.devolo_home_control.async_setup_entry", return_value=True, ) as mock_setup_entry, patch( @@ -43,7 +40,6 @@ async def test_form(hass): "mydevolo_url": "https://www.mydevolo.com", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1 @@ -90,9 +86,6 @@ async def test_form_advanced_options(hass): assert result["errors"] == {} with patch( - "homeassistant.components.devolo_home_control.async_setup", - return_value=True, - ) as mock_setup, patch( "homeassistant.components.devolo_home_control.async_setup_entry", return_value=True, ) as mock_setup_entry, patch( @@ -117,5 +110,4 @@ async def test_form_advanced_options(hass): "mydevolo_url": "https://test_mydevolo_url.test", } - assert len(mock_setup.mock_calls) == 1 assert len(mock_setup_entry.mock_calls) == 1