Use assignment expressions 03 (#57710)

This commit is contained in:
Marc Mueller
2021-10-17 20:08:11 +02:00
committed by GitHub
parent 2a8eaf0e0f
commit 238b488642
18 changed files with 49 additions and 102 deletions

View File

@@ -396,10 +396,11 @@ async def async_extract_config_entry_ids(
# Some devices may have no entities
for device_id in referenced.referenced_devices:
if device_id in dev_reg.devices:
device = dev_reg.async_get(device_id)
if device is not None:
config_entry_ids.update(device.config_entries)
if (
device_id in dev_reg.devices
and (device := dev_reg.async_get(device_id)) is not None
):
config_entry_ids.update(device.config_entries)
for entity_id in referenced.referenced | referenced.indirectly_referenced:
entry = ent_reg.async_get(entity_id)