Skip to content

Commit 92126a1

Browse files
committed
Implement improvement suggestions from SonarCloud
1 parent f8ac940 commit 92126a1

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

custom_components/plugwise/coordinator.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,17 @@ async def _async_remove_devices(self, data: dict[str, GwEntityData]) -> None:
154154
# Then remove the connected orphaned device(s)
155155
for device_entry in device_list:
156156
for identifier in device_entry.identifiers:
157-
if identifier[0] == DOMAIN:
158-
if (
159-
device_entry.via_device_id == via_device_id
160-
and identifier[1] not in data
161-
):
162-
device_reg.async_update_device(
163-
device_entry.id, remove_config_entry_id=self.config_entry.entry_id
164-
)
165-
LOGGER.debug(
166-
"Removed %s device/zone %s %s from device_registry",
167-
DOMAIN,
168-
device_entry.model,
169-
identifier[1],
170-
)
157+
if (
158+
identifier[0] == DOMAIN
159+
and device_entry.via_device_id == via_device_id
160+
and identifier[1] not in data
161+
):
162+
device_reg.async_update_device(
163+
device_entry.id, remove_config_entry_id=self.config_entry.entry_id
164+
)
165+
LOGGER.debug(
166+
"Removed %s device/zone %s %s from device_registry",
167+
DOMAIN,
168+
device_entry.model,
169+
identifier[1],
170+
)

tests/components/plugwise/test_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ async def test_update_device(
328328
== 9
329329
)
330330
item_list: list[str] = []
331-
for device_entry in list(device_registry.devices.values()):
331+
for device_entry in device_registry.devices.values():
332332
item_list.extend(x[1] for x in device_entry.identifiers)
333333
assert "01234567890abcdefghijklmnopqrstu" in item_list
334334

@@ -355,6 +355,6 @@ async def test_update_device(
355355
== 8
356356
)
357357
item_list: list[str] = []
358-
for device_entry in list(device_registry.devices.values()):
358+
for device_entry in device_registry.devices.values():
359359
item_list.extend(x[1] for x in device_entry.identifiers)
360360
assert "1772a4ea304041adb83f357b751341ff" not in item_list

0 commit comments

Comments
 (0)