1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

utils/types: Add module_name_set type

The list of modules retrieved from a `Target` may include configuration
as a dictionary. This helper function will produce a set of only the
module names allowing for comparison.
This commit is contained in:
Marc Bonnici 2020-01-16 14:49:26 +00:00 committed by setrofim
parent a66251dd60
commit 977ce4995d

View File

@ -218,6 +218,20 @@ def version_tuple(v):
return tuple(map(str, (v.split(".")))) return tuple(map(str, (v.split("."))))
def module_name_set(l):
"""
Converts a list of target modules into a set of module names, disregarding
any configuration that may be present.
"""
modules = set()
for m in l:
if m and isinstance(m, dict):
modules.update({k for k in m.keys()})
else:
modules.add(m)
return modules
__counters = defaultdict(int) __counters = defaultdict(int)