Use generator instead of single-list-unpack in PurpleAir config flow (#84922)

This commit is contained in:
Aaron Bach 2022-12-31 13:07:12 -07:00 committed by GitHub
parent c6a0c7eccc
commit 82977a43d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,11 +126,11 @@ def async_get_sensor_index(
Note that this method expects that there will always be a single sensor index per
DeviceEntry.
"""
[sensor_index] = [
sensor_index = next(
sensor_index
for sensor_index in config_entry.options[CONF_SENSOR_INDICES]
if (DOMAIN, str(sensor_index)) in device_entry.identifiers
]
)
return cast(int, sensor_index)