Skip to content

Commit 942b277

Browse files
committed
🎨 Make generated module IDs stable
Problem: - Module IDs are generated from a `set` of strings. This means that the ordering is not stable. Solution: - Sort the set to a list before assigning IDs.
1 parent 2e0cc4f commit 942b277

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/gen_str_catalog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def get_id(stable_ids, key_fn, gen, obj):
124124

125125
unique_strings = {i[0][0]: i for i in strings}.values()
126126
return (
127-
{m: {"string": module_string(m), "id": get_module_id(m)} for m in set(modules)},
127+
{m: {"string": module_string(m), "id": get_module_id(m)} for m in sorted(set(modules))},
128128
{item[0]: {**item[1], "id": get_msg_id(item[1])} for item in unique_strings},
129129
)
130130

0 commit comments

Comments
 (0)