Use assignment expression for alexa init (#81242)

This commit is contained in:
Kevin Stillhammer 2022-11-23 20:54:16 +01:00 committed by GitHub
parent 8bd4125390
commit f43f0c4bcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,8 @@
"""Support for Alexa skill service end point.""" """Support for Alexa skill service end point."""
from __future__ import annotations
from typing import Any
import voluptuous as vol import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
@ -87,18 +91,14 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
config = config[DOMAIN] config = config[DOMAIN]
flash_briefings_config = config.get(CONF_FLASH_BRIEFINGS)
intent.async_setup(hass) 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) flash_briefings.async_setup(hass, flash_briefings_config)
try: # smart_home being absent is not the same as smart_home being None
smart_home_config = config[CONF_SMART_HOME] if CONF_SMART_HOME in config:
except KeyError: smart_home_config: dict[str, Any] | None = config[CONF_SMART_HOME]
pass
else:
smart_home_config = smart_home_config or SMART_HOME_SCHEMA({}) smart_home_config = smart_home_config or SMART_HOME_SCHEMA({})
await smart_home_http.async_setup(hass, smart_home_config) await smart_home_http.async_setup(hass, smart_home_config)