Skip to content

Commit 368e280

Browse files
committed
refactor: use defaultdict properly
1 parent a76fc19 commit 368e280

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

backend/utils/methods_handler.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,25 @@
55
class Methods:
66
@staticmethod
77
def save_selection_to_frontend_file(
8-
selection_dataset, front_selection_resource_path
8+
selection_dataset, front_selection_resource_path
99
):
1010
with open(front_selection_resource_path, "w") as f:
1111
f.write("export const METHODS = ")
1212
json.dump(selection_dataset, f, indent=4)
1313

1414
@staticmethod
1515
def parse_frontend_file_to_dll_methods(
16-
front_selection_resource_path,
16+
front_selection_resource_path,
1717
):
1818
with open(front_selection_resource_path, "r") as f:
1919
content = f.read()
2020
prefix = "export const METHODS = "
21-
json_str = content[len(prefix) :]
21+
json_str = content[len(prefix):]
2222
selection_tree = json.loads(json_str)
2323

2424
dll_methods = defaultdict(list)
2525
for node in selection_tree:
2626
dll_name = node["title"] + ".dll"
27-
dll_methods[dll_name] = []
2827
for child in node["children"]:
2928
dll_methods[dll_name].append(child["value"])
3029
return dll_methods

0 commit comments

Comments
 (0)