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

utils/types: When creating an enum also try to deserialize from POD

Allows for recreating an Enum from a full string representation of the Enum
rather than just the name of the Enum.
This commit is contained in:
Marc Bonnici 2018-11-29 10:31:39 +00:00 committed by setrofim
parent 0113940c85
commit 4f67cda89f

View File

@ -635,7 +635,10 @@ def enum(args, start=0, step=1):
if name == attr:
return attr
raise ValueError('Invalid enum value: {}'.format(repr(name)))
try:
return Enum.from_pod(name)
except ValueError:
raise ValueError('Invalid enum value: {}'.format(repr(name)))
reserved = ['values', 'levels', 'names']