From f43f0c4bcc070664519d14485cca1a462014a597 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Wed, 23 Nov 2022 20:54:16 +0100 Subject: [PATCH] Use assignment expression for alexa init (#81242) --- homeassistant/components/alexa/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/alexa/__init__.py b/homeassistant/components/alexa/__init__.py index d28ff5dc804..0008ba26f8a 100644 --- a/homeassistant/components/alexa/__init__.py +++ b/homeassistant/components/alexa/__init__.py @@ -1,4 +1,8 @@ """Support for Alexa skill service end point.""" +from __future__ import annotations + +from typing import Any + import voluptuous as vol from homeassistant.const import ( @@ -87,18 +91,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: config = config[DOMAIN] - flash_briefings_config = config.get(CONF_FLASH_BRIEFINGS) - intent.async_setup(hass) - if flash_briefings_config: + if flash_briefings_config := config.get(CONF_FLASH_BRIEFINGS): flash_briefings.async_setup(hass, flash_briefings_config) - try: - smart_home_config = config[CONF_SMART_HOME] - except KeyError: - pass - else: + # smart_home being absent is not the same as smart_home being None + if CONF_SMART_HOME in config: + smart_home_config: dict[str, Any] | None = config[CONF_SMART_HOME] smart_home_config = smart_home_config or SMART_HOME_SCHEMA({}) await smart_home_http.async_setup(hass, smart_home_config)