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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
from typing import Union
|
|
14
14
|
|
|
15
15
|
from holidays.calendars.gregorian import MON, TUE, WED, THU, FRI, SAT, SUN
|
|
16
|
-
from holidays.constants import PUBLIC, UNOFFICIAL
|
|
16
|
+
from holidays.constants import GOVERNMENT, PUBLIC, UNOFFICIAL
|
|
17
17
|
from holidays.groups import ChristianHolidays, InternationalHolidays
|
|
18
18
|
from holidays.observed_holiday_base import (
|
|
19
19
|
ObservedHolidayBase,
|
|
@@ -35,6 +35,9 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
35
35
|
"""
|
|
36
36
|
https://en.wikipedia.org/wiki/Public_holidays_in_the_United_States
|
|
37
37
|
|
|
38
|
+
Federal holidays:
|
|
39
|
+
- https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/
|
|
40
|
+
|
|
38
41
|
For Northern Mariana Islands (subdivision MP):
|
|
39
42
|
- https://governor.gov.mp/archived-news/executive-actions-archive/memorandum-2022-legal-holidays/
|
|
40
43
|
- https://webcache.googleusercontent.com/search?q=cache:C17_7FBgPtQJ:https://governor.gov.mp/archived-news/executive-actions-archive/memorandum-2022-legal-holidays/&hl=en&gl=sg&strip=1&vwsrc=0
|
|
@@ -62,6 +65,7 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
62
65
|
- IN: https://digital.statelib.lib.in.us/infoexpress/holidays.aspx
|
|
63
66
|
https://www.in.gov/spd/benefits/state-holidays/
|
|
64
67
|
- MD: https://msa.maryland.gov/msa/mdmanual/01glance/html/holidayl.html
|
|
68
|
+
- MI: https://www.michigan.gov/som/government/state-holidays
|
|
65
69
|
- MN: https://www.revisor.mn.gov/statutes/cite/645.44
|
|
66
70
|
- MT: https://archive.legmt.gov/bills/mca/title_0010/chapter_0010/part_0020/section_0160/0010-0010-0020-0160.html
|
|
67
71
|
- NJ: https://nj.gov/nj/about/facts/holidays/
|
|
@@ -85,7 +89,7 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
85
89
|
"""
|
|
86
90
|
|
|
87
91
|
country = "US"
|
|
88
|
-
supported_categories = (PUBLIC, UNOFFICIAL)
|
|
92
|
+
supported_categories = (GOVERNMENT, PUBLIC, UNOFFICIAL)
|
|
89
93
|
observed_label = "%s (observed)"
|
|
90
94
|
subdivisions: Union[tuple[()], tuple[str, ...]] = (
|
|
91
95
|
"AK", # Alaska.
|
|
@@ -160,20 +164,35 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
160
164
|
kwargs.setdefault("observed_rule", SAT_TO_PREV_FRI + SUN_TO_NEXT_MON)
|
|
161
165
|
super().__init__(*args, **kwargs)
|
|
162
166
|
|
|
163
|
-
def
|
|
167
|
+
def _populate_common(self, include_federal: bool = False):
|
|
168
|
+
"""
|
|
169
|
+
Populates common US holidays.
|
|
170
|
+
|
|
171
|
+
:param include_federal:
|
|
172
|
+
Whether to include federal-specific holidays.
|
|
173
|
+
"""
|
|
164
174
|
# New Year's Day
|
|
165
175
|
if self._year >= 1871:
|
|
166
176
|
name = "New Year's Day"
|
|
167
177
|
self._add_observed(self._add_new_years_day(name))
|
|
168
178
|
self._add_observed(self._next_year_new_years_day, name=name)
|
|
169
179
|
|
|
180
|
+
if include_federal:
|
|
181
|
+
# Birthday of Martin Luther King, Jr.
|
|
182
|
+
if self._year >= 1986:
|
|
183
|
+
self._add_holiday_3rd_mon_of_jan("Birthday of Martin Luther King, Jr.")
|
|
184
|
+
|
|
185
|
+
# Washington's Birthday
|
|
186
|
+
if self._year >= 1879:
|
|
187
|
+
name = "Washington's Birthday"
|
|
188
|
+
if self._year >= 1971:
|
|
189
|
+
self._add_holiday_3rd_mon_of_feb(name)
|
|
190
|
+
else:
|
|
191
|
+
self._add_holiday_feb_22(name)
|
|
192
|
+
|
|
170
193
|
# Memorial Day
|
|
171
|
-
if self._year >=
|
|
172
|
-
|
|
173
|
-
if self._year >= 1971:
|
|
174
|
-
self._add_holiday_last_mon_of_may(name)
|
|
175
|
-
else:
|
|
176
|
-
self._add_holiday_may_30(name)
|
|
194
|
+
if self._year >= 1971:
|
|
195
|
+
self._add_holiday_last_mon_of_may("Memorial Day")
|
|
177
196
|
|
|
178
197
|
# Juneteenth Day
|
|
179
198
|
if self._year >= 2021:
|
|
@@ -187,6 +206,11 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
187
206
|
if self._year >= 1894:
|
|
188
207
|
self._add_holiday_1st_mon_of_sep("Labor Day")
|
|
189
208
|
|
|
209
|
+
if include_federal:
|
|
210
|
+
# Columbus Day
|
|
211
|
+
if self._year >= 1971:
|
|
212
|
+
self._add_holiday_2nd_mon_of_oct("Columbus Day")
|
|
213
|
+
|
|
190
214
|
# Veterans Day
|
|
191
215
|
if self._year >= 1938:
|
|
192
216
|
name = "Veterans Day" if self._year >= 1954 else "Armistice Day"
|
|
@@ -195,14 +219,21 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
195
219
|
else:
|
|
196
220
|
self._add_observed(self._add_remembrance_day(name))
|
|
197
221
|
|
|
198
|
-
# Thanksgiving
|
|
222
|
+
# Thanksgiving Day
|
|
199
223
|
if self._year >= 1871:
|
|
200
|
-
self._add_holiday_4th_thu_of_nov("Thanksgiving")
|
|
224
|
+
self._add_holiday_4th_thu_of_nov("Thanksgiving Day")
|
|
201
225
|
|
|
202
226
|
# Christmas Day
|
|
203
227
|
if self._year >= 1871:
|
|
204
228
|
self._add_observed(self._add_christmas_day("Christmas Day"))
|
|
205
229
|
|
|
230
|
+
def _populate_public_holidays(self):
|
|
231
|
+
self._populate_common()
|
|
232
|
+
|
|
233
|
+
# Memorial Day
|
|
234
|
+
if 1888 <= self._year <= 1970:
|
|
235
|
+
self._add_holiday_may_30("Memorial Day")
|
|
236
|
+
|
|
206
237
|
def _add_christmas_eve_holiday(self):
|
|
207
238
|
# Christmas Eve
|
|
208
239
|
# If on Friday, observed on Thursday
|
|
@@ -324,11 +355,12 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
324
355
|
self._add_holiday_3rd_mon_of_jan("Martin Luther King, Jr & Robert E. Lee's Birthday")
|
|
325
356
|
|
|
326
357
|
# Washington's Birthday
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
self.
|
|
330
|
-
|
|
331
|
-
|
|
358
|
+
if self._year >= 1879:
|
|
359
|
+
name = "George Washington & Thomas Jefferson's Birthday"
|
|
360
|
+
if self._year >= 1971:
|
|
361
|
+
self._add_holiday_3rd_mon_of_feb(name)
|
|
362
|
+
else:
|
|
363
|
+
self._add_holiday_feb_22(name)
|
|
332
364
|
|
|
333
365
|
# Confederate Memorial Day
|
|
334
366
|
if self._year >= 1866:
|
|
@@ -356,11 +388,12 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
356
388
|
)
|
|
357
389
|
|
|
358
390
|
# Washington's Birthday
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
self.
|
|
362
|
-
|
|
363
|
-
|
|
391
|
+
if self._year >= 1879:
|
|
392
|
+
name = "George Washington's Birthday and Daisy Gatson Bates Day"
|
|
393
|
+
if self._year >= 1971:
|
|
394
|
+
self._add_holiday_3rd_mon_of_feb(name)
|
|
395
|
+
else:
|
|
396
|
+
self._add_holiday_feb_22(name)
|
|
364
397
|
|
|
365
398
|
def _populate_subdiv_as_public_holidays(self):
|
|
366
399
|
# American Samoa Flag Day
|
|
@@ -493,10 +526,11 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
493
526
|
)
|
|
494
527
|
|
|
495
528
|
# Washington's Birthday
|
|
496
|
-
self.
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
529
|
+
if self._year >= 1879:
|
|
530
|
+
self._add_holiday(
|
|
531
|
+
"Washington's Birthday",
|
|
532
|
+
self._get_observed_date(self._christmas_day, rule=GA_IN_WASHINGTON_BIRTHDAY),
|
|
533
|
+
)
|
|
500
534
|
|
|
501
535
|
def _populate_subdiv_gu_public_holidays(self):
|
|
502
536
|
# Guam Discovery Day
|
|
@@ -587,10 +621,11 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
587
621
|
self._add_holiday_1_day_past_4th_thu_of_nov("Lincoln's Birthday")
|
|
588
622
|
|
|
589
623
|
# Washington's Birthday
|
|
590
|
-
self.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
624
|
+
if self._year >= 1879:
|
|
625
|
+
self._add_holiday(
|
|
626
|
+
"Washington's Birthday",
|
|
627
|
+
self._get_observed_date(self._christmas_day, rule=GA_IN_WASHINGTON_BIRTHDAY),
|
|
628
|
+
)
|
|
594
629
|
|
|
595
630
|
def _populate_subdiv_ks_public_holidays(self):
|
|
596
631
|
# Christmas Eve
|
|
@@ -684,6 +719,14 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
684
719
|
# New Year's Eve
|
|
685
720
|
self._add_observed(self._add_new_years_eve("New Year's Eve"))
|
|
686
721
|
|
|
722
|
+
# Election Day
|
|
723
|
+
if self._year >= 2008 and self._year % 2 == 0:
|
|
724
|
+
self._add_holiday_1_day_past_1st_mon_of_nov("Election Day")
|
|
725
|
+
|
|
726
|
+
# Day after Thanksgiving
|
|
727
|
+
if self._year >= 2017:
|
|
728
|
+
self._add_holiday_1_day_past_4th_thu_of_nov("Day After Thanksgiving")
|
|
729
|
+
|
|
687
730
|
def _populate_subdiv_mn_public_holidays(self):
|
|
688
731
|
# Washington's Birthday
|
|
689
732
|
if self._year >= 1971:
|
|
@@ -872,7 +915,8 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
872
915
|
self._add_epiphany_day("Epiphany")
|
|
873
916
|
|
|
874
917
|
# Washington's Birthday
|
|
875
|
-
self.
|
|
918
|
+
if self._year >= 1971:
|
|
919
|
+
self._add_holiday_3rd_mon_of_feb("Presidents' Day")
|
|
876
920
|
|
|
877
921
|
# Emancipation Day
|
|
878
922
|
self._add_observed(self._add_holiday_mar_22("Emancipation Day"), rule=SUN_TO_NEXT_MON)
|
|
@@ -1015,11 +1059,12 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
1015
1059
|
self._add_epiphany_day("Three Kings Day")
|
|
1016
1060
|
|
|
1017
1061
|
# Washington's Birthday
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
self.
|
|
1021
|
-
|
|
1022
|
-
|
|
1062
|
+
if self._year >= 1879:
|
|
1063
|
+
name = "Presidents' Day"
|
|
1064
|
+
if self._year >= 1971:
|
|
1065
|
+
self._add_holiday_3rd_mon_of_feb(name)
|
|
1066
|
+
else:
|
|
1067
|
+
self._add_holiday_feb_22(name)
|
|
1023
1068
|
|
|
1024
1069
|
# Transfer Day
|
|
1025
1070
|
self._add_holiday_mar_31("Transfer Day")
|
|
@@ -1102,6 +1147,10 @@ class UnitedStates(ObservedHolidayBase, ChristianHolidays, InternationalHolidays
|
|
|
1102
1147
|
if self._year >= 1971:
|
|
1103
1148
|
self._add_holiday_3rd_mon_of_feb("President's Day")
|
|
1104
1149
|
|
|
1150
|
+
def _populate_government_holidays(self):
|
|
1151
|
+
# Federal holidays in the United States.
|
|
1152
|
+
self._populate_common(include_federal=True)
|
|
1153
|
+
|
|
1105
1154
|
def _populate_unofficial_holidays(self):
|
|
1106
1155
|
# Very common celebrated cultural days, but no official observance.
|
|
1107
1156
|
# Due to its nature, no in-lieus are observed.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# Website: https://github.com/vacanza/holidays
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
|
-
from holidays.constants import PUBLIC, UNOFFICIAL
|
|
13
|
+
from holidays.constants import GOVERNMENT, PUBLIC, UNOFFICIAL
|
|
14
14
|
from holidays.countries.united_states import US
|
|
15
15
|
|
|
16
16
|
|
|
@@ -20,13 +20,17 @@ class HolidaysUM(US):
|
|
|
20
20
|
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1
|
|
21
21
|
|
|
22
22
|
country = "UM"
|
|
23
|
-
supported_categories = (PUBLIC, UNOFFICIAL)
|
|
23
|
+
supported_categories = (GOVERNMENT, PUBLIC, UNOFFICIAL)
|
|
24
24
|
subdivisions = () # Override US subdivisions.
|
|
25
25
|
|
|
26
26
|
def _populate_public_holidays(self) -> None:
|
|
27
27
|
self.subdiv = "UM"
|
|
28
28
|
super()._populate_public_holidays()
|
|
29
29
|
|
|
30
|
+
def _populate_government_holidays(self) -> None:
|
|
31
|
+
self.subdiv = "UM"
|
|
32
|
+
super()._populate_government_holidays()
|
|
33
|
+
|
|
30
34
|
def _populate_unofficial_holidays(self) -> None:
|
|
31
35
|
self.subdiv = "UM"
|
|
32
36
|
super()._populate_unofficial_holidays()
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# Website: https://github.com/vacanza/holidays
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
|
-
from holidays.constants import PUBLIC, UNOFFICIAL
|
|
13
|
+
from holidays.constants import GOVERNMENT, PUBLIC, UNOFFICIAL
|
|
14
14
|
from holidays.countries.united_states import US
|
|
15
15
|
|
|
16
16
|
|
|
@@ -20,13 +20,17 @@ class HolidaysVI(US):
|
|
|
20
20
|
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1
|
|
21
21
|
|
|
22
22
|
country = "VI"
|
|
23
|
-
supported_categories = (PUBLIC, UNOFFICIAL)
|
|
23
|
+
supported_categories = (GOVERNMENT, PUBLIC, UNOFFICIAL)
|
|
24
24
|
subdivisions = () # Override US subdivisions.
|
|
25
25
|
|
|
26
26
|
def _populate_public_holidays(self) -> None:
|
|
27
27
|
self.subdiv = "VI"
|
|
28
28
|
super()._populate_public_holidays()
|
|
29
29
|
|
|
30
|
+
def _populate_government_holidays(self) -> None:
|
|
31
|
+
self.subdiv = "VI"
|
|
32
|
+
super()._populate_government_holidays()
|
|
33
|
+
|
|
30
34
|
def _populate_unofficial_holidays(self) -> None:
|
|
31
35
|
self.subdiv = "VI"
|
|
32
36
|
super()._populate_unofficial_holidays()
|
holidays/countries/uzbekistan.py
CHANGED
|
@@ -38,9 +38,15 @@ class Uzbekistan(ObservedHolidayBase, InternationalHolidays, IslamicHolidays, St
|
|
|
38
38
|
supported_languages = ("en_US", "uk", "uz")
|
|
39
39
|
start_year = 1992
|
|
40
40
|
|
|
41
|
-
def __init__(self, *args, **kwargs):
|
|
41
|
+
def __init__(self, islamic_show_estimated: bool = True, *args, **kwargs):
|
|
42
|
+
"""
|
|
43
|
+
:param islamic_show_estimated:
|
|
44
|
+
Whether to add "estimated" label to Islamic holidays name if holiday date is estimated.
|
|
45
|
+
"""
|
|
42
46
|
InternationalHolidays.__init__(self)
|
|
43
|
-
IslamicHolidays.__init__(
|
|
47
|
+
IslamicHolidays.__init__(
|
|
48
|
+
self, cls=UzbekistanIslamicHolidays, show_estimated=islamic_show_estimated
|
|
49
|
+
)
|
|
44
50
|
StaticHolidays.__init__(self, UzbekistanStaticHolidays)
|
|
45
51
|
kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_WORKDAY)
|
|
46
52
|
super().__init__(*args, **kwargs)
|
holidays/groups/__init__.py
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
# flake8: noqa: F401
|
|
14
14
|
|
|
15
|
+
from holidays.groups.balinese_saka import BalineseSakaCalendarHolidays
|
|
15
16
|
from holidays.groups.buddhist import BuddhistCalendarHolidays
|
|
16
17
|
from holidays.groups.chinese import ChineseCalendarHolidays
|
|
17
18
|
from holidays.groups.christian import ChristianHolidays
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# holidays
|
|
2
|
+
# --------
|
|
3
|
+
# A fast, efficient Python library for generating country, province and state
|
|
4
|
+
# specific sets of holidays on the fly. It aims to make determining whether a
|
|
5
|
+
# specific date is a holiday as fast and flexible as possible.
|
|
6
|
+
#
|
|
7
|
+
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
|
|
8
|
+
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
|
|
9
|
+
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
|
|
10
|
+
# Website: https://github.com/vacanza/holidays
|
|
11
|
+
# License: MIT (see LICENSE file)
|
|
12
|
+
|
|
13
|
+
from datetime import date
|
|
14
|
+
from typing import Optional
|
|
15
|
+
|
|
16
|
+
from holidays.calendars import _BalineseSakaLunar
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class BalineseSakaCalendarHolidays:
|
|
20
|
+
"""
|
|
21
|
+
Balinese Saka lunar calendar holidays.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self) -> None:
|
|
25
|
+
self._balinese_saka_calendar = _BalineseSakaLunar()
|
|
26
|
+
|
|
27
|
+
def _add_balinese_saka_calendar_holiday(self, name: str, dt: Optional[date]) -> Optional[date]:
|
|
28
|
+
"""
|
|
29
|
+
Add Balinese Saka calendar holiday.
|
|
30
|
+
"""
|
|
31
|
+
if dt is None:
|
|
32
|
+
return None
|
|
33
|
+
return self._add_holiday(name, dt)
|
|
34
|
+
|
|
35
|
+
def _add_nyepi(self, name) -> Optional[date]:
|
|
36
|
+
"""
|
|
37
|
+
Add Nyepi (Day following the 9th of Dark Moon (Tilem)).
|
|
38
|
+
|
|
39
|
+
Nyepi is a Balinese "Day of Silence" that is commemorated every
|
|
40
|
+
Isakawarsa (Saka new year) according to the Balinese calendar.
|
|
41
|
+
https://en.wikipedia.org/wiki/Nyepi
|
|
42
|
+
"""
|
|
43
|
+
return self._add_balinese_saka_calendar_holiday(
|
|
44
|
+
name, self._balinese_saka_calendar.nyepi_date(self._year)
|
|
45
|
+
)
|
holidays/groups/chinese.py
CHANGED
|
@@ -14,7 +14,7 @@ from datetime import date
|
|
|
14
14
|
from typing import Optional
|
|
15
15
|
|
|
16
16
|
from holidays.calendars import _ChineseLunisolar
|
|
17
|
-
from holidays.calendars.gregorian import APR
|
|
17
|
+
from holidays.calendars.gregorian import APR, DEC
|
|
18
18
|
from holidays.groups.eastern import EasternCalendarHolidays
|
|
19
19
|
|
|
20
20
|
|
|
@@ -35,7 +35,10 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
35
35
|
return self._chinese_calendar.lunar_new_year_date(self._year)[0]
|
|
36
36
|
|
|
37
37
|
@property
|
|
38
|
-
def
|
|
38
|
+
def _qingming_festival(self):
|
|
39
|
+
"""
|
|
40
|
+
Return Qingming Festival (15th day after the Spring Equinox) date.
|
|
41
|
+
"""
|
|
39
42
|
day = 5
|
|
40
43
|
if (self._year % 4 < 1) or (self._year % 4 < 2 and self._year >= 2009):
|
|
41
44
|
day = 4
|
|
@@ -48,6 +51,47 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
48
51
|
"""
|
|
49
52
|
return self._chinese_calendar.mid_autumn_date(self._year)[0]
|
|
50
53
|
|
|
54
|
+
@property
|
|
55
|
+
def _chinese_birthday_of_buddha(self):
|
|
56
|
+
"""
|
|
57
|
+
Return Add Birthday of the Buddha by Chinese lunar calendar (8th day of the
|
|
58
|
+
4th lunar month).
|
|
59
|
+
"""
|
|
60
|
+
return self._chinese_calendar.buddha_birthday_date(self._year)[0]
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def _dragon_boat_festival(self):
|
|
64
|
+
"""
|
|
65
|
+
Return Dragon Boat Festival (5th day of 5th lunar month) date.
|
|
66
|
+
"""
|
|
67
|
+
return self._chinese_calendar.dragon_boat_date(self._year)[0]
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def _double_ninth_festival(self):
|
|
71
|
+
"""
|
|
72
|
+
Return Double Ninth Festival (9th day of 9th lunar month) date.
|
|
73
|
+
"""
|
|
74
|
+
return self._chinese_calendar.double_ninth_date(self._year)[0]
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def _dongzhi_festival(self):
|
|
78
|
+
"""
|
|
79
|
+
Return Dongzhi Festival (Chinese Winter Solstice) date.
|
|
80
|
+
|
|
81
|
+
This approximation is reliable for 1952-2099 years.
|
|
82
|
+
"""
|
|
83
|
+
#
|
|
84
|
+
if (
|
|
85
|
+
(self._year % 4 == 0 and self._year >= 1988)
|
|
86
|
+
or (self._year % 4 == 1 and self._year >= 2021)
|
|
87
|
+
or (self._year % 4 == 2 and self._year >= 2058)
|
|
88
|
+
or (self._year % 4 == 3 and self._year >= 2091)
|
|
89
|
+
):
|
|
90
|
+
day = 21
|
|
91
|
+
else:
|
|
92
|
+
day = 22
|
|
93
|
+
return date(self._year, DEC, day)
|
|
94
|
+
|
|
51
95
|
def _add_chinese_calendar_holiday(
|
|
52
96
|
self, name: str, dt_estimated: tuple[Optional[date], bool], days_delta: int = 0
|
|
53
97
|
) -> Optional[date]:
|
|
@@ -128,6 +172,27 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
128
172
|
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+3
|
|
129
173
|
)
|
|
130
174
|
|
|
175
|
+
def _add_chinese_new_years_day_five(self, name) -> Optional[date]:
|
|
176
|
+
"""
|
|
177
|
+
Add Chinese New Year's Day Five.
|
|
178
|
+
|
|
179
|
+
https://en.wikipedia.org/wiki/Chinese_New_Year
|
|
180
|
+
"""
|
|
181
|
+
return self._add_chinese_calendar_holiday(
|
|
182
|
+
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+4
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
def _add_dongzhi_festival(self, name) -> Optional[date]:
|
|
186
|
+
"""
|
|
187
|
+
Add Dongzhi Festival (Chinese Winter Solstice).
|
|
188
|
+
|
|
189
|
+
The Dongzhi Festival or Winter Solstice Festival is a traditional
|
|
190
|
+
Chinese festival celebrated during the Dongzhi solar term
|
|
191
|
+
(winter solstice), which falls between December 21 and 23.
|
|
192
|
+
https://en.wikipedia.org/wiki/Dongzhi_Festival
|
|
193
|
+
"""
|
|
194
|
+
return self._add_holiday(name, self._dongzhi_festival)
|
|
195
|
+
|
|
131
196
|
def _add_qingming_festival(self, name) -> date:
|
|
132
197
|
"""
|
|
133
198
|
Add Qingming Festival (15th day after the Spring Equinox).
|
|
@@ -136,7 +201,7 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
136
201
|
Tomb-Sweeping Day in English, is a traditional Chinese festival.
|
|
137
202
|
https://en.wikipedia.org/wiki/Qingming_Festival
|
|
138
203
|
"""
|
|
139
|
-
return self._add_holiday(name, self.
|
|
204
|
+
return self._add_holiday(name, self._qingming_festival)
|
|
140
205
|
|
|
141
206
|
def _add_double_ninth_festival(self, name) -> Optional[date]:
|
|
142
207
|
"""
|