holidays 0.26__py3-none-any.whl → 0.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- holidays/__init__.py +1 -1
- holidays/calendars/__init__.py +5 -7
- holidays/calendars/buddhist.py +1 -3
- holidays/calendars/chinese.py +1 -3
- holidays/calendars/custom.py +1 -3
- holidays/calendars/hindu.py +1 -3
- holidays/calendars/islamic.py +1341 -1345
- holidays/calendars/thai.py +217 -26
- holidays/countries/__init__.py +4 -0
- holidays/countries/albania.py +6 -17
- holidays/countries/andorra.py +2 -6
- holidays/countries/angola.py +53 -39
- holidays/countries/argentina.py +13 -24
- holidays/countries/aruba.py +109 -48
- holidays/countries/australia.py +31 -69
- holidays/countries/azerbaijan.py +30 -38
- holidays/countries/bahrain.py +5 -5
- holidays/countries/bangladesh.py +1 -3
- holidays/countries/belarus.py +1 -3
- holidays/countries/belize.py +4 -16
- holidays/countries/bolivia.py +2 -6
- holidays/countries/bosnia_and_herzegovina.py +5 -17
- holidays/countries/botswana.py +9 -18
- holidays/countries/brazil.py +2 -5
- holidays/countries/brunei.py +427 -0
- holidays/countries/bulgaria.py +2 -6
- holidays/countries/burkina_faso.py +141 -0
- holidays/countries/burundi.py +2 -5
- holidays/countries/cambodia.py +323 -0
- holidays/countries/cameroon.py +71 -77
- holidays/countries/canada.py +19 -28
- holidays/countries/chad.py +133 -0
- holidays/countries/chile.py +4 -11
- holidays/countries/china.py +1 -2
- holidays/countries/colombia.py +17 -15
- holidays/countries/costa_rica.py +2 -6
- holidays/countries/curacao.py +100 -46
- holidays/countries/cyprus.py +2 -6
- holidays/countries/czechia.py +4 -12
- holidays/countries/denmark.py +1 -3
- holidays/countries/dominican_republic.py +1 -3
- holidays/countries/ecuador.py +54 -54
- holidays/countries/egypt.py +2 -5
- holidays/countries/eswatini.py +34 -44
- holidays/countries/ethiopia.py +5 -14
- holidays/countries/finland.py +1 -3
- holidays/countries/gabon.py +49 -53
- holidays/countries/greece.py +1 -2
- holidays/countries/honduras.py +16 -13
- holidays/countries/hongkong.py +7 -8
- holidays/countries/hungary.py +93 -92
- holidays/countries/india.py +4 -11
- holidays/countries/indonesia.py +120 -114
- holidays/countries/ireland.py +5 -15
- holidays/countries/isle_of_man.py +9 -4
- holidays/countries/israel.py +6 -18
- holidays/countries/italy.py +1 -2
- holidays/countries/jamaica.py +10 -18
- holidays/countries/japan.py +10 -16
- holidays/countries/kazakhstan.py +7 -22
- holidays/countries/kenya.py +1 -3
- holidays/countries/kyrgyzstan.py +2 -5
- holidays/countries/latvia.py +2 -6
- holidays/countries/lesotho.py +52 -32
- holidays/countries/lithuania.py +4 -12
- holidays/countries/madagascar.py +3 -9
- holidays/countries/malawi.py +34 -26
- holidays/countries/malaysia.py +223 -248
- holidays/countries/marshall_islands.py +4 -9
- holidays/countries/mexico.py +1 -3
- holidays/countries/moldova.py +3 -6
- holidays/countries/monaco.py +16 -26
- holidays/countries/montenegro.py +23 -19
- holidays/countries/morocco.py +2 -5
- holidays/countries/mozambique.py +35 -31
- holidays/countries/namibia.py +54 -35
- holidays/countries/new_zealand.py +11 -21
- holidays/countries/nicaragua.py +26 -22
- holidays/countries/nigeria.py +6 -17
- holidays/countries/north_macedonia.py +3 -8
- holidays/countries/norway.py +1 -3
- holidays/countries/pakistan.py +71 -72
- holidays/countries/panama.py +25 -24
- holidays/countries/paraguay.py +54 -47
- holidays/countries/philippines.py +6 -2
- holidays/countries/poland.py +3 -9
- holidays/countries/portugal.py +3 -11
- holidays/countries/romania.py +3 -5
- holidays/countries/saudi_arabia.py +8 -22
- holidays/countries/serbia.py +19 -29
- holidays/countries/singapore.py +70 -74
- holidays/countries/slovakia.py +1 -4
- holidays/countries/south_africa.py +60 -62
- holidays/countries/south_korea.py +14 -23
- holidays/countries/spain.py +2 -5
- holidays/countries/sweden.py +1 -3
- holidays/countries/taiwan.py +2 -5
- holidays/countries/thailand.py +34 -81
- holidays/countries/turkey.py +1 -3
- holidays/countries/ukraine.py +6 -18
- holidays/countries/united_arab_emirates.py +21 -29
- holidays/countries/united_kingdom.py +47 -67
- holidays/countries/united_states.py +42 -72
- holidays/countries/vatican_city.py +1 -3
- holidays/countries/venezuela.py +8 -6
- holidays/countries/vietnam.py +6 -18
- holidays/countries/zambia.py +63 -33
- holidays/countries/zimbabwe.py +56 -37
- holidays/financial/european_central_bank.py +1 -3
- holidays/financial/ny_stock_exchange.py +31 -48
- holidays/groups/__init__.py +18 -0
- holidays/groups/buddhist.py +71 -0
- holidays/groups/chinese.py +235 -0
- holidays/groups/christian.py +483 -0
- holidays/groups/hindu.py +71 -0
- holidays/groups/international.py +157 -0
- holidays/groups/islamic.py +288 -0
- holidays/groups/thai.py +157 -0
- holidays/helpers.py +20 -0
- holidays/holiday_base.py +49 -75
- holidays/holiday_groups.py +11 -1190
- holidays/locale/am/LC_MESSAGES/ET.po +18 -15
- holidays/locale/ar/LC_MESSAGES/CA.po +43 -43
- holidays/locale/ar/LC_MESSAGES/ET.po +18 -15
- holidays/locale/ar/LC_MESSAGES/UA.po +16 -14
- holidays/locale/be/LC_MESSAGES/BY.po +9 -8
- holidays/locale/bg/LC_MESSAGES/BG.po +14 -12
- holidays/locale/da/LC_MESSAGES/DK.po +7 -6
- holidays/locale/el/LC_MESSAGES/CY.po +5 -3
- holidays/locale/el/LC_MESSAGES/GR.po +13 -13
- holidays/locale/en/LC_MESSAGES/CA.po +43 -43
- holidays/locale/en_US/LC_MESSAGES/AR.po +26 -25
- holidays/locale/en_US/LC_MESSAGES/AW.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/AW.po +87 -0
- holidays/locale/en_US/LC_MESSAGES/BG.po +14 -12
- holidays/locale/en_US/LC_MESSAGES/BN.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/BN.po +96 -0
- holidays/locale/en_US/LC_MESSAGES/BY.po +9 -8
- holidays/locale/en_US/LC_MESSAGES/CA.po +43 -43
- holidays/locale/en_US/LC_MESSAGES/CL.po +18 -18
- holidays/locale/en_US/LC_MESSAGES/CO.po +19 -19
- holidays/locale/en_US/LC_MESSAGES/CR.po +6 -5
- holidays/locale/en_US/LC_MESSAGES/CW.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/CW.po +82 -0
- holidays/locale/en_US/LC_MESSAGES/CY.po +5 -3
- holidays/locale/en_US/LC_MESSAGES/DK.po +7 -6
- holidays/locale/en_US/LC_MESSAGES/DO.po +12 -12
- holidays/locale/en_US/LC_MESSAGES/EC.po +11 -12
- holidays/locale/en_US/LC_MESSAGES/ET.po +18 -15
- holidays/locale/en_US/LC_MESSAGES/FI.po +13 -13
- holidays/locale/en_US/LC_MESSAGES/GR.po +13 -13
- holidays/locale/en_US/LC_MESSAGES/HN.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/HN.po +13 -13
- holidays/locale/en_US/LC_MESSAGES/HU.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/HU.po +109 -0
- holidays/locale/en_US/LC_MESSAGES/JP.po +19 -17
- holidays/locale/en_US/LC_MESSAGES/KH.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/KH.po +139 -0
- holidays/locale/en_US/LC_MESSAGES/MC.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/MC.po +16 -15
- holidays/locale/en_US/LC_MESSAGES/MD.po +5 -5
- holidays/locale/en_US/LC_MESSAGES/MX.po +3 -2
- holidays/locale/en_US/LC_MESSAGES/NI.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/NI.po +13 -13
- holidays/locale/en_US/LC_MESSAGES/NO.po +1 -1
- holidays/locale/en_US/LC_MESSAGES/PL.po +23 -21
- holidays/locale/en_US/LC_MESSAGES/PT.po +31 -31
- holidays/locale/en_US/LC_MESSAGES/PY.po +13 -11
- holidays/locale/en_US/LC_MESSAGES/RO.po +4 -3
- holidays/locale/en_US/LC_MESSAGES/RS.po +10 -10
- holidays/locale/en_US/LC_MESSAGES/SE.po +1 -1
- holidays/locale/en_US/LC_MESSAGES/SK.po +14 -14
- holidays/locale/en_US/LC_MESSAGES/TH.po +41 -41
- holidays/locale/en_US/LC_MESSAGES/UA.po +16 -14
- holidays/locale/en_US/LC_MESSAGES/VE.po +6 -6
- holidays/locale/es/LC_MESSAGES/AR.po +26 -25
- holidays/locale/es/LC_MESSAGES/CL.po +18 -18
- holidays/locale/es/LC_MESSAGES/CO.po +19 -19
- holidays/locale/es/LC_MESSAGES/CR.po +6 -5
- holidays/locale/es/LC_MESSAGES/DO.po +12 -12
- holidays/locale/es/LC_MESSAGES/EC.po +11 -12
- holidays/locale/es/LC_MESSAGES/HN.po +12 -12
- holidays/locale/es/LC_MESSAGES/MX.po +3 -2
- holidays/locale/es/LC_MESSAGES/NI.po +10 -10
- holidays/locale/es/LC_MESSAGES/PY.po +13 -11
- holidays/locale/es/LC_MESSAGES/VE.po +6 -6
- holidays/locale/fi/LC_MESSAGES/FI.po +13 -13
- holidays/locale/fr/LC_MESSAGES/CA.po +43 -43
- holidays/locale/fr/LC_MESSAGES/MC.po +15 -14
- holidays/locale/hu/LC_MESSAGES/HU.mo +0 -0
- holidays/locale/hu/LC_MESSAGES/HU.po +109 -0
- holidays/locale/ja/LC_MESSAGES/JP.po +19 -17
- holidays/locale/km/LC_MESSAGES/KH.mo +0 -0
- holidays/locale/km/LC_MESSAGES/KH.po +139 -0
- holidays/locale/ms/LC_MESSAGES/BN.mo +0 -0
- holidays/locale/ms/LC_MESSAGES/BN.po +96 -0
- holidays/locale/nl/LC_MESSAGES/AW.mo +0 -0
- holidays/locale/nl/LC_MESSAGES/AW.po +87 -0
- holidays/locale/nl/LC_MESSAGES/CW.mo +0 -0
- holidays/locale/nl/LC_MESSAGES/CW.po +82 -0
- holidays/locale/no/LC_MESSAGES/NO.po +1 -1
- holidays/locale/pap/LC_MESSAGES/AW.mo +0 -0
- holidays/locale/pap/LC_MESSAGES/AW.po +87 -0
- holidays/locale/pap/LC_MESSAGES/CW.mo +0 -0
- holidays/locale/pap/LC_MESSAGES/CW.po +82 -0
- holidays/locale/pl/LC_MESSAGES/PL.po +23 -21
- holidays/locale/pt_PT/LC_MESSAGES/PT.po +31 -31
- holidays/locale/ro/LC_MESSAGES/MD.po +5 -5
- holidays/locale/ro/LC_MESSAGES/RO.po +4 -3
- holidays/locale/sk/LC_MESSAGES/SK.po +14 -14
- holidays/locale/sr/LC_MESSAGES/RS.po +10 -10
- holidays/locale/sv/LC_MESSAGES/FI.po +13 -13
- holidays/locale/sv/LC_MESSAGES/SE.po +1 -1
- holidays/locale/th/LC_MESSAGES/BN.mo +0 -0
- holidays/locale/th/LC_MESSAGES/BN.po +96 -0
- holidays/locale/th/LC_MESSAGES/CA.po +43 -43
- holidays/locale/th/LC_MESSAGES/KH.mo +0 -0
- holidays/locale/th/LC_MESSAGES/KH.po +145 -0
- holidays/locale/th/LC_MESSAGES/TH.po +41 -41
- holidays/locale/uk/LC_MESSAGES/AR.po +26 -25
- holidays/locale/uk/LC_MESSAGES/AW.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/AW.po +87 -0
- holidays/locale/uk/LC_MESSAGES/CL.po +18 -18
- holidays/locale/uk/LC_MESSAGES/CO.po +19 -19
- holidays/locale/uk/LC_MESSAGES/CR.po +6 -5
- holidays/locale/uk/LC_MESSAGES/CW.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/CW.po +82 -0
- holidays/locale/uk/LC_MESSAGES/DK.po +7 -6
- holidays/locale/uk/LC_MESSAGES/DO.po +12 -12
- holidays/locale/uk/LC_MESSAGES/EC.po +11 -12
- holidays/locale/uk/LC_MESSAGES/FI.po +13 -13
- holidays/locale/uk/LC_MESSAGES/HN.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/HN.po +13 -13
- holidays/locale/uk/LC_MESSAGES/HU.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/HU.po +109 -0
- holidays/locale/uk/LC_MESSAGES/MC.po +15 -14
- holidays/locale/uk/LC_MESSAGES/MD.po +5 -5
- holidays/locale/uk/LC_MESSAGES/MX.po +3 -2
- holidays/locale/uk/LC_MESSAGES/NI.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/NI.po +13 -13
- holidays/locale/uk/LC_MESSAGES/NO.po +1 -1
- holidays/locale/uk/LC_MESSAGES/PL.po +23 -21
- holidays/locale/uk/LC_MESSAGES/PY.po +13 -11
- holidays/locale/uk/LC_MESSAGES/RO.po +4 -3
- holidays/locale/uk/LC_MESSAGES/SE.po +1 -1
- holidays/locale/uk/LC_MESSAGES/SK.po +14 -14
- holidays/locale/uk/LC_MESSAGES/UA.po +16 -14
- holidays/locale/uk/LC_MESSAGES/VE.po +6 -6
- holidays/registry.py +7 -11
- holidays/utils.py +5 -15
- {holidays-0.26.dist-info → holidays-0.27.dist-info}/METADATA +25 -7
- holidays-0.27.dist-info/RECORD +449 -0
- holidays-0.26.dist-info/RECORD +0 -402
- {holidays-0.26.dist-info → holidays-0.27.dist-info}/LICENSE +0 -0
- {holidays-0.26.dist-info → holidays-0.27.dist-info}/WHEEL +0 -0
- {holidays-0.26.dist-info → holidays-0.27.dist-info}/top_level.txt +0 -0
holidays/holiday_groups.py
CHANGED
|
@@ -9,1193 +9,14 @@
|
|
|
9
9
|
# Website: https://github.com/dr-prodigy/python-holidays
|
|
10
10
|
# License: MIT (see LICENSE file)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
from
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ChristianHolidays:
|
|
26
|
-
"""
|
|
27
|
-
Christian holidays.
|
|
28
|
-
"""
|
|
29
|
-
|
|
30
|
-
def __init__(self, calendar=GREGORIAN_CALENDAR) -> None:
|
|
31
|
-
self.__verify_calendar(calendar)
|
|
32
|
-
self.__calendar = calendar
|
|
33
|
-
|
|
34
|
-
def __get_christmas_day(self, calendar=None):
|
|
35
|
-
"""
|
|
36
|
-
Get Christmas Day date.
|
|
37
|
-
"""
|
|
38
|
-
calendar = calendar or self.__calendar
|
|
39
|
-
self.__verify_calendar(calendar)
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
date(self._year, DEC, 25)
|
|
43
|
-
if self.__is_gregorian_calendar(calendar)
|
|
44
|
-
else date(self._year, JAN, 7) # Orthodox.
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
def __get_easter_sunday(self, calendar=None):
|
|
48
|
-
"""
|
|
49
|
-
Get Easter Sunday date.
|
|
50
|
-
"""
|
|
51
|
-
calendar = calendar or self.__calendar
|
|
52
|
-
self.__verify_calendar(calendar)
|
|
53
|
-
|
|
54
|
-
return easter(
|
|
55
|
-
self._year,
|
|
56
|
-
method=EASTER_ORTHODOX
|
|
57
|
-
if calendar == JULIAN_CALENDAR
|
|
58
|
-
else EASTER_WESTERN,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
@staticmethod
|
|
62
|
-
def __is_gregorian_calendar(calendar):
|
|
63
|
-
"""
|
|
64
|
-
Return True if `calendar` is Gregorian calendar.
|
|
65
|
-
Return False otherwise.
|
|
66
|
-
"""
|
|
67
|
-
return calendar == GREGORIAN_CALENDAR
|
|
68
|
-
|
|
69
|
-
@staticmethod
|
|
70
|
-
def __verify_calendar(calendar):
|
|
71
|
-
"""
|
|
72
|
-
Verify calendar type.
|
|
73
|
-
"""
|
|
74
|
-
if calendar not in {GREGORIAN_CALENDAR, JULIAN_CALENDAR}:
|
|
75
|
-
raise ValueError(
|
|
76
|
-
f"Unknown calendar name: {calendar}. "
|
|
77
|
-
"Use `GREGORIAN_CALENDAR` or `JULIAN_CALENDAR`."
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
@property
|
|
81
|
-
def _christmas_day(self):
|
|
82
|
-
"""
|
|
83
|
-
Return Christmas Day date.
|
|
84
|
-
"""
|
|
85
|
-
return self.__get_christmas_day()
|
|
86
|
-
|
|
87
|
-
@property
|
|
88
|
-
def _easter_sunday(self):
|
|
89
|
-
"""
|
|
90
|
-
Return Easter Sunday date.
|
|
91
|
-
"""
|
|
92
|
-
return self.__get_easter_sunday()
|
|
93
|
-
|
|
94
|
-
def _add_all_saints_day(self, name) -> date:
|
|
95
|
-
"""
|
|
96
|
-
Add All Saints' Day (November 1st).
|
|
97
|
-
|
|
98
|
-
Also known as All Hallows' Day, the Feast of All Saints,
|
|
99
|
-
the Feast of All Hallows, the Solemnity of All Saints, and Hallowmas.
|
|
100
|
-
https://en.wikipedia.org/wiki/All_Saints%27_Day
|
|
101
|
-
"""
|
|
102
|
-
return self._add_holiday(name, NOV, 1)
|
|
103
|
-
|
|
104
|
-
def _add_all_souls_day(self, name) -> date:
|
|
105
|
-
"""
|
|
106
|
-
Add All Souls' Day (November 2nd).
|
|
107
|
-
|
|
108
|
-
All Souls' Day is a day of prayer and remembrance for the faithful
|
|
109
|
-
departed, observed by certain Christian denominations on 2 November.
|
|
110
|
-
https://en.wikipedia.org/wiki/All_Souls%27_Day
|
|
111
|
-
"""
|
|
112
|
-
return self._add_holiday(name, NOV, 2)
|
|
113
|
-
|
|
114
|
-
def _add_ascension_thursday(self, name) -> date:
|
|
115
|
-
"""
|
|
116
|
-
Add Ascension Thursday (39 days after the Easter Sunday).
|
|
117
|
-
|
|
118
|
-
The Solemnity of the Ascension of Jesus Christ, also called Ascension
|
|
119
|
-
Day, or sometimes Holy Thursday.
|
|
120
|
-
https://en.wikipedia.org/wiki/Feast_of_the_Ascension
|
|
121
|
-
"""
|
|
122
|
-
return self._add_holiday(
|
|
123
|
-
name,
|
|
124
|
-
self._easter_sunday + td(days=+39),
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
def _add_ash_monday(self, name) -> date:
|
|
128
|
-
"""
|
|
129
|
-
Add Ash Monday (48 days before Easter Sunday).
|
|
130
|
-
|
|
131
|
-
The Clean Monday, also known as Pure Monday, Monday of Lent
|
|
132
|
-
or Green Monday. The first day of Great Lent.
|
|
133
|
-
https://en.wikipedia.org/wiki/Clean_Monday
|
|
134
|
-
"""
|
|
135
|
-
return self._add_holiday(
|
|
136
|
-
name,
|
|
137
|
-
self._easter_sunday + td(days=-48),
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
def _add_ash_wednesday(self, name) -> date:
|
|
141
|
-
"""
|
|
142
|
-
Add Ash Wednesday (46 days before Easter Sunday).
|
|
143
|
-
|
|
144
|
-
A holy day of prayer and fasting. It marks the beginning of Lent.
|
|
145
|
-
https://en.wikipedia.org/wiki/Ash_Wednesday
|
|
146
|
-
"""
|
|
147
|
-
return self._add_holiday(
|
|
148
|
-
name,
|
|
149
|
-
self._easter_sunday + td(days=-46),
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
def _add_assumption_of_mary_day(self, name) -> date:
|
|
153
|
-
"""
|
|
154
|
-
Add Assumption Of Mary (August 15th).
|
|
155
|
-
|
|
156
|
-
The Feast of the Assumption of Mary, or simply The Assumption marks the
|
|
157
|
-
occasion of the Virgin Mary's bodily ascent to heaven at the end of
|
|
158
|
-
her life.
|
|
159
|
-
https://en.wikipedia.org/wiki/Assumption_of_Mary
|
|
160
|
-
"""
|
|
161
|
-
return self._add_holiday(name, AUG, 15)
|
|
162
|
-
|
|
163
|
-
def _add_candlemas(self, name) -> date:
|
|
164
|
-
"""
|
|
165
|
-
Add Candlemas (February 2nd).
|
|
166
|
-
|
|
167
|
-
Also known as the Feast of the Presentation of Jesus Christ,
|
|
168
|
-
the Feast of the Purification of the Blessed Virgin Mary, or the Feast
|
|
169
|
-
of the Holy Encounter, is a Christian holiday commemorating the
|
|
170
|
-
presentation of Jesus at the Temple.
|
|
171
|
-
https://en.wikipedia.org/wiki/Candlemas
|
|
172
|
-
"""
|
|
173
|
-
return self._add_holiday(name, FEB, 2)
|
|
174
|
-
|
|
175
|
-
def _add_carnival_monday(self, name) -> date:
|
|
176
|
-
"""
|
|
177
|
-
Add Carnival Monday (48 days before Easter Sunday).
|
|
178
|
-
|
|
179
|
-
Carnival is a Catholic Christian festive season that occurs before
|
|
180
|
-
the liturgical season of Lent.
|
|
181
|
-
https://en.wikipedia.org/wiki/Carnival
|
|
182
|
-
"""
|
|
183
|
-
return self._add_holiday(
|
|
184
|
-
name,
|
|
185
|
-
self._easter_sunday + td(days=-48),
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
def _add_carnival_tuesday(self, name) -> date:
|
|
189
|
-
"""
|
|
190
|
-
Add Carnival Monday (47 days before Easter Sunday).
|
|
191
|
-
|
|
192
|
-
Carnival is a Catholic Christian festive season that occurs before
|
|
193
|
-
the liturgical season of Lent.
|
|
194
|
-
https://en.wikipedia.org/wiki/Carnival
|
|
195
|
-
"""
|
|
196
|
-
return self._add_holiday(
|
|
197
|
-
name,
|
|
198
|
-
self._easter_sunday + td(days=-47),
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
def _add_christmas_day(self, name, calendar=None) -> date:
|
|
202
|
-
"""
|
|
203
|
-
Add Christmas Day.
|
|
204
|
-
|
|
205
|
-
Christmas is an annual festival commemorating the birth of
|
|
206
|
-
Jesus Christ.
|
|
207
|
-
https://en.wikipedia.org/wiki/Christmas
|
|
208
|
-
"""
|
|
209
|
-
calendar = calendar or self.__calendar
|
|
210
|
-
self.__verify_calendar(calendar)
|
|
211
|
-
|
|
212
|
-
return self._add_holiday(
|
|
213
|
-
name,
|
|
214
|
-
self.__get_christmas_day(calendar),
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
def _add_christmas_day_two(self, name, calendar=None) -> date:
|
|
218
|
-
"""
|
|
219
|
-
Add Christmas Day 2.
|
|
220
|
-
|
|
221
|
-
A holiday celebrated after Christmas Day, also known as Boxing Day.
|
|
222
|
-
https://en.wikipedia.org/wiki/Boxing_Day
|
|
223
|
-
https://en.wikipedia.org/wiki/Christmas
|
|
224
|
-
"""
|
|
225
|
-
calendar = calendar or self.__calendar
|
|
226
|
-
self.__verify_calendar(calendar)
|
|
227
|
-
|
|
228
|
-
return self._add_holiday(
|
|
229
|
-
name,
|
|
230
|
-
self.__get_christmas_day(calendar) + td(days=+1),
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
def _add_christmas_day_three(self, name, calendar=None) -> date:
|
|
234
|
-
"""
|
|
235
|
-
Add Christmas Day 3.
|
|
236
|
-
|
|
237
|
-
A holiday celebrated 2 days after Christmas Day (in some countries).
|
|
238
|
-
https://en.wikipedia.org/wiki/Christmas
|
|
239
|
-
"""
|
|
240
|
-
calendar = calendar or self.__calendar
|
|
241
|
-
self.__verify_calendar(calendar)
|
|
242
|
-
|
|
243
|
-
return self._add_holiday(
|
|
244
|
-
name,
|
|
245
|
-
self.__get_christmas_day(calendar) + td(days=+2),
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
def _add_christmas_eve(self, name, calendar=None) -> date:
|
|
249
|
-
"""
|
|
250
|
-
Add Christmas Eve.
|
|
251
|
-
|
|
252
|
-
Christmas Eve is the evening or entire day before Christmas Day,
|
|
253
|
-
the festival commemorating the birth of Jesus Christ.
|
|
254
|
-
https://en.wikipedia.org/wiki/Christmas_Eve
|
|
255
|
-
"""
|
|
256
|
-
calendar = calendar or self.__calendar
|
|
257
|
-
self.__verify_calendar(calendar)
|
|
258
|
-
|
|
259
|
-
return self._add_holiday(
|
|
260
|
-
name,
|
|
261
|
-
self.__get_christmas_day(calendar) + td(days=-1),
|
|
262
|
-
)
|
|
263
|
-
|
|
264
|
-
def _add_corpus_christi_day(self, name) -> date:
|
|
265
|
-
"""
|
|
266
|
-
Add Feast Of Corpus Christi (60 days after Easter Sunday).
|
|
267
|
-
|
|
268
|
-
The Feast of Corpus Christi, also known as the Solemnity of the Most
|
|
269
|
-
Holy Body and Blood of Christ, is a Christian liturgical solemnity
|
|
270
|
-
celebrating the Real Presence of the Body and Blood, Soul and Divinity
|
|
271
|
-
of Jesus Christ in the elements of the Eucharist.
|
|
272
|
-
https://en.wikipedia.org/wiki/Feast_of_Corpus_Christi
|
|
273
|
-
"""
|
|
274
|
-
return self._add_holiday(
|
|
275
|
-
name,
|
|
276
|
-
self._easter_sunday + td(days=+60),
|
|
277
|
-
)
|
|
278
|
-
|
|
279
|
-
def _add_easter_monday(self, name, calendar=None) -> date:
|
|
280
|
-
"""
|
|
281
|
-
Add Easter Monday (1 day after Easter Sunday).
|
|
282
|
-
|
|
283
|
-
Easter Monday refers to the day after Easter Sunday in either the
|
|
284
|
-
Eastern or Western Christian traditions. It is a public holiday in
|
|
285
|
-
some countries.
|
|
286
|
-
https://en.wikipedia.org/wiki/Easter_Monday
|
|
287
|
-
"""
|
|
288
|
-
return self._add_holiday(
|
|
289
|
-
name,
|
|
290
|
-
self.__get_easter_sunday(calendar) + td(days=+1),
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
def _add_easter_sunday(self, name, calendar=None) -> date:
|
|
294
|
-
"""
|
|
295
|
-
Add Easter Sunday.
|
|
296
|
-
|
|
297
|
-
Easter, also called Pascha or Resurrection Sunday is a Christian
|
|
298
|
-
festival and cultural holiday commemorating the resurrection of Jesus
|
|
299
|
-
from the dead.
|
|
300
|
-
https://en.wikipedia.org/wiki/Easter
|
|
301
|
-
"""
|
|
302
|
-
return self._add_holiday(name, self.__get_easter_sunday(calendar))
|
|
303
|
-
|
|
304
|
-
def _add_epiphany_day(self, name, calendar=None) -> date:
|
|
305
|
-
"""
|
|
306
|
-
Add Epiphany Day.
|
|
307
|
-
|
|
308
|
-
Epiphany, also known as Theophany in Eastern Christian traditions,
|
|
309
|
-
is a Christian feast day that celebrates the revelation of God
|
|
310
|
-
incarnate as Jesus Christ.
|
|
311
|
-
https://en.wikipedia.org/wiki/Epiphany_(holiday)
|
|
312
|
-
"""
|
|
313
|
-
calendar = calendar or self.__calendar
|
|
314
|
-
self.__verify_calendar(calendar)
|
|
315
|
-
|
|
316
|
-
return self._add_holiday(
|
|
317
|
-
name,
|
|
318
|
-
date(self._year, JAN, 6)
|
|
319
|
-
if self.__is_gregorian_calendar(calendar)
|
|
320
|
-
else date(self._year, JAN, 19),
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
def _add_good_friday(self, name, calendar=None) -> date:
|
|
324
|
-
"""
|
|
325
|
-
Add Good Friday (2 days before Easter Sunday).
|
|
326
|
-
|
|
327
|
-
Good Friday is a Christian holiday commemorating the crucifixion of
|
|
328
|
-
Jesus and his death at Calvary. It is also known as Holy Friday,
|
|
329
|
-
Great Friday, Great and Holy Friday.
|
|
330
|
-
https://en.wikipedia.org/wiki/Good_Friday
|
|
331
|
-
"""
|
|
332
|
-
return self._add_holiday(
|
|
333
|
-
name,
|
|
334
|
-
self.__get_easter_sunday(calendar) + td(days=-2),
|
|
335
|
-
)
|
|
336
|
-
|
|
337
|
-
def _add_holy_saturday(self, name) -> date:
|
|
338
|
-
"""
|
|
339
|
-
Add Holy Saturday (1 day before Easter Sunday).
|
|
340
|
-
|
|
341
|
-
Great and Holy Saturday is a day between Good Friday and Easter Sunday.
|
|
342
|
-
https://en.wikipedia.org/wiki/Holy_Saturday
|
|
343
|
-
"""
|
|
344
|
-
return self._add_holiday(
|
|
345
|
-
name,
|
|
346
|
-
self._easter_sunday + td(days=-1),
|
|
347
|
-
)
|
|
348
|
-
|
|
349
|
-
def _add_holy_thursday(self, name) -> date:
|
|
350
|
-
"""
|
|
351
|
-
Add Holy Thursday (3 days before Easter Sunday).
|
|
352
|
-
|
|
353
|
-
Holy Thursday or Maundy Thursday is the day during Holy Week that
|
|
354
|
-
commemorates the Washing of the Feet (Maundy) and Last Supper of
|
|
355
|
-
Jesus Christ with the Apostles, as described in the canonical gospels.
|
|
356
|
-
https://en.wikipedia.org/wiki/Maundy_Thursday
|
|
357
|
-
"""
|
|
358
|
-
return self._add_holiday(
|
|
359
|
-
name,
|
|
360
|
-
self._easter_sunday + td(days=-3),
|
|
361
|
-
)
|
|
362
|
-
|
|
363
|
-
def _add_immaculate_conception_day(self, name) -> date:
|
|
364
|
-
"""
|
|
365
|
-
Add Immaculate Conception Day (December 8th).
|
|
366
|
-
|
|
367
|
-
https://en.wikipedia.org/wiki/Immaculate_Conception
|
|
368
|
-
"""
|
|
369
|
-
return self._add_holiday(name, DEC, 8)
|
|
370
|
-
|
|
371
|
-
def _add_nativity_of_mary_day(self, name) -> date:
|
|
372
|
-
"""
|
|
373
|
-
Add Nativity Of Mary Day (September 8th).
|
|
374
|
-
|
|
375
|
-
The Nativity of the Blessed Virgin Mary, the Nativity of Mary,
|
|
376
|
-
the Marymas or the Birth of the Virgin Mary, refers to a Christian
|
|
377
|
-
feast day celebrating the birth of Mary, mother of Jesus.
|
|
378
|
-
https://en.wikipedia.org/wiki/Nativity_of_Mary
|
|
379
|
-
"""
|
|
380
|
-
return self._add_holiday(name, SEP, 8)
|
|
381
|
-
|
|
382
|
-
def _add_palm_sunday(self, name) -> date:
|
|
383
|
-
"""
|
|
384
|
-
Add Palm Sunday (7 days before Easter Sunday).
|
|
385
|
-
|
|
386
|
-
Palm Sunday is a Christian moveable feast that falls on the Sunday
|
|
387
|
-
before Easter. The feast commemorates Christ's triumphal entry into
|
|
388
|
-
Jerusalem, an event mentioned in each of the four canonical Gospels.
|
|
389
|
-
Palm Sunday marks the first day of Holy Week.
|
|
390
|
-
https://en.wikipedia.org/wiki/Palm_Sunday
|
|
391
|
-
"""
|
|
392
|
-
return self._add_holiday(
|
|
393
|
-
name,
|
|
394
|
-
self._easter_sunday + td(days=-7),
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
def _add_rejoicing_day(self, name) -> date:
|
|
398
|
-
"""
|
|
399
|
-
Add Day Of Rejoicing (9 days after Easter Sunday).
|
|
400
|
-
|
|
401
|
-
Add Day Of Rejoicing ("Radonitsa"), in the Russian Orthodox Church is
|
|
402
|
-
a commemoration of the departed observed on the second Tuesday of
|
|
403
|
-
Pascha (Easter).In Ukrainian tradition it is called Provody.
|
|
404
|
-
https://en.wikipedia.org/wiki/Radonitsa
|
|
405
|
-
"""
|
|
406
|
-
return self._add_holiday(
|
|
407
|
-
name,
|
|
408
|
-
self._easter_sunday + td(days=+9),
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
def _add_saint_georges_day(self, name) -> date:
|
|
412
|
-
"""
|
|
413
|
-
Add Saint George's Day (April 23th).
|
|
414
|
-
|
|
415
|
-
Saint George's Day is celebrated on 23 April, the traditionally
|
|
416
|
-
accepted date of the saint's death.
|
|
417
|
-
https://en.wikipedia.org/wiki/Saint_George%27s_Day
|
|
418
|
-
"""
|
|
419
|
-
return self._add_holiday(name, APR, 23)
|
|
420
|
-
|
|
421
|
-
def _add_saint_james_day(self, name) -> date:
|
|
422
|
-
"""
|
|
423
|
-
Add Saint James' Day (July 25th).
|
|
424
|
-
|
|
425
|
-
James the Great was one of the Twelve Apostles of Jesus.
|
|
426
|
-
https://en.wikipedia.org/wiki/James_the_Great#Feast
|
|
427
|
-
"""
|
|
428
|
-
return self._add_holiday(name, JUL, 25)
|
|
429
|
-
|
|
430
|
-
def _add_saint_johns_day(self, name) -> date:
|
|
431
|
-
"""
|
|
432
|
-
Add Saint John's Day (June 24th).
|
|
433
|
-
|
|
434
|
-
The Nativity of John the Baptist is a Christian feast day celebrating
|
|
435
|
-
the birth of John the Baptist.
|
|
436
|
-
https://en.wikipedia.org/wiki/Nativity_of_John_the_Baptist
|
|
437
|
-
"""
|
|
438
|
-
return self._add_holiday(name, JUN, 24)
|
|
439
|
-
|
|
440
|
-
def _add_saint_josephs_day(self, name) -> date:
|
|
441
|
-
"""
|
|
442
|
-
Add Saint Joseph's Day (March 19th).
|
|
443
|
-
|
|
444
|
-
Saint Joseph's Day, also called the Feast of Saint Joseph or the
|
|
445
|
-
Solemnity of Saint Joseph, is in Western Christianity the principal
|
|
446
|
-
feast day of Saint Joseph, husband of the Virgin Mary and legal father
|
|
447
|
-
of Jesus Christ.
|
|
448
|
-
https://en.wikipedia.org/wiki/Saint_Joseph%27s_Day
|
|
449
|
-
"""
|
|
450
|
-
return self._add_holiday(name, MAR, 19)
|
|
451
|
-
|
|
452
|
-
def _add_saints_peter_and_paul_day(self, name) -> date:
|
|
453
|
-
"""
|
|
454
|
-
Feast of Saints Peter and Paul (June 29th).
|
|
455
|
-
|
|
456
|
-
A liturgical feast in honor of the martyrdom in Rome of the apostles
|
|
457
|
-
Saint Peter and Saint Paul, which is observed on 29 June.
|
|
458
|
-
https://en.wikipedia.org/wiki/Feast_of_Saints_Peter_and_Paul
|
|
459
|
-
"""
|
|
460
|
-
return self._add_holiday(name, JUN, 29)
|
|
461
|
-
|
|
462
|
-
def _add_whit_monday(self, name) -> date:
|
|
463
|
-
"""
|
|
464
|
-
Add Whit Monday (50 days after Easter Sunday).
|
|
465
|
-
|
|
466
|
-
Whit Monday or Pentecost Monday, also known as Monday of the
|
|
467
|
-
Holy Spirit, is the holiday celebrated the day after Pentecost.
|
|
468
|
-
https://en.wikipedia.org/wiki/Pentecost
|
|
469
|
-
https://en.wikipedia.org/wiki/Whit_Monday
|
|
470
|
-
"""
|
|
471
|
-
return self._add_holiday(
|
|
472
|
-
name,
|
|
473
|
-
self._easter_sunday + td(days=+50),
|
|
474
|
-
)
|
|
475
|
-
|
|
476
|
-
def _add_whit_sunday(self, name) -> date:
|
|
477
|
-
"""
|
|
478
|
-
Add Whit Sunday (49 days after Easter Sunday).
|
|
479
|
-
|
|
480
|
-
Whit Sunday, also called Pentecost, is a holiday which commemorates
|
|
481
|
-
the descent of the Holy Spirit upon the Apostles and other followers
|
|
482
|
-
of Jesus Christ while they were in Jerusalem celebrating the
|
|
483
|
-
Feast of Weeks.
|
|
484
|
-
https://en.wikipedia.org/wiki/Pentecost
|
|
485
|
-
"""
|
|
486
|
-
return self._add_holiday(
|
|
487
|
-
name,
|
|
488
|
-
self._easter_sunday + td(days=+49),
|
|
489
|
-
)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
class BuddhistCalendarHolidays:
|
|
493
|
-
"""
|
|
494
|
-
Buddhist lunisolar calendar holidays.
|
|
495
|
-
"""
|
|
496
|
-
|
|
497
|
-
def __init__(
|
|
498
|
-
self, calendar=_BuddhistLunisolar(), show_estimated=False
|
|
499
|
-
) -> None:
|
|
500
|
-
self._buddhist_calendar = calendar
|
|
501
|
-
self._show_estimated = show_estimated
|
|
502
|
-
|
|
503
|
-
def _add_buddhist_calendar_holiday(
|
|
504
|
-
self,
|
|
505
|
-
name: str,
|
|
506
|
-
hol_date: Tuple[date, bool],
|
|
507
|
-
) -> Optional[date]:
|
|
508
|
-
"""
|
|
509
|
-
Add Buddhist calendar holiday.
|
|
510
|
-
|
|
511
|
-
Adds customizable estimation label to holiday name if holiday date
|
|
512
|
-
is an estimation.
|
|
513
|
-
"""
|
|
514
|
-
estimated_label = getattr(self, "estimated_label", "%s* (*estimated)")
|
|
515
|
-
dt, is_estimated = hol_date
|
|
516
|
-
|
|
517
|
-
return self._add_holiday(
|
|
518
|
-
self.tr(estimated_label) % self.tr(name)
|
|
519
|
-
if is_estimated and self._show_estimated
|
|
520
|
-
else name,
|
|
521
|
-
dt,
|
|
522
|
-
)
|
|
523
|
-
|
|
524
|
-
def _add_vesak(self, name) -> Optional[date]:
|
|
525
|
-
"""
|
|
526
|
-
Add Vesak (15th day of the 4th lunar month).
|
|
527
|
-
|
|
528
|
-
Vesak for Thailand, Laos, Singapore and Indonesia.
|
|
529
|
-
https://en.wikipedia.org/wiki/Vesak
|
|
530
|
-
"""
|
|
531
|
-
return self._add_buddhist_calendar_holiday(
|
|
532
|
-
name,
|
|
533
|
-
self._buddhist_calendar.vesak_date(self._year),
|
|
534
|
-
)
|
|
535
|
-
|
|
536
|
-
def _add_vesak_may(self, name) -> Optional[date]:
|
|
537
|
-
"""
|
|
538
|
-
Add Vesak (on the day of the first full moon in May
|
|
539
|
-
in the Gregorian calendar).
|
|
540
|
-
|
|
541
|
-
Vesak for Sri Lanka, Nepal, India, Bangladesh and Malaysia.
|
|
542
|
-
https://en.wikipedia.org/wiki/Vesak
|
|
543
|
-
"""
|
|
544
|
-
return self._add_buddhist_calendar_holiday(
|
|
545
|
-
name,
|
|
546
|
-
self._buddhist_calendar.vesak_may_date(self._year),
|
|
547
|
-
)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
class ChineseCalendarHolidays:
|
|
551
|
-
"""
|
|
552
|
-
Chinese lunisolar calendar holidays.
|
|
553
|
-
"""
|
|
554
|
-
|
|
555
|
-
def __init__(
|
|
556
|
-
self, calendar=_ChineseLunisolar(), show_estimated=False
|
|
557
|
-
) -> None:
|
|
558
|
-
self._chinese_calendar = calendar
|
|
559
|
-
self._show_estimated = show_estimated
|
|
560
|
-
|
|
561
|
-
@property
|
|
562
|
-
def _chinese_new_year(self):
|
|
563
|
-
"""
|
|
564
|
-
Return Chinese New Year date.
|
|
565
|
-
"""
|
|
566
|
-
return self._chinese_calendar.lunar_new_year_date(self._year)[0]
|
|
567
|
-
|
|
568
|
-
@property
|
|
569
|
-
def _qingming_date(self):
|
|
570
|
-
day = 5
|
|
571
|
-
if (self._year % 4 < 1) or (self._year % 4 < 2 and self._year >= 2009):
|
|
572
|
-
day = 4
|
|
573
|
-
return date(self._year, APR, day)
|
|
574
|
-
|
|
575
|
-
@property
|
|
576
|
-
def _mid_autumn_festival(self):
|
|
577
|
-
"""
|
|
578
|
-
Return Mid Autumn Festival (15th day of the 8th lunar month) date.
|
|
579
|
-
"""
|
|
580
|
-
return self._chinese_calendar.mid_autumn_date(self._year)[0]
|
|
581
|
-
|
|
582
|
-
def _add_chinese_calendar_holiday(
|
|
583
|
-
self,
|
|
584
|
-
name: str,
|
|
585
|
-
hol_date: Tuple[date, bool],
|
|
586
|
-
days_delta: int = 0,
|
|
587
|
-
) -> Optional[date]:
|
|
588
|
-
"""
|
|
589
|
-
Add Chinese calendar holiday.
|
|
590
|
-
|
|
591
|
-
Adds customizable estimation label to holiday name if holiday date
|
|
592
|
-
is an estimation.
|
|
593
|
-
"""
|
|
594
|
-
estimated_label = getattr(self, "estimated_label", "%s* (*estimated)")
|
|
595
|
-
dt, is_estimated = hol_date
|
|
596
|
-
if days_delta != 0:
|
|
597
|
-
dt += td(days=days_delta)
|
|
598
|
-
|
|
599
|
-
return self._add_holiday(
|
|
600
|
-
self.tr(estimated_label) % self.tr(name)
|
|
601
|
-
if is_estimated and self._show_estimated
|
|
602
|
-
else name,
|
|
603
|
-
dt,
|
|
604
|
-
)
|
|
605
|
-
|
|
606
|
-
def _add_chinese_birthday_of_buddha(self, name) -> Optional[date]:
|
|
607
|
-
"""
|
|
608
|
-
Add Birthday of the Buddha by Chinese lunar calendar (8th day of the
|
|
609
|
-
4th lunar month).
|
|
610
|
-
|
|
611
|
-
Birthday of the Buddha is a Buddhist festival that is celebrated in
|
|
612
|
-
most of East Asia and South Asia commemorating the birth of Gautama
|
|
613
|
-
Buddha, who was the founder of Buddhism.
|
|
614
|
-
https://en.wikipedia.org/wiki/Buddha%27s_Birthday
|
|
615
|
-
"""
|
|
616
|
-
return self._add_chinese_calendar_holiday(
|
|
617
|
-
name,
|
|
618
|
-
self._chinese_calendar.buddha_birthday_date(self._year),
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
def _add_chinese_new_years_eve(self, name) -> Optional[date]:
|
|
622
|
-
"""
|
|
623
|
-
Add Chinese New Year's Eve (last day of 12th lunar month).
|
|
624
|
-
|
|
625
|
-
Chinese New Year's Eve is the day before the Chinese New Year.
|
|
626
|
-
https://en.wikipedia.org/wiki/Chinese_New_Year%27s_Eve
|
|
627
|
-
"""
|
|
628
|
-
return self._add_chinese_calendar_holiday(
|
|
629
|
-
name,
|
|
630
|
-
self._chinese_calendar.lunar_new_year_date(self._year),
|
|
631
|
-
days_delta=-1,
|
|
632
|
-
)
|
|
633
|
-
|
|
634
|
-
def _add_chinese_new_years_day(self, name) -> Optional[date]:
|
|
635
|
-
"""
|
|
636
|
-
Add Chinese New Year's Day (first day of the first lunar month).
|
|
637
|
-
|
|
638
|
-
Chinese New Year is the festival that celebrates the beginning of
|
|
639
|
-
a new year on the traditional lunisolar and solar Chinese calendar.
|
|
640
|
-
https://en.wikipedia.org/wiki/Chinese_New_Year
|
|
641
|
-
"""
|
|
642
|
-
return self._add_chinese_calendar_holiday(
|
|
643
|
-
name,
|
|
644
|
-
self._chinese_calendar.lunar_new_year_date(self._year),
|
|
645
|
-
)
|
|
646
|
-
|
|
647
|
-
def _add_chinese_new_years_day_two(self, name) -> Optional[date]:
|
|
648
|
-
"""
|
|
649
|
-
Add Chinese New Year's Day Two.
|
|
650
|
-
|
|
651
|
-
https://en.wikipedia.org/wiki/Chinese_New_Year
|
|
652
|
-
"""
|
|
653
|
-
return self._add_chinese_calendar_holiday(
|
|
654
|
-
name,
|
|
655
|
-
self._chinese_calendar.lunar_new_year_date(self._year),
|
|
656
|
-
days_delta=+1,
|
|
657
|
-
)
|
|
658
|
-
|
|
659
|
-
def _add_chinese_new_years_day_three(self, name) -> Optional[date]:
|
|
660
|
-
"""
|
|
661
|
-
Add Chinese New Year's Day Three.
|
|
662
|
-
|
|
663
|
-
https://en.wikipedia.org/wiki/Chinese_New_Year
|
|
664
|
-
"""
|
|
665
|
-
return self._add_chinese_calendar_holiday(
|
|
666
|
-
name,
|
|
667
|
-
self._chinese_calendar.lunar_new_year_date(self._year),
|
|
668
|
-
days_delta=+2,
|
|
669
|
-
)
|
|
670
|
-
|
|
671
|
-
def _add_chinese_new_years_day_four(self, name) -> Optional[date]:
|
|
672
|
-
"""
|
|
673
|
-
Add Chinese New Year's Day Four.
|
|
674
|
-
|
|
675
|
-
https://en.wikipedia.org/wiki/Chinese_New_Year
|
|
676
|
-
"""
|
|
677
|
-
return self._add_chinese_calendar_holiday(
|
|
678
|
-
name,
|
|
679
|
-
self._chinese_calendar.lunar_new_year_date(self._year),
|
|
680
|
-
days_delta=+3,
|
|
681
|
-
)
|
|
682
|
-
|
|
683
|
-
def _add_chinese_new_years_day_five(self, name) -> Optional[date]:
|
|
684
|
-
"""
|
|
685
|
-
Add Chinese New Year's Day Five.
|
|
686
|
-
|
|
687
|
-
https://en.wikipedia.org/wiki/Chinese_New_Year
|
|
688
|
-
"""
|
|
689
|
-
return self._add_chinese_calendar_holiday(
|
|
690
|
-
name,
|
|
691
|
-
self._chinese_calendar.lunar_new_year_date(self._year),
|
|
692
|
-
days_delta=+4,
|
|
693
|
-
)
|
|
694
|
-
|
|
695
|
-
def _add_qingming_festival(self, name) -> date:
|
|
696
|
-
"""
|
|
697
|
-
Add Qingming Festival (15th day after the Spring Equinox).
|
|
698
|
-
|
|
699
|
-
The Qingming festival or Ching Ming Festival, also known as
|
|
700
|
-
Tomb-Sweeping Day in English, is a traditional Chinese festival.
|
|
701
|
-
https://en.wikipedia.org/wiki/Qingming_Festival
|
|
702
|
-
"""
|
|
703
|
-
return self._add_holiday(name, self._qingming_date)
|
|
704
|
-
|
|
705
|
-
def _add_double_ninth_festival(self, name) -> Optional[date]:
|
|
706
|
-
"""
|
|
707
|
-
Add Double Ninth Festival (9th day of 9th lunar month).
|
|
708
|
-
|
|
709
|
-
The Double Ninth Festival (Chongyang Festival in Mainland China
|
|
710
|
-
and Taiwan or Chung Yeung Festival in Hong Kong and Macau).
|
|
711
|
-
https://en.wikipedia.org/wiki/Double_Ninth_Festival
|
|
712
|
-
"""
|
|
713
|
-
return self._add_chinese_calendar_holiday(
|
|
714
|
-
name, self._chinese_calendar.double_ninth_date(self._year)
|
|
715
|
-
)
|
|
716
|
-
|
|
717
|
-
def _add_dragon_boat_festival(self, name) -> Optional[date]:
|
|
718
|
-
"""
|
|
719
|
-
Add Dragon Boat Festival (5th day of 5th lunar month).
|
|
720
|
-
|
|
721
|
-
The Dragon Boat Festival is a traditional Chinese holiday which occurs
|
|
722
|
-
on the fifth day of the fifth month of the Chinese calendar.
|
|
723
|
-
https://en.wikipedia.org/wiki/Dragon_Boat_Festival
|
|
724
|
-
"""
|
|
725
|
-
return self._add_chinese_calendar_holiday(
|
|
726
|
-
name, self._chinese_calendar.dragon_boat_date(self._year)
|
|
727
|
-
)
|
|
728
|
-
|
|
729
|
-
def _add_hung_kings_day(self, name) -> Optional[date]:
|
|
730
|
-
"""
|
|
731
|
-
Add Hùng Kings' Temple Festival (10th day of the 3rd lunar month).
|
|
732
|
-
|
|
733
|
-
Vietnamese festival held annually from the 8th to the 11th day of the
|
|
734
|
-
3rd lunar month in honour of the Hùng Kings.
|
|
735
|
-
https://en.wikipedia.org/wiki/H%C3%B9ng_Kings%27_Festival
|
|
736
|
-
"""
|
|
737
|
-
return self._add_chinese_calendar_holiday(
|
|
738
|
-
name,
|
|
739
|
-
self._chinese_calendar.hung_kings_date(self._year),
|
|
740
|
-
)
|
|
741
|
-
|
|
742
|
-
def _add_mid_autumn_festival(self, name) -> Optional[date]:
|
|
743
|
-
"""
|
|
744
|
-
Add Mid Autumn Festival (15th day of the 8th lunar month).
|
|
745
|
-
|
|
746
|
-
The Mid-Autumn Festival, also known as the Moon Festival or
|
|
747
|
-
Mooncake Festival.
|
|
748
|
-
https://en.wikipedia.org/wiki/Mid-Autumn_Festival
|
|
749
|
-
"""
|
|
750
|
-
return self._add_chinese_calendar_holiday(
|
|
751
|
-
name,
|
|
752
|
-
self._chinese_calendar.mid_autumn_date(self._year),
|
|
753
|
-
)
|
|
754
|
-
|
|
755
|
-
def _add_mid_autumn_festival_day_two(self, name) -> Optional[date]:
|
|
756
|
-
"""
|
|
757
|
-
Add Mid Autumn Festival Day Two (16th day of the 8th lunar month).
|
|
758
|
-
|
|
759
|
-
The Mid-Autumn Festival, also known as the Moon Festival or
|
|
760
|
-
Mooncake Festival.
|
|
761
|
-
https://en.wikipedia.org/wiki/Mid-Autumn_Festival
|
|
762
|
-
"""
|
|
763
|
-
return self._add_chinese_calendar_holiday(
|
|
764
|
-
name,
|
|
765
|
-
self._chinese_calendar.mid_autumn_date(self._year),
|
|
766
|
-
days_delta=+1,
|
|
767
|
-
)
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
class HinduCalendarHolidays:
|
|
771
|
-
"""
|
|
772
|
-
Hindu lunisolar calendar holidays.
|
|
773
|
-
"""
|
|
774
|
-
|
|
775
|
-
def __init__(
|
|
776
|
-
self, calendar=_HinduLunisolar(), show_estimated=False
|
|
777
|
-
) -> None:
|
|
778
|
-
self._hindu_calendar = calendar
|
|
779
|
-
self._show_estimated = show_estimated
|
|
780
|
-
|
|
781
|
-
def _add_hindu_calendar_holiday(
|
|
782
|
-
self,
|
|
783
|
-
name: str,
|
|
784
|
-
hol_date: Tuple[date, bool],
|
|
785
|
-
) -> Optional[date]:
|
|
786
|
-
"""
|
|
787
|
-
Add Hindu calendar holiday.
|
|
788
|
-
|
|
789
|
-
Adds customizable estimation label to holiday name if holiday date
|
|
790
|
-
is an estimation.
|
|
791
|
-
"""
|
|
792
|
-
estimated_label = getattr(self, "estimated_label", "%s* (*estimated)")
|
|
793
|
-
|
|
794
|
-
dt, is_estimated = hol_date
|
|
795
|
-
return self._add_holiday(
|
|
796
|
-
self.tr(estimated_label) % self.tr(name)
|
|
797
|
-
if is_estimated and self._show_estimated
|
|
798
|
-
else name,
|
|
799
|
-
dt,
|
|
800
|
-
)
|
|
801
|
-
|
|
802
|
-
def _add_diwali(self, name) -> Optional[date]:
|
|
803
|
-
"""
|
|
804
|
-
Add Diwali Festival.
|
|
805
|
-
|
|
806
|
-
Diwali (Deepavali, Festival of Lights) is one of the most important
|
|
807
|
-
festivals in Indian religions. It is celebrated during the Hindu
|
|
808
|
-
lunisolar months of Ashvin and Kartika (between mid-October and
|
|
809
|
-
mid-November).
|
|
810
|
-
https://en.wikipedia.org/wiki/Diwali
|
|
811
|
-
"""
|
|
812
|
-
return self._add_hindu_calendar_holiday(
|
|
813
|
-
name, self._hindu_calendar.diwali_date(self._year)
|
|
814
|
-
)
|
|
815
|
-
|
|
816
|
-
def _add_thaipusam(self, name) -> Optional[date]:
|
|
817
|
-
"""
|
|
818
|
-
Add Thaipusam.
|
|
819
|
-
|
|
820
|
-
Thaipusam is a Tamil Hindu festival celebrated on the full moon
|
|
821
|
-
of the Tamil month of Thai (January/February).
|
|
822
|
-
https://en.wikipedia.org/wiki/Thaipusam
|
|
823
|
-
"""
|
|
824
|
-
return self._add_hindu_calendar_holiday(
|
|
825
|
-
name,
|
|
826
|
-
self._hindu_calendar.thaipusam_date(self._year),
|
|
827
|
-
)
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
class InternationalHolidays:
|
|
831
|
-
"""
|
|
832
|
-
International holidays.
|
|
833
|
-
"""
|
|
834
|
-
|
|
835
|
-
def _add_labor_day(self, name):
|
|
836
|
-
"""
|
|
837
|
-
Add International Workers' Day (May 1st)
|
|
838
|
-
|
|
839
|
-
International Workers' Day, also known as Labour Day, is a celebration
|
|
840
|
-
of labourers and the working classes that is promoted by the
|
|
841
|
-
international labour movement.
|
|
842
|
-
https://en.wikipedia.org/wiki/International_Workers%27_Day
|
|
843
|
-
"""
|
|
844
|
-
return self._add_holiday(name, MAY, 1)
|
|
845
|
-
|
|
846
|
-
def _add_new_years_day(self, name) -> date:
|
|
847
|
-
"""
|
|
848
|
-
Add New Year's Day (January 1st).
|
|
849
|
-
|
|
850
|
-
New Year's Day is a festival observed in most of the world on
|
|
851
|
-
1 January, the first day of the year in the modern Gregorian calendar.
|
|
852
|
-
https://en.wikipedia.org/wiki/New_Year%27s_Day
|
|
853
|
-
"""
|
|
854
|
-
return self._add_holiday(name, JAN, 1)
|
|
855
|
-
|
|
856
|
-
def _add_new_years_day_two(self, name) -> date:
|
|
857
|
-
"""
|
|
858
|
-
Add New Year's Day Two (January 2nd).
|
|
859
|
-
|
|
860
|
-
New Year's Day is a festival observed in most of the world on
|
|
861
|
-
1 January, the first day of the year in the modern Gregorian calendar.
|
|
862
|
-
https://en.wikipedia.org/wiki/New_Year%27s_Day
|
|
863
|
-
"""
|
|
864
|
-
return self._add_holiday(name, JAN, 2)
|
|
865
|
-
|
|
866
|
-
def _add_new_years_day_three(self, name) -> date:
|
|
867
|
-
"""
|
|
868
|
-
Add New Year's Day Three (January 3rd).
|
|
869
|
-
|
|
870
|
-
New Year's Day is a festival observed in most of the world on
|
|
871
|
-
1 January, the first day of the year in the modern Gregorian calendar.
|
|
872
|
-
https://en.wikipedia.org/wiki/New_Year%27s_Day
|
|
873
|
-
"""
|
|
874
|
-
return self._add_holiday(name, JAN, 3)
|
|
875
|
-
|
|
876
|
-
def _add_new_years_day_four(self, name) -> date:
|
|
877
|
-
"""
|
|
878
|
-
Add New Year's Day Four (January 4th).
|
|
879
|
-
|
|
880
|
-
New Year's Day is a festival observed in most of the world on
|
|
881
|
-
1 January, the first day of the year in the modern Gregorian calendar.
|
|
882
|
-
https://en.wikipedia.org/wiki/New_Year%27s_Day
|
|
883
|
-
"""
|
|
884
|
-
return self._add_holiday(name, JAN, 4)
|
|
885
|
-
|
|
886
|
-
def _add_remembrance_day(self, name):
|
|
887
|
-
"""
|
|
888
|
-
Add Remembrance Day / Armistice Day (Nov 11th)
|
|
889
|
-
|
|
890
|
-
It's a memorial day since the end of the First World War in 1919
|
|
891
|
-
to honour armed forces members who have died in the line of duty.
|
|
892
|
-
https://en.wikipedia.org/wiki/Remembrance_Day
|
|
893
|
-
"""
|
|
894
|
-
return self._add_holiday(name, NOV, 11)
|
|
895
|
-
|
|
896
|
-
def _add_new_years_eve(self, name) -> date:
|
|
897
|
-
"""
|
|
898
|
-
Add New Year's Eve (December 31st).
|
|
899
|
-
|
|
900
|
-
In the Gregorian calendar, New Year's Eve, also known as Old Year's
|
|
901
|
-
Day or Saint Sylvester's Day in many countries, is the evening or the
|
|
902
|
-
entire day of the last day of the year, on 31 December.
|
|
903
|
-
https://en.wikipedia.org/wiki/New_Year%27s_Eve
|
|
904
|
-
"""
|
|
905
|
-
return self._add_holiday(name, DEC, 31)
|
|
906
|
-
|
|
907
|
-
def _add_womens_day(self, name):
|
|
908
|
-
"""
|
|
909
|
-
Add International Women's Day (March 8th).
|
|
910
|
-
|
|
911
|
-
International Women's Day is a global holiday celebrated as a focal
|
|
912
|
-
point in the women's rights movement, bringing attention to issues
|
|
913
|
-
such as gender equality, reproductive rights, and violence and abuse
|
|
914
|
-
against women.
|
|
915
|
-
https://en.wikipedia.org/wiki/International_Women%27s_Day
|
|
916
|
-
"""
|
|
917
|
-
return self._add_holiday(name, MAR, 8)
|
|
918
|
-
|
|
919
|
-
def _add_world_war_two_victory_day(self, name):
|
|
920
|
-
"""
|
|
921
|
-
Add Victory Day (May 9th)
|
|
922
|
-
|
|
923
|
-
Victory Day is a holiday that commemorates the victory over Nazi
|
|
924
|
-
Germany in 1945.
|
|
925
|
-
https://en.wikipedia.org/wiki/Victory_Day_(9_May)
|
|
926
|
-
"""
|
|
927
|
-
return self._add_holiday(name, MAY, 9)
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
class IslamicHolidays:
|
|
931
|
-
"""
|
|
932
|
-
Islamic holidays.
|
|
933
|
-
|
|
934
|
-
The Hijri calendar also known as Islamic calendar, is a lunar
|
|
935
|
-
calendar consisting of 12 lunar months in a year of 354 or 355 days.
|
|
936
|
-
"""
|
|
937
|
-
|
|
938
|
-
def __init__(self, calendar=_IslamicLunar()) -> None:
|
|
939
|
-
self._islamic_calendar = calendar
|
|
940
|
-
|
|
941
|
-
def _add_arafah_day(self, name) -> Set[date]:
|
|
942
|
-
"""
|
|
943
|
-
Add Day of Arafah (9th day of 12th month).
|
|
944
|
-
|
|
945
|
-
At dawn of this day, Muslim pilgrims will make their way from Mina
|
|
946
|
-
to a nearby hillside and plain called Mount Arafat and the Plain of
|
|
947
|
-
Arafat.
|
|
948
|
-
https://en.wikipedia.org/wiki/Day_of_Arafah
|
|
949
|
-
"""
|
|
950
|
-
return self._add_islamic_calendar_holiday(
|
|
951
|
-
name,
|
|
952
|
-
self._islamic_calendar.eid_al_adha_dates(self._year),
|
|
953
|
-
days_delta=-1,
|
|
954
|
-
)
|
|
955
|
-
|
|
956
|
-
def _add_ashura_day(self, name) -> Set[date]:
|
|
957
|
-
"""
|
|
958
|
-
Add Ashura Day (10th day of 1st month).
|
|
959
|
-
|
|
960
|
-
Ashura is a day of commemoration in Islam. It occurs annually on the
|
|
961
|
-
10th of Muharram, the first month of the Islamic calendar.
|
|
962
|
-
https://en.wikipedia.org/wiki/Ashura
|
|
963
|
-
"""
|
|
964
|
-
return self._add_islamic_calendar_holiday(
|
|
965
|
-
name,
|
|
966
|
-
self._islamic_calendar.ashura_dates(self._year),
|
|
967
|
-
)
|
|
968
|
-
|
|
969
|
-
def _add_ashura_eve(self, name) -> Set[date]:
|
|
970
|
-
"""
|
|
971
|
-
Add Ashura Eve (Day before the 10th day of 1st month).
|
|
972
|
-
|
|
973
|
-
Ashura is a day of commemoration in Islam. It occurs annually on the
|
|
974
|
-
10th of Muharram, the first month of the Islamic calendar.
|
|
975
|
-
https://en.wikipedia.org/wiki/Ashura
|
|
976
|
-
"""
|
|
977
|
-
return self._add_islamic_calendar_holiday(
|
|
978
|
-
name,
|
|
979
|
-
self._islamic_calendar.ashura_dates(self._year),
|
|
980
|
-
days_delta=-1,
|
|
981
|
-
)
|
|
982
|
-
|
|
983
|
-
def _add_eid_al_adha_day(self, name) -> Set[date]:
|
|
984
|
-
"""
|
|
985
|
-
Add Eid al-Adha Day (10th day of the 12th month of Islamic calendar).
|
|
986
|
-
|
|
987
|
-
Feast of the Sacrifice. It honours the willingness of Ibrahim
|
|
988
|
-
(Abraham) to sacrifice his son Ismail (Ishmael) as an act of obedience
|
|
989
|
-
to Allah's command.
|
|
990
|
-
https://en.wikipedia.org/wiki/Eid_al-Adha
|
|
991
|
-
"""
|
|
992
|
-
return self._add_islamic_calendar_holiday(
|
|
993
|
-
name,
|
|
994
|
-
self._islamic_calendar.eid_al_adha_dates(self._year),
|
|
995
|
-
)
|
|
996
|
-
|
|
997
|
-
def _add_eid_al_adha_day_two(self, name) -> Set[date]:
|
|
998
|
-
"""
|
|
999
|
-
Add Eid al-Adha Day Two.
|
|
1000
|
-
|
|
1001
|
-
https://en.wikipedia.org/wiki/Eid_al-Adha
|
|
1002
|
-
"""
|
|
1003
|
-
return self._add_islamic_calendar_holiday(
|
|
1004
|
-
name,
|
|
1005
|
-
self._islamic_calendar.eid_al_adha_dates(self._year),
|
|
1006
|
-
days_delta=+1,
|
|
1007
|
-
)
|
|
1008
|
-
|
|
1009
|
-
def _add_eid_al_adha_day_three(self, name) -> Set[date]:
|
|
1010
|
-
"""
|
|
1011
|
-
Add Eid al-Adha Day Three.
|
|
1012
|
-
|
|
1013
|
-
https://en.wikipedia.org/wiki/Eid_al-Adha
|
|
1014
|
-
"""
|
|
1015
|
-
return self._add_islamic_calendar_holiday(
|
|
1016
|
-
name,
|
|
1017
|
-
self._islamic_calendar.eid_al_adha_dates(self._year),
|
|
1018
|
-
days_delta=+2,
|
|
1019
|
-
)
|
|
1020
|
-
|
|
1021
|
-
def _add_eid_al_adha_day_four(self, name) -> Set[date]:
|
|
1022
|
-
"""
|
|
1023
|
-
Add Eid al-Adha Day Four.
|
|
1024
|
-
|
|
1025
|
-
https://en.wikipedia.org/wiki/Eid_al-Adha
|
|
1026
|
-
"""
|
|
1027
|
-
return self._add_islamic_calendar_holiday(
|
|
1028
|
-
name,
|
|
1029
|
-
self._islamic_calendar.eid_al_adha_dates(self._year),
|
|
1030
|
-
days_delta=+3,
|
|
1031
|
-
)
|
|
1032
|
-
|
|
1033
|
-
def _add_eid_al_fitr_day(self, name) -> Set[date]:
|
|
1034
|
-
"""
|
|
1035
|
-
Add Eid al-Fitr Day (1st day of 10th month of Islamic calendar).
|
|
1036
|
-
|
|
1037
|
-
Holiday of Breaking the Fast. The religious holiday is celebrated
|
|
1038
|
-
by Muslims worldwide because it marks the end of the month-long
|
|
1039
|
-
dawn-to-sunset fasting of Ramadan.
|
|
1040
|
-
https://en.wikipedia.org/wiki/Eid_al-Fitr
|
|
1041
|
-
"""
|
|
1042
|
-
return self._add_islamic_calendar_holiday(
|
|
1043
|
-
name,
|
|
1044
|
-
self._islamic_calendar.eid_al_fitr_dates(self._year),
|
|
1045
|
-
)
|
|
1046
|
-
|
|
1047
|
-
def _add_eid_al_fitr_day_two(self, name) -> Set[date]:
|
|
1048
|
-
"""
|
|
1049
|
-
Add Eid al-Fitr Day Two.
|
|
1050
|
-
|
|
1051
|
-
https://en.wikipedia.org/wiki/Eid_al-Fitr
|
|
1052
|
-
"""
|
|
1053
|
-
return self._add_islamic_calendar_holiday(
|
|
1054
|
-
name,
|
|
1055
|
-
self._islamic_calendar.eid_al_fitr_dates(self._year),
|
|
1056
|
-
days_delta=+1,
|
|
1057
|
-
)
|
|
1058
|
-
|
|
1059
|
-
def _add_eid_al_fitr_day_three(self, name) -> Set[date]:
|
|
1060
|
-
"""
|
|
1061
|
-
Add Eid al-Fitr Day Three.
|
|
1062
|
-
|
|
1063
|
-
https://en.wikipedia.org/wiki/Eid_al-Fitr
|
|
1064
|
-
"""
|
|
1065
|
-
return self._add_islamic_calendar_holiday(
|
|
1066
|
-
name,
|
|
1067
|
-
self._islamic_calendar.eid_al_fitr_dates(self._year),
|
|
1068
|
-
days_delta=+2,
|
|
1069
|
-
)
|
|
1070
|
-
|
|
1071
|
-
def _add_eid_al_fitr_day_four(self, name) -> Set[date]:
|
|
1072
|
-
"""
|
|
1073
|
-
Add Eid al-Fitr Day Four.
|
|
1074
|
-
|
|
1075
|
-
https://en.wikipedia.org/wiki/Eid_al-Fitr
|
|
1076
|
-
"""
|
|
1077
|
-
return self._add_islamic_calendar_holiday(
|
|
1078
|
-
name,
|
|
1079
|
-
self._islamic_calendar.eid_al_fitr_dates(self._year),
|
|
1080
|
-
days_delta=+3,
|
|
1081
|
-
)
|
|
1082
|
-
|
|
1083
|
-
def _add_hari_hol_johor(self, name) -> Set[date]:
|
|
1084
|
-
"""
|
|
1085
|
-
Hari Hol Johor.
|
|
1086
|
-
|
|
1087
|
-
https://publicholidays.com.my/hari-hol-almarhum-sultan-iskandar/
|
|
1088
|
-
"""
|
|
1089
|
-
return self._add_islamic_calendar_holiday(
|
|
1090
|
-
name,
|
|
1091
|
-
self._islamic_calendar.hari_hol_johor_dates(self._year),
|
|
1092
|
-
)
|
|
1093
|
-
|
|
1094
|
-
def _add_islamic_calendar_holiday(
|
|
1095
|
-
self,
|
|
1096
|
-
name: str,
|
|
1097
|
-
dates: Iterable[Tuple[date, bool]],
|
|
1098
|
-
days_delta: int = 0,
|
|
1099
|
-
) -> Set[date]:
|
|
1100
|
-
"""
|
|
1101
|
-
Add lunar calendar holiday.
|
|
1102
|
-
|
|
1103
|
-
Appends customizable estimation label at the end of holiday name if
|
|
1104
|
-
holiday date is an estimation.
|
|
1105
|
-
"""
|
|
1106
|
-
added_dates = set()
|
|
1107
|
-
estimated_label = getattr(self, "estimated_label", "%s* (*estimated)")
|
|
1108
|
-
for dt, is_estimated in dates:
|
|
1109
|
-
if days_delta != 0:
|
|
1110
|
-
dt += td(days=days_delta)
|
|
1111
|
-
|
|
1112
|
-
dt = self._add_holiday(
|
|
1113
|
-
self.tr(estimated_label) % self.tr(name)
|
|
1114
|
-
if is_estimated
|
|
1115
|
-
else name,
|
|
1116
|
-
dt,
|
|
1117
|
-
)
|
|
1118
|
-
if dt:
|
|
1119
|
-
added_dates.add(dt)
|
|
1120
|
-
|
|
1121
|
-
return added_dates
|
|
1122
|
-
|
|
1123
|
-
def _add_islamic_new_year_day(self, name) -> Set[date]:
|
|
1124
|
-
"""
|
|
1125
|
-
Add Islamic New Year Day (last day of Dhu al-Hijjah).
|
|
1126
|
-
|
|
1127
|
-
The Islamic New Year, also called the Hijri New Year, is the day that
|
|
1128
|
-
marks the beginning of a new lunar Hijri year, and is the day on which
|
|
1129
|
-
the year count is incremented. The first day of the Islamic year is
|
|
1130
|
-
observed by most Muslims on the first day of the month of Muharram.
|
|
1131
|
-
https://en.wikipedia.org/wiki/Islamic_New_Year
|
|
1132
|
-
"""
|
|
1133
|
-
return self._add_islamic_calendar_holiday(
|
|
1134
|
-
name,
|
|
1135
|
-
self._islamic_calendar.hijri_new_year_dates(self._year),
|
|
1136
|
-
)
|
|
1137
|
-
|
|
1138
|
-
def _add_isra_and_miraj_day(self, name):
|
|
1139
|
-
"""
|
|
1140
|
-
Add Isra' and Mi'raj Day (27th day of 7th month).
|
|
1141
|
-
|
|
1142
|
-
https://en.wikipedia.org/wiki/Isra%27_and_Mi%27raj
|
|
1143
|
-
"""
|
|
1144
|
-
return self._add_islamic_calendar_holiday(
|
|
1145
|
-
name,
|
|
1146
|
-
self._islamic_calendar.isra_and_miraj_dates(self._year),
|
|
1147
|
-
)
|
|
1148
|
-
|
|
1149
|
-
def _add_mawlid_day(self, name) -> Set[date]:
|
|
1150
|
-
"""
|
|
1151
|
-
Add Mawlid Day (12th day of 3rd month).
|
|
1152
|
-
|
|
1153
|
-
Mawlid is the observance of the birthday of the Islamic prophet
|
|
1154
|
-
Muhammad.
|
|
1155
|
-
https://en.wikipedia.org/wiki/Mawlid
|
|
1156
|
-
"""
|
|
1157
|
-
return self._add_islamic_calendar_holiday(
|
|
1158
|
-
name,
|
|
1159
|
-
self._islamic_calendar.mawlid_dates(self._year),
|
|
1160
|
-
)
|
|
1161
|
-
|
|
1162
|
-
def _add_mawlid_day_two(self, name) -> Set[date]:
|
|
1163
|
-
"""
|
|
1164
|
-
Add Mawlid Day Two.
|
|
1165
|
-
|
|
1166
|
-
Mawlid is the observance of the birthday of the Islamic prophet
|
|
1167
|
-
Muhammad.
|
|
1168
|
-
https://en.wikipedia.org/wiki/Mawlid
|
|
1169
|
-
"""
|
|
1170
|
-
return self._add_islamic_calendar_holiday(
|
|
1171
|
-
name,
|
|
1172
|
-
self._islamic_calendar.mawlid_dates(self._year),
|
|
1173
|
-
days_delta=+1,
|
|
1174
|
-
)
|
|
1175
|
-
|
|
1176
|
-
def _add_nuzul_al_quran_day(self, name) -> Set[date]:
|
|
1177
|
-
"""
|
|
1178
|
-
Add Nuzul Al Quran (17th day of 9th month).
|
|
1179
|
-
|
|
1180
|
-
Nuzul Al Quran is a Muslim festival to remember the day when Prophet
|
|
1181
|
-
Muhammad received his first revelation of Islam's sacred book,
|
|
1182
|
-
the holy Quran.
|
|
1183
|
-
https://zamzam.com/blog/nuzul-al-quran/
|
|
1184
|
-
"""
|
|
1185
|
-
return self._add_islamic_calendar_holiday(
|
|
1186
|
-
name,
|
|
1187
|
-
self._islamic_calendar.nuzul_al_quran_dates(self._year),
|
|
1188
|
-
)
|
|
1189
|
-
|
|
1190
|
-
def _add_ramadan_beginning_day(self, name) -> Set[date]:
|
|
1191
|
-
"""
|
|
1192
|
-
Add First Day of Ramadan (1st day of 9th month).
|
|
1193
|
-
|
|
1194
|
-
Ramadan is the ninth month of the Islamic calendar, observed by Muslims
|
|
1195
|
-
worldwide as a month of fasting, prayer, reflection, and community
|
|
1196
|
-
https://en.wikipedia.org/wiki/Ramadan
|
|
1197
|
-
"""
|
|
1198
|
-
return self._add_islamic_calendar_holiday(
|
|
1199
|
-
name,
|
|
1200
|
-
self._islamic_calendar.ramadan_beginning_dates(self._year),
|
|
1201
|
-
)
|
|
12
|
+
# flake8: noqa: F401
|
|
13
|
+
|
|
14
|
+
from holidays.groups import (
|
|
15
|
+
BuddhistCalendarHolidays,
|
|
16
|
+
ChineseCalendarHolidays,
|
|
17
|
+
ChristianHolidays,
|
|
18
|
+
HinduCalendarHolidays,
|
|
19
|
+
InternationalHolidays,
|
|
20
|
+
IslamicHolidays,
|
|
21
|
+
ThaiCalendarHolidays,
|
|
22
|
+
)
|