1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-05 16:08:54 +00:00
Files
dotdrop/dotdrop/linktypes.py
2019-05-31 18:30:19 +02:00

20 lines
454 B
Python

from enum import IntEnum
class LinkTypes(IntEnum):
NOLINK = 0
LINK = 1
LINK_CHILDREN = 2
@classmethod
def get(cls, key, default=None):
try:
return key if isinstance(key, cls) else cls[key.upper()]
except KeyError:
if default:
return default
raise ValueError('bad {} value: "{}"'.format(cls.__name__, key))
def __str__(self):
return self.name.lower()