1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 02:41:11 +01:00

utils/types: fix toggle_set merge methods

- The merge_with and merge_into implementation was reversed. Fix this, so that
  it is implemented correctly, i.e. that
  	a.merge_with(b) === merge(a, b)
	a.merge_into(b) === merge(b, a)
- Ensure that in case of merge_into(), a toggle_set is always returned.
This commit is contained in:
sergei Trofimov 2018-04-27 14:07:19 +01:00 committed by Marc Bonnici
parent 5b03ac3afd
commit 9093477f1b

View File

@ -390,12 +390,12 @@ class toggle_set(set):
set.__init__(self, *args)
def merge_with(self, other):
new_self = copy(self)
return toggle_set.merge(other, new_self)
other = copy(other)
return toggle_set.merge(self, toggle_set(other))
def merge_into(self, other):
other = copy(other)
return toggle_set.merge(self, other)
new_self = copy(self)
return toggle_set.merge(other, new_self)
def add(self, item):
if item not in self: