Files
pyfa/eos/enum.py
DarkPhoenix fd36a0b172 Replace submodules with actual files
Submodules never were actually useful
2013-06-10 22:12:34 +04:00

21 lines
511 B
Python
Executable File

class Enum():
@classmethod
def getTypes(cls):
for stuff in cls.__dict__:
if stuff.upper() == stuff:
yield stuff
@classmethod
def getName(cls, v):
map = getattr(cls, "_map", None)
if map is None:
map = cls._map = {}
for type in cls.getTypes():
map[cls.getValue(type)] = type
return map.get(v)
@classmethod
def getValue(cls, type):
return cls.__dict__[type]