mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Ensure there are no duplicates in the merged/intersected lists
This commit is contained in:
@@ -1004,17 +1004,20 @@ def is_list_of_strings(items):
|
||||
return True
|
||||
|
||||
def list_union(a, b):
|
||||
result = list(a)
|
||||
for i in b:
|
||||
if i not in result:
|
||||
result.append(i)
|
||||
result = []
|
||||
for x in a:
|
||||
if x not in result:
|
||||
result.append(x)
|
||||
for x in b:
|
||||
if x not in result:
|
||||
result.append(x)
|
||||
return result
|
||||
|
||||
def list_intersection(a, b):
|
||||
result = []
|
||||
for i in a:
|
||||
if i in b:
|
||||
result.append(i)
|
||||
for x in a:
|
||||
if x in b and x not in result:
|
||||
result.append(x)
|
||||
return result
|
||||
|
||||
def safe_eval(expr, locals={}, include_exceptions=False):
|
||||
|
||||
Reference in New Issue
Block a user