File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change 1
1
import csv
2
+ from collections import defaultdict
2
3
from collections .abc import Container
3
4
from dataclasses import dataclass
4
5
from datetime import datetime
@@ -250,20 +251,11 @@ def update_dicts(
250
251
print (f"spoken_form_entries: { spoken_form_entries } " )
251
252
252
253
# 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 )
267
259
268
260
if handle_new_values is not None :
269
261
handle_new_values (spoken_form_entries )
You can’t perform that action at this time.
0 commit comments