Merge of nested IF-IF cases - Core (#48364)

This commit is contained in:
Franck Nijhof
2021-03-27 09:23:32 +01:00
committed by GitHub
parent ad13a9295e
commit 45f77ccccf
4 changed files with 16 additions and 25 deletions

View File

@@ -315,10 +315,11 @@ async def async_prepare_setup_platform(
log_error(f"Unable to import the component ({exc}).")
return None
if hasattr(component, "setup") or hasattr(component, "async_setup"):
if not await async_setup_component(hass, integration.domain, hass_config):
log_error("Unable to set up component.")
return None
if (
hasattr(component, "setup") or hasattr(component, "async_setup")
) and not await async_setup_component(hass, integration.domain, hass_config):
log_error("Unable to set up component.")
return None
return platform