mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 05:24:17 +00:00
refactor the parsing
This commit is contained in:
@@ -5,3 +5,15 @@ 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()
|
||||
|
||||
Reference in New Issue
Block a user