mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 22:11:44 -07:00
parent
19dbff916f
commit
85bd6810bb
2 changed files with 66 additions and 22 deletions
|
@ -1005,6 +1005,22 @@ def is_list_of_strings(items):
|
|||
return False
|
||||
return True
|
||||
|
||||
def _listify(a):
|
||||
if not isinstance(a, (list, tuple)):
|
||||
return [a,]
|
||||
else:
|
||||
return a
|
||||
|
||||
def list_union(a, b):
|
||||
set_a = set(_listify(a))
|
||||
set_b = set(_listify(b))
|
||||
return list(set_a.union(set_b))
|
||||
|
||||
def list_intersection(a, b):
|
||||
set_a = set(_listify(a))
|
||||
set_b = set(_listify(b))
|
||||
return list(set_a.intersection(set_b))
|
||||
|
||||
def safe_eval(expr, locals={}, include_exceptions=False):
|
||||
'''
|
||||
this is intended for allowing things like:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue