Skip to content

Commit e68475c

Browse files
author
autoruff
committed
fixup: xml_to_dict Python code fixed using ruff
1 parent 479ffd3 commit e68475c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

plugwise/__init__.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
import xmltodict
4545

4646

47-
def collect_module_data(result: dict[str, Any] , count=1) -> dict[str, Any]:
47+
def collect_module_data(result: dict[str, Any], count=1) -> dict[str, Any]:
4848
"""Collect the module data and link to a service id."""
49-
modules:dict[str, dict[str, str | None]] = {}
49+
modules: dict[str, dict[str, str | None]] = {}
5050
for module in result["domain_objects"]["module"]:
5151
link_id: str | None = None
5252
if module["services"] is not None:
@@ -77,8 +77,7 @@ def collect_module_data(result: dict[str, Any] , count=1) -> dict[str, Any]:
7777

7878

7979
def add_module_to_appliance(
80-
appliance: dict[str, Any],
81-
modules: list[dict[str, Any]]
80+
appliance: dict[str, Any], modules: list[dict[str, Any]]
8281
) -> tuple[dict[str, Any], bool]:
8382
"""Add module data to appliance."""
8483
module_set = False
@@ -88,7 +87,7 @@ def add_module_to_appliance(
8887
for value in log.values():
8988
if isinstance(value, dict) and "id" in value:
9089
if value["id"] == module:
91-
appliance.update( modules[module])
90+
appliance.update(modules[module])
9291
module_set = True
9392

9493
return (appliance, module_set)
@@ -180,12 +179,18 @@ async def connect(self) -> Version:
180179
(appliance, module_set) = add_module_to_appliance(appliance, modules)
181180
# Set gateway firmwware_version
182181
if appliance["type"] == "gateway":
183-
appliance["firmware_version"] = result_dict["domain_objects"]["gateway"]["firmware_version"]
182+
appliance["firmware_version"] = result_dict["domain_objects"][
183+
"gateway"
184+
]["firmware_version"]
184185
# TODO set zigbee mac(s)
185186
if not module_set:
186-
modules = collect_module_data(result, count=2) # repeat trying with 2nd id
187+
modules = collect_module_data(
188+
result, count=2
189+
) # repeat trying with 2nd id
187190
for appliance in result_dict["domain_objects"]["appliance"]:
188-
(appliance, module_set) = add_module_to_appliance(appliance, modules)
191+
(appliance, module_set) = add_module_to_appliance(
192+
appliance, modules
193+
)
189194
if not module_set:
190195
appliance.update(
191196
{

0 commit comments

Comments
 (0)