Use assignment expressions [other] (#66882)

This commit is contained in:
Marc Mueller 2022-02-19 17:22:51 +01:00 committed by GitHub
parent 4f20a8023b
commit 45d8d04c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 15 additions and 35 deletions

View file

@ -839,8 +839,7 @@ def async_removed_from_device(
if "config_entries" not in event.data["changes"]:
return False
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get(device_id)
if not device_entry:
if not (device_entry := device_registry.async_get(device_id)):
# The device is already removed, do cleanup when we get "remove" event
return False
if config_entry_id in device_entry.config_entries: