blob: 5948104e2abde012f55ce663e31d53db1a0a443f (
plain)
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
29
30
|
from enum import IntEnum
from typing import Optional
class Priority(IntEnum):
LOW = 0
MIDDLE = 1
HIGH = 2
values = [
Priority.LOW,
Priority.MIDDLE,
Priority.HIGH]
def format(priority: Priority) -> str:
if priority == Priority.LOW:
return "Low"
elif priority == Priority.MIDDLE:
return "Middle"
elif priority == Priority.HIGH:
return "High"
def parse(string: str) -> Optional[Priority]:
if string == "Low":
return Priority.LOW
elif string == "Middle":
return Priority.MIDDLE
elif string == "High":
return Priority.HIGH
else:
return None
|