Skip to content

Commit 8389739

Browse files
committed
Update json_writer()
1 parent 75517c9 commit 8389739

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

scripts/manual_fixtures.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
import os
66

77

8-
def json_writer(manual_name: str, all_data: dict, notifications: dict):
8+
def json_writer(
9+
manual_name: str,
10+
all_data: dict,
11+
device_list: list[str],
12+
notifications: dict
13+
) -> None:
914
"""Standardized writing json files."""
1015
if not os.path.exists(f"./fixtures/{manual_name}"):
1116
os.makedirs(f"./fixtures/{manual_name}")
@@ -21,6 +26,17 @@ def json_writer(manual_name: str, all_data: dict, notifications: dict):
2126
with open(outfile, "w") as f:
2227
f.write(data + "\n")
2328

29+
outfile = f"./fixtures/{manual_name}/device_list.json"
30+
data = json.dumps(
31+
device_list,
32+
indent=2,
33+
separators=(",", ": "),
34+
sort_keys=False,
35+
default=lambda x: list(x) if isinstance(x, set) else x,
36+
)
37+
with open(outfile, "w") as f:
38+
f.write(data + "\n")
39+
2440
outfile = f"./fixtures/{manual_name}/notifications.json"
2541
data = json.dumps(
2642
notifications,

0 commit comments

Comments
 (0)