Skip to content

Commit

Permalink
Improved string enum, allowed define different value than key
Browse files Browse the repository at this point in the history
  • Loading branch information
matllubos committed Jul 9, 2017
1 parent b39126b commit 8f4eeb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion chamber/utils/datastructures.py
Expand Up @@ -21,7 +21,10 @@ def __getattr__(self, name):
class Enum(AbstractEnum):

def __init__(self, *items):
self.container = OrderedDict(((item, item) for item in items))
self.container = OrderedDict((
item if isinstance(item, (list, tuple)) else (item, item)
for item in items
))
super(Enum, self).__init__()

def _get_attr_val(self, name):
Expand Down

0 comments on commit 8f4eeb6

Please sign in to comment.