blob: 873369da00e1f70700dda5816f3aa984460d4eeb (
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
MEDIUM = 1
HIGH = 2
values = [
Priority.LOW,
Priority.MEDIUM,
Priority.HIGH]
def format(priority: Priority) -> str:
if priority == Priority.LOW:
return 'Low'
elif priority == Priority.MEDIUM:
return 'Medium'
elif priority == Priority.HIGH:
return 'High'
def parse(string: str) -> Optional[Priority]:
if string == 'Low':
return Priority.LOW
elif string == 'Medium':
return Priority.MEDIUM
elif string == 'High':
return Priority.HIGH
else:
return None
|