holidays 0.68__py3-none-any.whl → 0.69__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/calendars/__init__.py +1 -0
- holidays/calendars/balinese_saka.py +112 -0
- holidays/calendars/hindu.py +865 -1
- holidays/constants.py +1 -0
- holidays/countries/__init__.py +1 -0
- holidays/countries/afghanistan.py +8 -2
- holidays/countries/albania.py +8 -2
- holidays/countries/algeria.py +6 -2
- holidays/countries/american_samoa.py +6 -2
- holidays/countries/azerbaijan.py +8 -2
- holidays/countries/bahrain.py +8 -2
- holidays/countries/bosnia_and_herzegovina.py +8 -2
- holidays/countries/brunei.py +8 -2
- holidays/countries/burkina_faso.py +8 -2
- holidays/countries/burundi.py +6 -2
- holidays/countries/cameroon.py +8 -2
- holidays/countries/chad.py +8 -2
- holidays/countries/djibouti.py +6 -2
- holidays/countries/egypt.py +6 -2
- holidays/countries/ethiopia.py +8 -2
- holidays/countries/gabon.py +8 -2
- holidays/countries/ghana.py +6 -2
- holidays/countries/guam.py +6 -2
- holidays/countries/hongkong.py +38 -52
- holidays/countries/india.py +482 -166
- holidays/countries/indonesia.py +14 -58
- holidays/countries/iran.py +8 -2
- holidays/countries/jordan.py +6 -2
- holidays/countries/kazakhstan.py +8 -2
- holidays/countries/kenya.py +8 -2
- holidays/countries/kuwait.py +6 -2
- holidays/countries/kyrgyzstan.py +6 -2
- holidays/countries/macau.py +474 -0
- holidays/countries/malaysia.py +9 -3
- holidays/countries/maldives.py +6 -2
- holidays/countries/mauritania.py +6 -2
- holidays/countries/montenegro.py +8 -2
- holidays/countries/morocco.py +6 -2
- holidays/countries/nigeria.py +6 -2
- holidays/countries/north_macedonia.py +6 -2
- holidays/countries/northern_mariana_islands.py +6 -2
- holidays/countries/pakistan.py +8 -2
- holidays/countries/philippines.py +13 -3
- holidays/countries/poland.py +1 -1
- holidays/countries/puerto_rico.py +6 -2
- holidays/countries/saudi_arabia.py +6 -2
- holidays/countries/singapore.py +7 -2
- holidays/countries/spain.py +8 -2
- holidays/countries/sri_lanka.py +8 -2
- holidays/countries/taiwan.py +226 -29
- holidays/countries/tanzania.py +8 -2
- holidays/countries/timor_leste.py +21 -2
- holidays/countries/tunisia.py +6 -2
- holidays/countries/turkey.py +8 -2
- holidays/countries/united_arab_emirates.py +8 -2
- holidays/countries/united_states.py +84 -35
- holidays/countries/united_states_minor_outlying_islands.py +6 -2
- holidays/countries/united_states_virgin_islands.py +6 -2
- holidays/countries/uzbekistan.py +8 -2
- holidays/groups/__init__.py +1 -0
- holidays/groups/balinese_saka.py +45 -0
- holidays/groups/chinese.py +68 -3
- holidays/groups/hindu.py +255 -0
- holidays/groups/islamic.py +5 -2
- holidays/holiday_base.py +44 -29
- holidays/locale/de/LC_MESSAGES/PL.mo +0 -0
- holidays/locale/en_HK/LC_MESSAGES/HK.mo +0 -0
- holidays/locale/en_IN/LC_MESSAGES/IN.mo +0 -0
- holidays/locale/en_MO/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/HK.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/IN.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/TW.mo +0 -0
- holidays/locale/hi/LC_MESSAGES/IN.mo +0 -0
- holidays/locale/pt_MO/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/th/LC_MESSAGES/HK.mo +0 -0
- holidays/locale/th/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/th/LC_MESSAGES/TW.mo +0 -0
- holidays/locale/zh_CN/LC_MESSAGES/HK.mo +0 -0
- holidays/locale/zh_CN/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/zh_CN/LC_MESSAGES/TW.mo +0 -0
- holidays/locale/zh_HK/LC_MESSAGES/HK.mo +0 -0
- holidays/locale/zh_MO/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/zh_TW/LC_MESSAGES/TW.mo +0 -0
- holidays/registry.py +1 -0
- holidays/version.py +1 -1
- {holidays-0.68.dist-info → holidays-0.69.dist-info}/AUTHORS +1 -0
- {holidays-0.68.dist-info → holidays-0.69.dist-info}/METADATA +20 -15
- {holidays-0.68.dist-info → holidays-0.69.dist-info}/RECORD +92 -79
- {holidays-0.68.dist-info → holidays-0.69.dist-info}/WHEEL +1 -1
- {holidays-0.68.dist-info → holidays-0.69.dist-info}/LICENSE +0 -0
- {holidays-0.68.dist-info → holidays-0.69.dist-info}/top_level.txt +0 -0
holidays/groups/hindu.py
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
# Website: https://github.com/vacanza/holidays
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
|
+
from collections.abc import Iterable
|
|
13
14
|
from datetime import date
|
|
14
15
|
from typing import Optional
|
|
15
16
|
|
|
@@ -35,10 +36,54 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
35
36
|
Adds customizable estimation label to holiday name if holiday date
|
|
36
37
|
is an estimation.
|
|
37
38
|
"""
|
|
39
|
+
|
|
38
40
|
return self._add_eastern_calendar_holiday(
|
|
39
41
|
name, dt_estimated, self._hindu_calendar_show_estimated
|
|
40
42
|
)
|
|
41
43
|
|
|
44
|
+
def _add_hindu_calendar_holiday_set(
|
|
45
|
+
self, name: str, dts_estimated: Iterable[tuple[date, bool]], days_delta: int = 0
|
|
46
|
+
) -> set[date]:
|
|
47
|
+
"""
|
|
48
|
+
Add Hindu calendar holidays.
|
|
49
|
+
|
|
50
|
+
Adds customizable estimation label to holiday name if holiday date
|
|
51
|
+
is an estimation.
|
|
52
|
+
"""
|
|
53
|
+
added_dates = set()
|
|
54
|
+
for dt_estimated in dts_estimated:
|
|
55
|
+
if dt := self._add_eastern_calendar_holiday(
|
|
56
|
+
name, dt_estimated, self._hindu_calendar_show_estimated, days_delta=days_delta
|
|
57
|
+
):
|
|
58
|
+
added_dates.add(dt)
|
|
59
|
+
|
|
60
|
+
return added_dates
|
|
61
|
+
|
|
62
|
+
def _add_buddha_purnima(self, name) -> Optional[date]:
|
|
63
|
+
"""
|
|
64
|
+
Add Buddha Purnima.
|
|
65
|
+
|
|
66
|
+
Buddha Purnima, also known as Vesak, commemorates the birth, enlightenment,
|
|
67
|
+
and passing of Gautama Buddha. It falls on the full moon day of the
|
|
68
|
+
Hindu month of Vaisakha (April-May).
|
|
69
|
+
https://en.wikipedia.org/wiki/Vesak
|
|
70
|
+
"""
|
|
71
|
+
return self._add_hindu_calendar_holiday(
|
|
72
|
+
name, self._hindu_calendar.buddha_purnima_date(self._year)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
def _add_chhath_puja(self, name) -> Optional[date]:
|
|
76
|
+
"""
|
|
77
|
+
Add Chhath Puja.
|
|
78
|
+
|
|
79
|
+
Chhath Puja is a Hindu festival dedicated to the Sun God (Surya).
|
|
80
|
+
It is observed six days after Diwali in the month of Kartika (October-November).
|
|
81
|
+
https://en.wikipedia.org/wiki/Chhath
|
|
82
|
+
"""
|
|
83
|
+
return self._add_hindu_calendar_holiday(
|
|
84
|
+
name, self._hindu_calendar.chhath_puja_date(self._year)
|
|
85
|
+
)
|
|
86
|
+
|
|
42
87
|
def _add_diwali(self, name) -> Optional[date]:
|
|
43
88
|
"""
|
|
44
89
|
Add Diwali Festival.
|
|
@@ -51,6 +96,204 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
51
96
|
"""
|
|
52
97
|
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.diwali_date(self._year))
|
|
53
98
|
|
|
99
|
+
def _add_diwali_india(self, name) -> Optional[date]:
|
|
100
|
+
return self._add_hindu_calendar_holiday(
|
|
101
|
+
name, self._hindu_calendar.diwali_india_date(self._year)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def _add_dussehra(self, name) -> Optional[date]:
|
|
105
|
+
"""
|
|
106
|
+
Add Dussehra Festival.
|
|
107
|
+
|
|
108
|
+
Dussehra (Vijayadashami) is a major Hindu festival that marks the end
|
|
109
|
+
of Navratri. It is celebrated on the 10th day of the Hindu lunisolar
|
|
110
|
+
month of Ashvin (September-October).
|
|
111
|
+
https://en.wikipedia.org/wiki/Vijayadashami
|
|
112
|
+
"""
|
|
113
|
+
return self._add_hindu_calendar_holiday(
|
|
114
|
+
name, self._hindu_calendar.dussehra_date(self._year)
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def _add_ganesh_chaturthi(self, name) -> Optional[date]:
|
|
118
|
+
"""
|
|
119
|
+
Add Ganesh Chaturthi.
|
|
120
|
+
|
|
121
|
+
Ganesh Chaturthi is a Hindu festival celebrating the birth of Lord Ganesha.
|
|
122
|
+
It falls on the fourth day of the Hindu month of Bhadrapada (August/September).
|
|
123
|
+
https://en.wikipedia.org/wiki/Ganesh_Chaturthi
|
|
124
|
+
"""
|
|
125
|
+
return self._add_hindu_calendar_holiday(
|
|
126
|
+
name, self._hindu_calendar.ganesh_chaturthi_date(self._year)
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
def _add_govardhan_puja(self, name) -> Optional[date]:
|
|
130
|
+
"""
|
|
131
|
+
Add Govardhan Puja.
|
|
132
|
+
|
|
133
|
+
Govardhan Puja, also known as Annakut, is celebrated the day after Diwali
|
|
134
|
+
to honor Lord Krishna. It falls on the first lunar day of the Hindu month of Kartika.
|
|
135
|
+
https://en.wikipedia.org/wiki/Govardhan_Puja
|
|
136
|
+
"""
|
|
137
|
+
return self._add_hindu_calendar_holiday(
|
|
138
|
+
name, self._hindu_calendar.govardhan_puja_date(self._year)
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
def _add_gudi_padwa(self, name) -> Optional[date]:
|
|
142
|
+
"""
|
|
143
|
+
Add Gudi Padwa.
|
|
144
|
+
|
|
145
|
+
Gudi Padwa is the traditional New Year festival for Maharashtrians.
|
|
146
|
+
It falls on the first day of Chaitra (March-April).
|
|
147
|
+
https://en.wikipedia.org/wiki/Gudi_Padwa
|
|
148
|
+
"""
|
|
149
|
+
return self._add_hindu_calendar_holiday(
|
|
150
|
+
name, self._hindu_calendar.gudi_padwa_date(self._year)
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def _add_guru_gobind_singh_jayanti(self, name) -> set[date]:
|
|
154
|
+
"""
|
|
155
|
+
Add Guru Gobind Singh Jayanti.
|
|
156
|
+
|
|
157
|
+
Guru Gobind Singh Jayanti commemorates the birth anniversary of
|
|
158
|
+
Guru Gobind Singh, the tenth Sikh Guru. It follows the Nanakshahi calendar.
|
|
159
|
+
https://en.wikipedia.org/wiki/Guru_Gobind_Singh
|
|
160
|
+
"""
|
|
161
|
+
return self._add_hindu_calendar_holiday_set(
|
|
162
|
+
name, self._hindu_calendar.guru_gobind_singh_jayanti_date(self._year)
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def _add_guru_nanak_jayanti(self, name) -> Optional[date]:
|
|
166
|
+
"""
|
|
167
|
+
Add Guru Nanak Jayanti.
|
|
168
|
+
|
|
169
|
+
Guru Nanak Jayanti celebrates the birth anniversary of Guru Nanak,
|
|
170
|
+
the founder of Sikhism. It is observed on the full moon day of
|
|
171
|
+
Kartik (October-November).
|
|
172
|
+
https://en.wikipedia.org/wiki/Guru_Nanak_Gurpurab
|
|
173
|
+
"""
|
|
174
|
+
return self._add_hindu_calendar_holiday(
|
|
175
|
+
name, self._hindu_calendar.guru_nanak_jayanti_date(self._year)
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
def _add_holi(self, name) -> Optional[date]:
|
|
179
|
+
"""
|
|
180
|
+
Add Holi Festival.
|
|
181
|
+
|
|
182
|
+
Holi, known as the Festival of Colors, is a Hindu festival that marks
|
|
183
|
+
the arrival of spring. It is celebrated on the full moon day of the
|
|
184
|
+
Hindu month of Phalguna (February/March).
|
|
185
|
+
https://en.wikipedia.org/wiki/Holi
|
|
186
|
+
"""
|
|
187
|
+
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.holi_date(self._year))
|
|
188
|
+
|
|
189
|
+
def _add_janmashtami(self, name) -> Optional[date]:
|
|
190
|
+
"""
|
|
191
|
+
Add Janmashtami.
|
|
192
|
+
|
|
193
|
+
Janmashtami is a Hindu festival that celebrates the birth of Lord Krishna.
|
|
194
|
+
It falls on the eighth day of the Hindu month of Bhadrapada (August/September).
|
|
195
|
+
https://en.wikipedia.org/wiki/Krishna_Janmashtami
|
|
196
|
+
"""
|
|
197
|
+
return self._add_hindu_calendar_holiday(
|
|
198
|
+
name, self._hindu_calendar.janmashtami_date(self._year)
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
def _add_maha_navami(self, name) -> Optional[date]:
|
|
202
|
+
"""
|
|
203
|
+
Add Maha Navami.
|
|
204
|
+
|
|
205
|
+
Maha Navami is the ninth day of Navratri, dedicated to Goddess Durga.
|
|
206
|
+
It is observed in Ashvin (September-October).
|
|
207
|
+
https://en.wikipedia.org/wiki/Navaratri
|
|
208
|
+
"""
|
|
209
|
+
return self._add_hindu_calendar_holiday(
|
|
210
|
+
name, self._hindu_calendar.maha_navami_date(self._year)
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
def _add_maha_shivaratri(self, name) -> Optional[date]:
|
|
214
|
+
"""
|
|
215
|
+
Add Maha Shivaratri.
|
|
216
|
+
|
|
217
|
+
Maha Shivaratri is a Hindu festival dedicated to Lord Shiva. It is celebrated
|
|
218
|
+
on the 14th night of the Hindu month of Phalguna (February/March).
|
|
219
|
+
https://en.wikipedia.org/wiki/Maha_Shivaratri
|
|
220
|
+
"""
|
|
221
|
+
return self._add_hindu_calendar_holiday(
|
|
222
|
+
name, self._hindu_calendar.maha_shivaratri_date(self._year)
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
def _add_mahavir_jayanti(self, name) -> Optional[date]:
|
|
226
|
+
"""
|
|
227
|
+
Add Mahavir Jayanti.
|
|
228
|
+
|
|
229
|
+
Mahavir Jayanti celebrates the birth of Lord Mahavira, the 24th
|
|
230
|
+
Tirthankara of Jainism. It falls on the 13th day of Chaitra (March-April).
|
|
231
|
+
https://en.wikipedia.org/wiki/Mahavir_Jayanti
|
|
232
|
+
"""
|
|
233
|
+
return self._add_hindu_calendar_holiday(
|
|
234
|
+
name, self._hindu_calendar.mahavir_jayanti_date(self._year)
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def _add_makar_sankranti(self, name) -> Optional[date]:
|
|
238
|
+
"""
|
|
239
|
+
Add Makar Sankranti.
|
|
240
|
+
|
|
241
|
+
Makar Sankranti is a Hindu festival that marks the transition of the Sun
|
|
242
|
+
into Capricorn (Makar). It is celebrated on January 14th or 15th every year.
|
|
243
|
+
https://en.wikipedia.org/wiki/Makar_Sankranti
|
|
244
|
+
"""
|
|
245
|
+
return self._add_hindu_calendar_holiday(
|
|
246
|
+
name, self._hindu_calendar.makar_sankranti_date(self._year)
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
def _add_onam(self, name) -> Optional[date]:
|
|
250
|
+
"""
|
|
251
|
+
Add Onam.
|
|
252
|
+
|
|
253
|
+
Onam is a major festival in Kerala, celebrating the homecoming of
|
|
254
|
+
King Mahabali. It falls in the month of Chingam (August-September).
|
|
255
|
+
https://en.wikipedia.org/wiki/Onam
|
|
256
|
+
"""
|
|
257
|
+
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.onam_date(self._year))
|
|
258
|
+
|
|
259
|
+
def _add_raksha_bandhan(self, name) -> Optional[date]:
|
|
260
|
+
"""
|
|
261
|
+
Add Raksha Bandhan.
|
|
262
|
+
|
|
263
|
+
Raksha Bandhan is a Hindu festival that celebrates the bond between
|
|
264
|
+
brothers and sisters. It falls on the full moon day of the Hindu month
|
|
265
|
+
of Shravana (July/August).
|
|
266
|
+
https://en.wikipedia.org/wiki/Raksha_Bandhan
|
|
267
|
+
"""
|
|
268
|
+
return self._add_hindu_calendar_holiday(
|
|
269
|
+
name, self._hindu_calendar.raksha_bandhan_date(self._year)
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
def _add_ram_navami(self, name) -> Optional[date]:
|
|
273
|
+
"""
|
|
274
|
+
Add Ram Navami.
|
|
275
|
+
|
|
276
|
+
Ram Navami is a Hindu festival celebrating the birth of Lord Rama.
|
|
277
|
+
It is observed on the ninth day of the Hindu month of Chaitra (March/April).
|
|
278
|
+
https://en.wikipedia.org/wiki/Rama_Navami
|
|
279
|
+
"""
|
|
280
|
+
return self._add_hindu_calendar_holiday(
|
|
281
|
+
name, self._hindu_calendar.ram_navami_date(self._year)
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
def _add_sharad_navratri(self, name) -> Optional[date]:
|
|
285
|
+
"""
|
|
286
|
+
Add Navratri / Sharad Navratri.
|
|
287
|
+
|
|
288
|
+
Navratri is a Hindu festival dedicated to the worship of Goddess Durga.
|
|
289
|
+
It is celebrated over nine nights and occurs in the lunar month of Ashvin
|
|
290
|
+
(September/October).
|
|
291
|
+
https://en.wikipedia.org/wiki/Navratri
|
|
292
|
+
"""
|
|
293
|
+
return self._add_hindu_calendar_holiday(
|
|
294
|
+
name, self._hindu_calendar.sharad_navratri_date(self._year)
|
|
295
|
+
)
|
|
296
|
+
|
|
54
297
|
def _add_thaipusam(self, name) -> Optional[date]:
|
|
55
298
|
"""
|
|
56
299
|
Add Thaipusam.
|
|
@@ -62,3 +305,15 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
62
305
|
return self._add_hindu_calendar_holiday(
|
|
63
306
|
name, self._hindu_calendar.thaipusam_date(self._year)
|
|
64
307
|
)
|
|
308
|
+
|
|
309
|
+
def _add_vaisakhi(self, name) -> Optional[date]:
|
|
310
|
+
"""
|
|
311
|
+
Add Vaisakhi.
|
|
312
|
+
|
|
313
|
+
Vaisakhi is a major Sikh festival marking the Sikh New Year and the
|
|
314
|
+
founding of the Khalsa. It falls on April 13 or 14.
|
|
315
|
+
https://en.wikipedia.org/wiki/Vaisakhi
|
|
316
|
+
"""
|
|
317
|
+
return self._add_hindu_calendar_holiday(
|
|
318
|
+
name, self._hindu_calendar.vaisakhi_date(self._year)
|
|
319
|
+
)
|
holidays/groups/islamic.py
CHANGED
|
@@ -25,8 +25,9 @@ class IslamicHolidays(EasternCalendarHolidays):
|
|
|
25
25
|
calendar consisting of 12 lunar months in a year of 354 or 355 days.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
def __init__(self, cls=None) -> None:
|
|
28
|
+
def __init__(self, cls=None, show_estimated=True) -> None:
|
|
29
29
|
self._islamic_calendar = cls() if cls else _IslamicLunar()
|
|
30
|
+
self._islamic_calendar_show_estimated = show_estimated
|
|
30
31
|
|
|
31
32
|
def _add_ali_al_rida_death_day(self, name) -> set[date]:
|
|
32
33
|
"""
|
|
@@ -262,7 +263,9 @@ class IslamicHolidays(EasternCalendarHolidays):
|
|
|
262
263
|
"""
|
|
263
264
|
added_dates = set()
|
|
264
265
|
for dts in dates:
|
|
265
|
-
if dt := self._add_eastern_calendar_holiday(
|
|
266
|
+
if dt := self._add_eastern_calendar_holiday(
|
|
267
|
+
name, dts, self._islamic_calendar_show_estimated, days_delta
|
|
268
|
+
):
|
|
266
269
|
added_dates.add(dt)
|
|
267
270
|
|
|
268
271
|
return added_dates
|
holidays/holiday_base.py
CHANGED
|
@@ -361,40 +361,15 @@ class HolidayBase(dict[date, str]):
|
|
|
361
361
|
self.expand = expand
|
|
362
362
|
self.has_special_holidays = getattr(self, "has_special_holidays", False)
|
|
363
363
|
self.has_substituted_holidays = has_substituted_holidays
|
|
364
|
-
self.language = language
|
|
364
|
+
self.language = language
|
|
365
365
|
self.observed = observed
|
|
366
366
|
self.subdiv = subdiv
|
|
367
367
|
self.weekend_workdays = getattr(self, "weekend_workdays", set())
|
|
368
|
-
|
|
369
|
-
supported_languages = set(self.supported_languages)
|
|
370
|
-
if self._entity_code is not None:
|
|
371
|
-
fallback = language not in supported_languages
|
|
372
|
-
languages = [language] if language in supported_languages else None
|
|
373
|
-
locale_directory = str(Path(__file__).with_name("locale"))
|
|
374
|
-
|
|
375
|
-
# Add entity native content translations.
|
|
376
|
-
entity_translation = translation(
|
|
377
|
-
self._entity_code,
|
|
378
|
-
fallback=fallback,
|
|
379
|
-
languages=languages,
|
|
380
|
-
localedir=locale_directory,
|
|
381
|
-
)
|
|
382
|
-
# Add a fallback if entity has parent translations.
|
|
383
|
-
if parent_entity := self.parent_entity:
|
|
384
|
-
entity_translation.add_fallback(
|
|
385
|
-
translation(
|
|
386
|
-
parent_entity.country or parent_entity.market,
|
|
387
|
-
fallback=fallback,
|
|
388
|
-
languages=languages,
|
|
389
|
-
localedir=locale_directory,
|
|
390
|
-
)
|
|
391
|
-
)
|
|
392
|
-
self.tr = entity_translation.gettext
|
|
393
|
-
else:
|
|
394
|
-
self.tr = gettext
|
|
395
|
-
|
|
396
368
|
self.years = _normalize_arguments(int, years)
|
|
397
369
|
|
|
370
|
+
# Configure l10n related attributes.
|
|
371
|
+
self._init_translation()
|
|
372
|
+
|
|
398
373
|
# Populate holidays.
|
|
399
374
|
for year in self.years:
|
|
400
375
|
self._populate(year)
|
|
@@ -592,6 +567,12 @@ class HolidayBase(dict[date, str]):
|
|
|
592
567
|
|
|
593
568
|
return dict.__getitem__(self, self.__keytransform__(key))
|
|
594
569
|
|
|
570
|
+
def __getstate__(self) -> dict[str, Any]:
|
|
571
|
+
"""Return the object's state for serialization."""
|
|
572
|
+
state = self.__dict__.copy()
|
|
573
|
+
state.pop("tr", None)
|
|
574
|
+
return state
|
|
575
|
+
|
|
595
576
|
def __keytransform__(self, key: DateLike) -> date:
|
|
596
577
|
"""Transforms the date from one of the following types:
|
|
597
578
|
|
|
@@ -699,6 +680,11 @@ class HolidayBase(dict[date, str]):
|
|
|
699
680
|
|
|
700
681
|
dict.__setitem__(self, self.__keytransform__(key), value)
|
|
701
682
|
|
|
683
|
+
def __setstate__(self, state: dict[str, Any]) -> None:
|
|
684
|
+
"""Restore the object's state after deserialization."""
|
|
685
|
+
self.__dict__.update(state)
|
|
686
|
+
self._init_translation()
|
|
687
|
+
|
|
702
688
|
def __str__(self) -> str:
|
|
703
689
|
if self:
|
|
704
690
|
return super().__str__()
|
|
@@ -750,6 +736,35 @@ class HolidayBase(dict[date, str]):
|
|
|
750
736
|
|
|
751
737
|
return subdivision_aliases
|
|
752
738
|
|
|
739
|
+
def _init_translation(self) -> None:
|
|
740
|
+
"""Initialize translation function based on language settings."""
|
|
741
|
+
supported_languages = set(self.supported_languages)
|
|
742
|
+
if self._entity_code is not None:
|
|
743
|
+
fallback = self.language not in supported_languages
|
|
744
|
+
languages = [self.language] if self.language in supported_languages else None
|
|
745
|
+
locale_directory = str(Path(__file__).with_name("locale"))
|
|
746
|
+
|
|
747
|
+
# Add entity native content translations.
|
|
748
|
+
entity_translation = translation(
|
|
749
|
+
self._entity_code,
|
|
750
|
+
fallback=fallback,
|
|
751
|
+
languages=languages,
|
|
752
|
+
localedir=locale_directory,
|
|
753
|
+
)
|
|
754
|
+
# Add a fallback if entity has parent translations.
|
|
755
|
+
if parent_entity := self.parent_entity:
|
|
756
|
+
entity_translation.add_fallback(
|
|
757
|
+
translation(
|
|
758
|
+
parent_entity.country or parent_entity.market,
|
|
759
|
+
fallback=fallback,
|
|
760
|
+
languages=languages,
|
|
761
|
+
localedir=locale_directory,
|
|
762
|
+
)
|
|
763
|
+
)
|
|
764
|
+
self.tr = entity_translation.gettext
|
|
765
|
+
else:
|
|
766
|
+
self.tr = gettext
|
|
767
|
+
|
|
753
768
|
def _is_leap_year(self) -> bool:
|
|
754
769
|
"""
|
|
755
770
|
Returns True if the year is leap. Returns False otherwise.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
holidays/registry.py
CHANGED
|
@@ -108,6 +108,7 @@ COUNTRIES: RegistryDict = {
|
|
|
108
108
|
"liechtenstein": ("Liechtenstein", "LI", "LIE"),
|
|
109
109
|
"lithuania": ("Lithuania", "LT", "LTU"),
|
|
110
110
|
"luxembourg": ("Luxembourg", "LU", "LUX"),
|
|
111
|
+
"macau": ("Macau", "MO", "MAC"),
|
|
111
112
|
"madagascar": ("Madagascar", "MG", "MDG"),
|
|
112
113
|
"malawi": ("Malawi", "MW", "MWI"),
|
|
113
114
|
"malaysia": ("Malaysia", "MY", "MYS"),
|
holidays/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: holidays
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.69
|
|
4
4
|
Summary: Open World Holidays Framework
|
|
5
5
|
Author: Vacanza Team
|
|
6
6
|
Maintainer: Arkadii Yakovets, Panpakorn Siripanich, Serhii Murza
|
|
@@ -189,7 +189,7 @@ Available Countries
|
|
|
189
189
|
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
190
190
|
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
|
|
191
191
|
|
|
192
|
-
We currently support
|
|
192
|
+
We currently support 160 country codes. The standard way to refer to a country
|
|
193
193
|
is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and
|
|
194
194
|
for a subdivision its `ISO 3166-2 code`_. Some countries have common or foreign
|
|
195
195
|
names or abbreviations as aliases for their subdivisions. These are defined in
|
|
@@ -242,7 +242,7 @@ All other default values are highlighted with bold:
|
|
|
242
242
|
- AS
|
|
243
243
|
- Can also be loaded as country US, subdivision AS
|
|
244
244
|
-
|
|
245
|
-
- UNOFFICIAL
|
|
245
|
+
- GOVERNMENT, UNOFFICIAL
|
|
246
246
|
* - Andorra
|
|
247
247
|
- AD
|
|
248
248
|
- Parishes: 02, 03, 04, 05, 06, 07, 08
|
|
@@ -522,7 +522,7 @@ All other default values are highlighted with bold:
|
|
|
522
522
|
- GU
|
|
523
523
|
- Can also be loaded as country US, subdivision GU
|
|
524
524
|
-
|
|
525
|
-
- UNOFFICIAL
|
|
525
|
+
- GOVERNMENT, UNOFFICIAL
|
|
526
526
|
* - Guatemala
|
|
527
527
|
- GT
|
|
528
528
|
-
|
|
@@ -560,9 +560,9 @@ All other default values are highlighted with bold:
|
|
|
560
560
|
- HALF_DAY
|
|
561
561
|
* - India
|
|
562
562
|
- IN
|
|
563
|
-
- States: AN, AP, AR, AS, BR, CG, CH, DH, DL, GA, GJ, HP, HR, JH, JK, KA, KL, LA, LD, MH, ML, MN, MP, MZ, NL, OD, PB, PY, RJ, SK, TN, TR, TS, UK, UP, WB
|
|
564
|
-
-
|
|
565
|
-
-
|
|
563
|
+
- States: AN (Andaman and Nicobar Islands), AP (Andhra Pradesh), AR (Arunachal Pradesh, Arunāchal Pradesh), AS (Assam), BR (Bihar, Bihār), CG (Chhattisgarh, Chhattīsgarh), CH (Chandigarh, Chandīgarh), DH (Dadra and Nagar Haveli and Daman and Diu, Dādra and Nagar Haveli and Damān and Diu), DL (Delhi), GA (Goa), GJ (Gujarat, Gujarāt), HP (Himachal Pradesh, Himāchal Pradesh), HR (Haryana, Haryāna), JH (Jharkhand, Jhārkhand), JK (Jammu and Kashmir, Jammu and Kashmīr), KA (Karnataka, Karnātaka), KL (Kerala), LA (Ladakh, Ladākh), LD (Lakshadweep), MH (Maharashtra, Mahārāshtra), ML (Meghalaya, Meghālaya), MN (Manipur), MP (Madhya Pradesh), MZ (Mizoram), NL (Nagaland, Nāgāland), OD (Odisha), PB (Punjab), PY (Puducherry), RJ (Rajasthan, Rājasthān), SK (Sikkim), TN (Tamil Nadu, Tamil Nādu), TR (Tripura), TS (Telangana, Telangāna), UK (Uttarakhand, Uttarākhand), UP (Uttar Pradesh), WB (West Bengal)
|
|
564
|
+
- **en_IN**, en_US, hi
|
|
565
|
+
- OPTIONAL
|
|
566
566
|
* - Indonesia
|
|
567
567
|
- ID
|
|
568
568
|
-
|
|
@@ -663,6 +663,11 @@ All other default values are highlighted with bold:
|
|
|
663
663
|
-
|
|
664
664
|
- de, en_US, fr, **lb**, uk
|
|
665
665
|
-
|
|
666
|
+
* - Macau
|
|
667
|
+
- MO
|
|
668
|
+
- Historical municipalities: I (Concelho das Ilhas, 海島市, 海岛市), M (Concelho de Macau, 澳門市, 澳门市)
|
|
669
|
+
- en_MO, en_US, pt_MO, th, zh_CN, **zh_MO**
|
|
670
|
+
- GOVERNMENT, MANDATORY
|
|
666
671
|
* - Madagascar
|
|
667
672
|
- MG
|
|
668
673
|
-
|
|
@@ -757,7 +762,7 @@ All other default values are highlighted with bold:
|
|
|
757
762
|
- MP
|
|
758
763
|
- Can also be loaded as country US, subdivision MP
|
|
759
764
|
-
|
|
760
|
-
- UNOFFICIAL
|
|
765
|
+
- GOVERNMENT, UNOFFICIAL
|
|
761
766
|
* - North Macedonia
|
|
762
767
|
- MK
|
|
763
768
|
-
|
|
@@ -806,7 +811,7 @@ All other default values are highlighted with bold:
|
|
|
806
811
|
* - Poland
|
|
807
812
|
- PL
|
|
808
813
|
-
|
|
809
|
-
- en_US, **pl**, uk
|
|
814
|
+
- de, en_US, **pl**, uk
|
|
810
815
|
-
|
|
811
816
|
* - Portugal
|
|
812
817
|
- PT
|
|
@@ -817,7 +822,7 @@ All other default values are highlighted with bold:
|
|
|
817
822
|
- PR
|
|
818
823
|
- Can also be loaded as country US, subdivision PR
|
|
819
824
|
-
|
|
820
|
-
- UNOFFICIAL
|
|
825
|
+
- GOVERNMENT, UNOFFICIAL
|
|
821
826
|
* - Romania
|
|
822
827
|
- RO
|
|
823
828
|
-
|
|
@@ -912,7 +917,7 @@ All other default values are highlighted with bold:
|
|
|
912
917
|
- TW
|
|
913
918
|
-
|
|
914
919
|
- en_US, th, zh_CN, **zh_TW**
|
|
915
|
-
-
|
|
920
|
+
- GOVERNMENT, OPTIONAL, SCHOOL, WORKDAY
|
|
916
921
|
* - Tanzania
|
|
917
922
|
- TZ
|
|
918
923
|
-
|
|
@@ -967,17 +972,17 @@ All other default values are highlighted with bold:
|
|
|
967
972
|
- UM
|
|
968
973
|
- Can also be loaded as country US, subdivision UM
|
|
969
974
|
-
|
|
970
|
-
- UNOFFICIAL
|
|
975
|
+
- GOVERNMENT, UNOFFICIAL
|
|
971
976
|
* - United States of America (the)
|
|
972
977
|
- US
|
|
973
978
|
- States and territories: AK, AL, AR, AS, AZ, CA, CO, CT, DC, DE, FL, GA, GU, HI, IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MP, MS, MT, NC, ND, NE, NH, NJ, NM, NV, NY, OH, OK, OR, PA, PR, RI, SC, SD, TN, TX, UM, UT, VA, VI, VT, WA, WI, WV, WY
|
|
974
979
|
-
|
|
975
|
-
- UNOFFICIAL
|
|
980
|
+
- GOVERNMENT, UNOFFICIAL
|
|
976
981
|
* - United States Virgin Islands (the)
|
|
977
982
|
-
|
|
978
983
|
- See Virgin Islands (U.S.)
|
|
979
984
|
-
|
|
980
|
-
-
|
|
985
|
+
-
|
|
981
986
|
* - Uruguay
|
|
982
987
|
- UY
|
|
983
988
|
-
|
|
@@ -1012,7 +1017,7 @@ All other default values are highlighted with bold:
|
|
|
1012
1017
|
- VI
|
|
1013
1018
|
- Can also be loaded as country US, subdivision VI
|
|
1014
1019
|
-
|
|
1015
|
-
- UNOFFICIAL
|
|
1020
|
+
- GOVERNMENT, UNOFFICIAL
|
|
1016
1021
|
* - Zambia
|
|
1017
1022
|
- ZM
|
|
1018
1023
|
-
|