-
Notifications
You must be signed in to change notification settings - Fork 0
/
fee_util.py
50 lines (36 loc) · 1.1 KB
/
fee_util.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import enum
import re
class PayInterval(enum.Enum):
MONTHLY = 1
SIX_MONTH = 2
YEARLY = 3
VARIABLE = 4
class CommonFee(enum.Enum):
STUDENT = 10
REGULAR = 23
SUPPORTER = 36
class AllFee(enum.Enum):
STUDENT = 10
REGULAR = 23
SUPPORTER = 36
SYMBOLIC = 1
REDUCED_3 = 3
REDUCED_5 = 5
STUDENT_15 = 15
REGULAR_18 = 18
class DetectMethod(enum.IntEnum):
MANUAL = 100
FEE_COMMAND = 90
LAST_FEE = 20
MULTIPLE_OF_FEE = 10
MULTIPLE_OF_COMMON_FEE = 5
FALLBACK = 0
common_fee_amounts = {f.value: f.name for f in CommonFee}
fee_amounts = {f.value: f.name for f in AllFee}
d = lambda name, num: r'(?P<%s>\d{%d})' % (name, num)
space_or_start = r'(?:^|\s)'
space_or_end = r'(?=$|\s)'
iso_ym = lambda suffix: d('year'+suffix, 4) + r'-' + d('month'+suffix, 2)
month_regex_ymd_range = re.compile(space_or_start + iso_ym('_start') + r'\s-\s'+ iso_ym('_end') + space_or_end)
month_regex_ymd = re.compile(space_or_start + iso_ym('') + space_or_end)
month_regex_ym = re.compile(space_or_start + d('month', 2) + r'/' + d('year', 4) + space_or_end)