-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflow.py
More file actions
28 lines (23 loc) · 702 Bytes
/
flow.py
File metadata and controls
28 lines (23 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from enum import IntEnum
class AliroFlow(IntEnum):
FAST = 0x00
STANDARD = 0x01
STEP_UP = 0x02
@classmethod
def parse(cls, value):
if isinstance(value, cls):
return value
if isinstance(value, int):
return cls(value)
normalized = str(value).strip().lower().replace("-", "_")
aliases = {
"expedited": cls.FAST,
"fast": cls.FAST,
"standard": cls.STANDARD,
"attestation": cls.STEP_UP,
"step_up": cls.STEP_UP,
"stepup": cls.STEP_UP,
}
if normalized in aliases:
return aliases[normalized]
return cls[normalized.upper()]