summaryrefslogtreecommitdiff
path: root/amqp_codegen.py
diff options
context:
space:
mode:
Diffstat (limited to 'amqp_codegen.py')
-rw-r--r--amqp_codegen.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/amqp_codegen.py b/amqp_codegen.py
index f6a2d73d..3d5e1e7f 100644
--- a/amqp_codegen.py
+++ b/amqp_codegen.py
@@ -87,10 +87,10 @@ def domains_merger(key, acc, new, ignore_conflicts):
return [[k, v] for (k, v) in merged.iteritems()]
def merge_dict_lists_by(dict_key, acc, new, ignore_conflicts):
- new_index = set(v[dict_key] for v in new)
- result = list(new) # shallow copy
- for v in acc:
- if v[dict_key] in new_index:
+ acc_index = set(v[dict_key] for v in acc)
+ result = list(acc) # shallow copy
+ for v in new:
+ if v[dict_key] in acc_index:
if not ignore_conflicts:
raise AmqpSpecFileMergeConflict(description, acc, new)
else:
@@ -117,11 +117,11 @@ def class_merger(acc, new, ignore_conflicts):
ignore_conflicts)
def classes_merger(key, acc, new, ignore_conflicts):
- new_dict = dict((v["name"], v) for v in new)
- result = list(new) # shallow copy
- for w in acc:
- if w["name"] in new_dict:
- class_merger(new_dict[w["name"]], w, ignore_conflicts)
+ acc_dict = dict((v["name"], v) for v in acc)
+ result = list(acc) # shallow copy
+ for w in new:
+ if w["name"] in acc_dict:
+ class_merger(acc_dict[w["name"]], w, ignore_conflicts)
else:
result.append(w)
return result