-
Notifications
You must be signed in to change notification settings - Fork 19
/
appsettings.py
102 lines (93 loc) · 3.23 KB
/
appsettings.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from dateutil.relativedelta import relativedelta
try:
from django.core.exceptions import ImproperlyConfigured
try:
from django.conf import settings
EDTF = getattr(settings, "EDTF", {})
except ImproperlyConfigured:
EDTF = {}
except ImportError:
EDTF = {}
SEASON_MONTHS_RANGE = EDTF.get(
"SEASON_MONTHS_RANGE",
{
# season id: [earliest_month, last_month]
21: [3, 5],
22: [6, 8],
23: [9, 11],
# winter in the northern hemisphere wraps the end of the year, so
# Winter 2010 could wrap into 2011.
# For simplicity, we assume it falls at the end of the year, esp since the
# spec says that sort order goes spring > summer > autumn > winter
24: [12, 12],
},
)
SEASON_L2_MONTHS_RANGE = EDTF.get(
"SEASON_L2_MONTHS_RANGE",
{
# season id: [earliest_month, last_month]
21: [3, 5],
22: [6, 8],
23: [9, 11],
# winter in the northern hemisphere wraps the end of the year, so
# Winter 2010 could wrap into 2011.
# For simplicity, we assume it falls at the end of the year, esp since the
# spec says that sort order goes spring > summer > autumn > winter
24: [12, 12],
# spring in the northern hemisphere
25: [3, 5],
# summer in the northern hemisphere
26: [6, 8],
# fall/autumn in the northern hemisphere
27: [9, 11],
# winter in the northern hemisphere wraps the end of the year
28: [12, 12],
# spring in the southern hemisphere
29: [9, 11],
# summer in the southern hemisphere
30: [12, 12],
# fall/autumn in the southern hemisphere
31: [3, 5],
# winter in the southern hemisphere
32: [6, 8],
33: [1, 3],
34: [4, 6],
35: [7, 9],
36: [10, 12],
37: [1, 4],
38: [5, 8],
39: [9, 12],
40: [1, 6],
41: [7, 12],
},
)
DAY_FIRST = EDTF.get("DAY_FIRST", False) # Americans!
SEASONS = EDTF.get(
"SEASONS",
{
21: "spring",
22: "summer",
23: "autumn",
24: "winter",
},
)
INVERSE_SEASONS = EDTF.get("INVERSE_SEASONS", {v: k for k, v in SEASONS.items()})
# also need to interpret `fall`
INVERSE_SEASONS["fall"] = 23
# changing these will break tests
PADDING_DAY_PRECISION = EDTF.get("PADDING_DAY_PRECISION", relativedelta(days=1))
PADDING_MONTH_PRECISION = EDTF.get("PADDING_MONTH_PRECISION", relativedelta(months=1))
PADDING_YEAR_PRECISION = EDTF.get("PADDING_YEAR_PRECISION", relativedelta(years=1))
PADDING_SEASON_PRECISION = EDTF.get("PADDING_SEASON_PRECISION", relativedelta(weeks=12))
PADDING_DECADE_PRECISION = EDTF.get("PADDING_DECADE_PRECISION", relativedelta(years=10))
PADDING_CENTURY_PRECISION = EDTF.get(
"PADDING_CENTURY_PRECISION", relativedelta(years=100)
)
PADDING_MILLENNIUM_PRECISION = EDTF.get(
"PADDING_MILLENNIUM_PRECISION", relativedelta(years=1000)
)
MULTIPLIER_IF_UNCERTAIN = EDTF.get("MULTIPLIER_IF_UNCERTAIN", 1.0)
MULTIPLIER_IF_APPROXIMATE = EDTF.get("MULTIPLIER_IF_APPROXIMATE", 1.0)
MULTIPLIER_IF_BOTH = EDTF.get("MULTIPLIER_IF_BOTH", 2.0)
DELTA_IF_UNKNOWN = EDTF.get("DELTA_IF_UNKNOWN", relativedelta(years=10))
DEBUG_PYPARSING = False