Skip to content

Commit

Permalink
perf: add break to for loops once item discovered
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Jan 15, 2020
1 parent 4a29e63 commit 82f8af2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ async def update_devices(login_obj):
for b_state in bluetooth["bluetoothStates"]:
if device["serialNumber"] == b_state["deviceSerialNumber"]:
device["bluetooth_state"] = b_state
break

if "devicePreferences" in preferences:
for dev in preferences["devicePreferences"]:
Expand All @@ -520,6 +521,7 @@ async def update_devices(login_obj):
device["timeZoneId"],
hide_serial(device["serialNumber"]),
)
break

if "doNotDisturbDeviceStatusList" in dnd:
for dev in dnd["doNotDisturbDeviceStatusList"]:
Expand All @@ -530,6 +532,7 @@ async def update_devices(login_obj):
device["dnd"],
hide_serial(device["serialNumber"]),
)
break
hass.data[DATA_ALEXAMEDIA]["accounts"][email]["auth_info"] = device[
"auth_info"
] = auth_info
Expand Down

0 comments on commit 82f8af2

Please sign in to comment.