/GUI/Generic/Enumerations.py
https://bitbucket.org/alsh/pygui-mirror · Python · 16 lines · 10 code · 3 blank · 3 comment · 3 complexity · 7453ef07b596f36fd9cc373f266368ab MD5 · raw file
- #
- # PyGUI - Enumerated type facilities
- #
- class EnumMap(dict):
- def __init__(self, __name__, *args, **kwds):
- self.name = __name__
- dict.__init__(self, *args, **kwds)
-
- def __getitem__(self, key):
- try:
- return dict.__getitem__(self, key)
- except KeyError:
- raise ValueError("Invalid %s '%s', should be one of %s" %
- (self.name, key, ", ".join(["'%s'" % val for val in self.keys()])))