Use assignment expressions 01 (#56394)

This commit is contained in:
Marc Mueller
2021-09-19 01:31:35 +02:00
committed by GitHub
parent a4f6c3336f
commit 7af67d34cf
21 changed files with 73 additions and 171 deletions

View File

@@ -512,9 +512,7 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: dict) -> Non
# Only load auth during startup.
if not hasattr(hass, "auth"):
auth_conf = config.get(CONF_AUTH_PROVIDERS)
if auth_conf is None:
if (auth_conf := config.get(CONF_AUTH_PROVIDERS)) is None:
auth_conf = [{"type": "homeassistant"}]
mfa_conf = config.get(
@@ -598,9 +596,7 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: dict) -> Non
cust_glob = OrderedDict(config[CONF_CUSTOMIZE_GLOB])
for name, pkg in config[CONF_PACKAGES].items():
pkg_cust = pkg.get(CONF_CORE)
if pkg_cust is None:
if (pkg_cust := pkg.get(CONF_CORE)) is None:
continue
try:
@@ -957,9 +953,7 @@ def async_notify_setup_error(
# pylint: disable=import-outside-toplevel
from homeassistant.components import persistent_notification
errors = hass.data.get(DATA_PERSISTENT_ERRORS)
if errors is None:
if (errors := hass.data.get(DATA_PERSISTENT_ERRORS)) is None:
errors = hass.data[DATA_PERSISTENT_ERRORS] = {}
errors[component] = errors.get(component) or display_link