Skip to content

Commit caffebf

Browse files
committed
More fixes
1 parent 48af95f commit caffebf

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

cursorless-talon/src/csv_overrides.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import csv
2+
from collections import defaultdict
23
from collections.abc import Container
34
from dataclasses import dataclass
45
from datetime import datetime
@@ -250,20 +251,11 @@ def update_dicts(
250251
print(f"spoken_form_entries: {spoken_form_entries}")
251252

252253
# Assign result to talon context list
253-
assign_lists_to_context(
254-
ctx,
255-
{
256-
list_name: {
257-
spoken_form: entry.id
258-
for entry in spoken_form_entries
259-
for spoken_form in entry.spoken_forms
260-
}
261-
for list_name, spoken_form_entries in groupby(
262-
spoken_form_entries, key=lambda x: x.list_name
263-
)
264-
},
265-
pluralize_lists,
266-
)
254+
lists: ListToSpokenForms = defaultdict(dict)
255+
for entry in spoken_form_entries:
256+
for spoken_form in entry.spoken_forms:
257+
lists[entry.list_name][spoken_form] = entry.id
258+
assign_lists_to_context(ctx, lists, pluralize_lists)
267259

268260
if handle_new_values is not None:
269261
handle_new_values(spoken_form_entries)

0 commit comments

Comments
 (0)