holidays 0.81__py3-none-any.whl → 0.83__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/burmese.py +319 -0
- holidays/calendars/hebrew.py +2 -2
- holidays/calendars/islamic.py +26 -6
- holidays/calendars/thai.py +49 -2
- holidays/countries/__init__.py +11 -0
- holidays/countries/afghanistan.py +7 -5
- holidays/countries/algeria.py +89 -24
- holidays/countries/antarctica.py +58 -0
- holidays/countries/azerbaijan.py +1 -1
- holidays/countries/bouvet_island.py +31 -0
- holidays/countries/brazil.py +1 -1
- holidays/countries/british_indian_ocean_territory.py +31 -0
- holidays/countries/bulgaria.py +6 -1
- holidays/countries/canada.py +27 -13
- holidays/countries/chile.py +9 -8
- holidays/countries/cuba.py +3 -4
- holidays/countries/denmark.py +18 -6
- holidays/countries/djibouti.py +1 -1
- holidays/countries/fiji.py +2 -3
- holidays/countries/finland.py +3 -6
- holidays/countries/guyana.py +24 -32
- holidays/countries/heard_island_and_mcdonald_islands.py +31 -0
- holidays/countries/hungary.py +4 -5
- holidays/countries/india.py +27 -78
- holidays/countries/iran.py +133 -269
- holidays/countries/ireland.py +1 -1
- holidays/countries/israel.py +1 -1
- holidays/countries/japan.py +22 -18
- holidays/countries/jordan.py +6 -3
- holidays/countries/kuwait.py +6 -3
- holidays/countries/macau.py +5 -8
- holidays/countries/malaysia.py +14 -3
- holidays/countries/mauritius.py +10 -9
- holidays/countries/montserrat.py +1 -1
- holidays/countries/myanmar.py +194 -0
- holidays/countries/nepal.py +11 -30
- holidays/countries/netherlands.py +28 -24
- holidays/countries/new_zealand.py +75 -31
- holidays/countries/nigeria.py +53 -75
- holidays/countries/north_korea.py +161 -0
- holidays/countries/norway.py +24 -9
- holidays/countries/oman.py +6 -2
- holidays/countries/paraguay.py +70 -23
- holidays/countries/portugal.py +5 -6
- holidays/countries/qatar.py +5 -2
- holidays/countries/rwanda.py +8 -3
- holidays/countries/saudi_arabia.py +6 -5
- holidays/countries/serbia.py +5 -0
- holidays/countries/slovakia.py +23 -4
- holidays/countries/south_africa.py +96 -53
- holidays/countries/south_korea.py +6 -1
- holidays/countries/spain.py +4 -4
- holidays/countries/sri_lanka.py +21 -58
- holidays/countries/sudan.py +6 -3
- holidays/countries/suriname.py +1 -2
- holidays/countries/sweden.py +1 -1
- holidays/countries/switzerland.py +255 -6
- holidays/countries/taiwan.py +23 -3
- holidays/countries/tanzania.py +25 -30
- holidays/countries/thailand.py +29 -7
- holidays/countries/tonga.py +6 -1
- holidays/countries/trinidad_and_tobago.py +7 -2
- holidays/countries/ukraine.py +1 -1
- holidays/countries/united_arab_emirates.py +9 -2
- holidays/countries/united_kingdom.py +1 -1
- holidays/countries/united_states.py +18 -2
- holidays/countries/uruguay.py +6 -1
- holidays/countries/vietnam.py +6 -1
- holidays/countries/western_sahara.py +92 -0
- holidays/countries/yemen.py +6 -3
- holidays/groups/__init__.py +1 -0
- holidays/groups/balinese_saka.py +1 -1
- holidays/groups/buddhist.py +3 -3
- holidays/groups/burmese.py +273 -0
- holidays/groups/chinese.py +30 -2
- holidays/groups/christian.py +10 -0
- holidays/groups/custom.py +8 -2
- holidays/groups/eastern.py +26 -0
- holidays/groups/hebrew.py +16 -14
- holidays/groups/hindu.py +23 -15
- holidays/groups/international.py +1 -1
- holidays/groups/islamic.py +52 -50
- holidays/groups/mongolian.py +6 -3
- holidays/groups/sinhala.py +9 -11
- holidays/groups/tibetan.py +8 -6
- holidays/holiday_base.py +26 -26
- holidays/ical.py +6 -4
- holidays/locale/ar/LC_MESSAGES/DZ.mo +0 -0
- holidays/locale/ar/LC_MESSAGES/EH.mo +0 -0
- holidays/locale/ca/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/de/LC_MESSAGES/CH.mo +0 -0
- holidays/locale/en_IN/LC_MESSAGES/IN.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/BR.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/CH.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/DZ.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/EH.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/IN.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/JP.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/KP.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/MM.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/NL.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/PY.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/US.mo +0 -0
- holidays/locale/es/LC_MESSAGES/EH.mo +0 -0
- holidays/locale/es/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/es/LC_MESSAGES/PY.mo +0 -0
- holidays/locale/fr/LC_MESSAGES/CH.mo +0 -0
- holidays/locale/fr/LC_MESSAGES/DZ.mo +0 -0
- holidays/locale/fr/LC_MESSAGES/EH.mo +0 -0
- holidays/locale/fy/LC_MESSAGES/NL.mo +0 -0
- holidays/locale/hi/LC_MESSAGES/IN.mo +0 -0
- holidays/locale/it/LC_MESSAGES/CH.mo +0 -0
- holidays/locale/ja/LC_MESSAGES/JP.mo +0 -0
- holidays/locale/ko_KP/LC_MESSAGES/KP.mo +0 -0
- holidays/locale/my/LC_MESSAGES/MM.mo +0 -0
- holidays/locale/nl/LC_MESSAGES/NL.mo +0 -0
- holidays/locale/pt_BR/LC_MESSAGES/BR.mo +0 -0
- holidays/locale/th/LC_MESSAGES/CH.mo +0 -0
- holidays/locale/th/LC_MESSAGES/DK.mo +0 -0
- holidays/locale/th/LC_MESSAGES/JP.mo +0 -0
- holidays/locale/th/LC_MESSAGES/MM.mo +0 -0
- holidays/locale/th/LC_MESSAGES/NL.mo +0 -0
- holidays/locale/th/LC_MESSAGES/US.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/BR.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/CH.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/NL.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/PY.mo +0 -0
- holidays/no_holiday_base.py +21 -0
- holidays/observed_holiday_base.py +16 -4
- holidays/registry.py +8 -0
- holidays/utils.py +5 -5
- holidays/version.py +1 -1
- {holidays-0.81.dist-info → holidays-0.83.dist-info}/METADATA +63 -19
- {holidays-0.81.dist-info → holidays-0.83.dist-info}/RECORD +141 -118
- {holidays-0.81.dist-info → holidays-0.83.dist-info}/licenses/CONTRIBUTORS +2 -0
- {holidays-0.81.dist-info → holidays-0.83.dist-info}/WHEEL +0 -0
- {holidays-0.81.dist-info → holidays-0.83.dist-info}/licenses/LICENSE +0 -0
- {holidays-0.81.dist-info → holidays-0.83.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,273 @@
|
|
|
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 CONTRIBUTORS 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.burmese import _BurmeseLunisolar
|
|
17
|
+
from holidays.calendars.gregorian import _timedelta
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class BurmeseCalendarHolidays:
|
|
21
|
+
"""Burmese lunisolar calendar holidays."""
|
|
22
|
+
|
|
23
|
+
def __init__(self) -> None:
|
|
24
|
+
self._burmese_calendar = _BurmeseLunisolar()
|
|
25
|
+
|
|
26
|
+
def _add_burmese_calendar_holiday(
|
|
27
|
+
self, name: str, dt: Optional[date] = None, days_delta: int = 0
|
|
28
|
+
) -> Optional[date]:
|
|
29
|
+
"""Add Burmese calendar holiday."""
|
|
30
|
+
|
|
31
|
+
if dt is None:
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
if days_delta:
|
|
35
|
+
dt = _timedelta(dt, days_delta)
|
|
36
|
+
|
|
37
|
+
return self._add_holiday(name, dt)
|
|
38
|
+
|
|
39
|
+
def _add_karen_new_year(self, name: str) -> set[date]:
|
|
40
|
+
"""Add Karen New Year holiday.
|
|
41
|
+
|
|
42
|
+
The Karen New Year, also known as the Kayin New Year, is one of the major holidays
|
|
43
|
+
celebrated by the Karen people. The Karen New Year falls on the first day of Pyatho,
|
|
44
|
+
the tenth month in the Burmese calendar.
|
|
45
|
+
https://en.wikipedia.org/wiki/Karen_New_Year
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
name:
|
|
49
|
+
Holiday name.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Set of dates of added holiday, empty if there is no holiday date for the current year.
|
|
53
|
+
"""
|
|
54
|
+
return {
|
|
55
|
+
dt
|
|
56
|
+
for y in (self._year - 1, self._year)
|
|
57
|
+
if (
|
|
58
|
+
dt := self._add_burmese_calendar_holiday(
|
|
59
|
+
name, self._burmese_calendar.pyatho_waxing_moon_date(y)
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def _add_kason_full_moon_day(self, name: str) -> Optional[date]:
|
|
65
|
+
"""Add Full Moon Day of Kason holiday.
|
|
66
|
+
|
|
67
|
+
Vesak is known as the Full Moon Day of Kason, which is the second month
|
|
68
|
+
in the traditional Burmese calendar.
|
|
69
|
+
https://en.wikipedia.org/wiki/Vesak#In_Myanmar_(Burma)
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
name:
|
|
73
|
+
Holiday name.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
77
|
+
"""
|
|
78
|
+
return self._add_burmese_calendar_holiday(
|
|
79
|
+
name, self._burmese_calendar.kason_full_moon_date(self._year)
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def _add_myanmar_diwali(self, name: str) -> Optional[date]:
|
|
83
|
+
"""Add Myanmar Diwali holiday.
|
|
84
|
+
|
|
85
|
+
Diwali (Deepavali, Festival of Lights) is one of the most important festivals
|
|
86
|
+
in Indian religions. In Myanmar, it is celebrated on first day of Tazaungmon,
|
|
87
|
+
the eighth month of the Burmese calendar.
|
|
88
|
+
https://en.wikipedia.org/wiki/Diwali
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
name:
|
|
92
|
+
Holiday name.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
96
|
+
"""
|
|
97
|
+
return self._add_burmese_calendar_holiday(
|
|
98
|
+
name, self._burmese_calendar.tazaungmon_waxing_moon_date(self._year)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def _add_myanmar_national_day(self, name: str) -> Optional[date]:
|
|
102
|
+
"""Add Myanmar National Day holiday.
|
|
103
|
+
|
|
104
|
+
National Day is a public holiday in Myanmar, marking the anniversary of the first
|
|
105
|
+
university student strike at Rangoon University in 1920. The date is based on
|
|
106
|
+
the traditional Burmese calendar, occurring on the 10th day following
|
|
107
|
+
the full moon of Tazaungmon.
|
|
108
|
+
https://en.wikipedia.org/wiki/National_Day_(Myanmar)
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
name:
|
|
112
|
+
Holiday name.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
116
|
+
"""
|
|
117
|
+
return self._add_burmese_calendar_holiday(
|
|
118
|
+
name, self._burmese_calendar.tazaungmon_full_moon_date(self._year), days_delta=+10
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
def _add_myanmar_new_year(
|
|
122
|
+
self,
|
|
123
|
+
name: str,
|
|
124
|
+
extra_days_before: int = 0,
|
|
125
|
+
extra_days_after: int = 0,
|
|
126
|
+
) -> set[date]:
|
|
127
|
+
"""Add Myanmar New Year (Thingyan, Water Festival).
|
|
128
|
+
|
|
129
|
+
Thingyan, also known as the Myanmar New Year, is a festival that usually occurs
|
|
130
|
+
in middle of April. Thingyan marks the transition from the old year to the new one,
|
|
131
|
+
based on the traditional Myanmar lunisolar calendar. The festival usually spans
|
|
132
|
+
four to five days.
|
|
133
|
+
|
|
134
|
+
https://en.wikipedia.org/wiki/Thingyan.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
name:
|
|
138
|
+
Holiday name.
|
|
139
|
+
|
|
140
|
+
extra_days_before:
|
|
141
|
+
Number of additional holiday days preceding Akya.
|
|
142
|
+
|
|
143
|
+
extra_days_after:
|
|
144
|
+
Whether to add additional holiday days following Atat.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Set of dates of added holiday, empty if there is no holiday date for the current year.
|
|
148
|
+
"""
|
|
149
|
+
akya, atat = self._burmese_calendar.thingyan_dates(self._year)
|
|
150
|
+
if akya is None or atat is None:
|
|
151
|
+
return set()
|
|
152
|
+
|
|
153
|
+
# Default length is from Thingyan Akyo (akya - 1) to New Year Day (atat + 1).
|
|
154
|
+
# Optional additional days:
|
|
155
|
+
# pre-Akya days (1 day in 2007-2016, 4 days in 2022-2023),
|
|
156
|
+
# post-Atat days (3 or 4 days).
|
|
157
|
+
begin = -1 - extra_days_before
|
|
158
|
+
end = extra_days_after or (atat - akya).days + 1
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
dt
|
|
162
|
+
for delta in range(begin, end)
|
|
163
|
+
if (dt := self._add_holiday(name, _timedelta(akya, delta)))
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
def _add_tabaung_full_moon_day(self, name: str) -> Optional[date]:
|
|
167
|
+
"""Add Full Moon Day of Tabaung holiday.
|
|
168
|
+
|
|
169
|
+
Māgha Pūjā (also written as Makha Bucha Day, Meak Bochea) is a Buddhist festival
|
|
170
|
+
celebrated on the full moon day of Tabaung in Myanmar.
|
|
171
|
+
https://en.wikipedia.org/wiki/Māgha_Pūjā#Myanmar_(Burma)
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
name:
|
|
175
|
+
Holiday name.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
179
|
+
"""
|
|
180
|
+
return self._add_burmese_calendar_holiday(
|
|
181
|
+
name, self._burmese_calendar.tabaung_full_moon_date(self._year - 1)
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
def _add_tazaungmon_full_moon_day(self, name: str) -> Optional[date]:
|
|
185
|
+
"""Add Full Moon Day of Tazaungmon holiday.
|
|
186
|
+
|
|
187
|
+
The Tazaungdaing Festival, also known as the Festival of Lights, held on the full moon day
|
|
188
|
+
of Tazaungmon, the eighth month of the Burmese calendar.
|
|
189
|
+
https://en.wikipedia.org/wiki/Tazaungdaing_festival
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
name:
|
|
193
|
+
Holiday name.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
197
|
+
"""
|
|
198
|
+
return self._add_burmese_calendar_holiday(
|
|
199
|
+
name, self._burmese_calendar.tazaungmon_full_moon_date(self._year)
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def _add_thadingyut_full_moon_eve(self, name: str) -> Optional[date]:
|
|
203
|
+
"""Add Pre-Full Moon Day of Thadingyut holiday.
|
|
204
|
+
|
|
205
|
+
The Thadingyut Festival, also known as the Lighting Festival of Myanmar, is held
|
|
206
|
+
on the full moon day of the Burmese lunar month of Thadingyut.
|
|
207
|
+
https://en.wikipedia.org/wiki/Thadingyut_Festival
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
name:
|
|
211
|
+
Holiday name.
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
215
|
+
"""
|
|
216
|
+
return self._add_burmese_calendar_holiday(
|
|
217
|
+
name, self._burmese_calendar.thadingyut_full_moon_date(self._year), days_delta=-1
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
def _add_thadingyut_full_moon_day(self, name: str) -> Optional[date]:
|
|
221
|
+
"""Add Full Moon Day of Thadingyut holiday.
|
|
222
|
+
|
|
223
|
+
The Thadingyut Festival, also known as the Lighting Festival of Myanmar, is held
|
|
224
|
+
on the full moon day of the Burmese lunar month of Thadingyut.
|
|
225
|
+
https://en.wikipedia.org/wiki/Thadingyut_Festival
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
name:
|
|
229
|
+
Holiday name.
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
233
|
+
"""
|
|
234
|
+
return self._add_burmese_calendar_holiday(
|
|
235
|
+
name, self._burmese_calendar.thadingyut_full_moon_date(self._year)
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
def _add_thadingyut_full_moon_day_two(self, name: str) -> Optional[date]:
|
|
239
|
+
"""Add Post-Full Moon Day of Thadingyut holiday.
|
|
240
|
+
|
|
241
|
+
The Thadingyut Festival, also known as the Lighting Festival of Myanmar, is held
|
|
242
|
+
on the full moon day of the Burmese lunar month of Thadingyut.
|
|
243
|
+
https://en.wikipedia.org/wiki/Thadingyut_Festival
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
name:
|
|
247
|
+
Holiday name.
|
|
248
|
+
|
|
249
|
+
Returns:
|
|
250
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
251
|
+
"""
|
|
252
|
+
return self._add_burmese_calendar_holiday(
|
|
253
|
+
name, self._burmese_calendar.thadingyut_full_moon_date(self._year), days_delta=+1
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
def _add_waso_full_moon_day(self, name: str) -> Optional[date]:
|
|
257
|
+
"""Add Full Moon Day of Waso holiday.
|
|
258
|
+
|
|
259
|
+
Vassa is the three-month annual retreat observed by Theravada Buddhists.
|
|
260
|
+
Vassa lasts for three lunar months, from the Burmese month of Waso to
|
|
261
|
+
the Burmese month of Thadingyut.
|
|
262
|
+
https://en.wikipedia.org/wiki/Vassa
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
name:
|
|
266
|
+
Holiday name.
|
|
267
|
+
|
|
268
|
+
Returns:
|
|
269
|
+
Date of added holiday, `None` if there is no holiday date for the current year.
|
|
270
|
+
"""
|
|
271
|
+
return self._add_burmese_calendar_holiday(
|
|
272
|
+
name, self._burmese_calendar.waso_full_moon_date(self._year)
|
|
273
|
+
)
|
holidays/groups/chinese.py
CHANGED
|
@@ -23,7 +23,7 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
23
23
|
Chinese lunisolar calendar holidays.
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
|
-
def __init__(self, cls=None, show_estimated=False, calendar=CHINESE_CALENDAR) -> None:
|
|
26
|
+
def __init__(self, cls=None, *, show_estimated=False, calendar=CHINESE_CALENDAR) -> None:
|
|
27
27
|
self._chinese_calendar = (
|
|
28
28
|
cls(calendar=calendar) if cls else _ChineseLunisolar(calendar=calendar)
|
|
29
29
|
)
|
|
@@ -92,7 +92,10 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
92
92
|
is an estimation.
|
|
93
93
|
"""
|
|
94
94
|
return self._add_eastern_calendar_holiday(
|
|
95
|
-
name,
|
|
95
|
+
name,
|
|
96
|
+
dt_estimated,
|
|
97
|
+
show_estimated=self._chinese_calendar_show_estimated,
|
|
98
|
+
days_delta=days_delta,
|
|
96
99
|
)
|
|
97
100
|
|
|
98
101
|
def _add_chinese_birthday_of_buddha(self, name) -> Optional[date]:
|
|
@@ -183,6 +186,18 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
183
186
|
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+4
|
|
184
187
|
)
|
|
185
188
|
|
|
189
|
+
def _add_daeboreum_day(self, name) -> Optional[date]:
|
|
190
|
+
"""
|
|
191
|
+
Add Daeboreum Day (15th day of 1st lunar month).
|
|
192
|
+
|
|
193
|
+
Daeboreum is a Korean holiday that celebrates the first full moon
|
|
194
|
+
of the new year of the lunar Korean calendar.
|
|
195
|
+
https://en.wikipedia.org/wiki/Daeboreum
|
|
196
|
+
"""
|
|
197
|
+
return self._add_chinese_calendar_holiday(
|
|
198
|
+
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+14
|
|
199
|
+
)
|
|
200
|
+
|
|
186
201
|
def _add_dongzhi_festival(self, name) -> Optional[date]:
|
|
187
202
|
"""
|
|
188
203
|
Add Dongzhi Festival (Chinese Winter Solstice).
|
|
@@ -194,6 +209,19 @@ class ChineseCalendarHolidays(EasternCalendarHolidays):
|
|
|
194
209
|
"""
|
|
195
210
|
return self._add_holiday(name, self._dongzhi_festival)
|
|
196
211
|
|
|
212
|
+
def _add_hanshi_festival(self, name) -> Optional[date]:
|
|
213
|
+
"""
|
|
214
|
+
Add Hanshi Festival (105 days after Winter Solstice).
|
|
215
|
+
|
|
216
|
+
The Cold Food or Hanshi Festival is a traditional Chinese holiday. Its name
|
|
217
|
+
derives from the tradition of avoiding the lighting of any kind of fire,
|
|
218
|
+
even for the preparation of food.
|
|
219
|
+
https://en.wikipedia.org/wiki/Cold_Food_Festival
|
|
220
|
+
"""
|
|
221
|
+
return self._add_chinese_calendar_holiday(
|
|
222
|
+
name, self._chinese_calendar.winter_solstice_date(self._year - 1), days_delta=+105
|
|
223
|
+
)
|
|
224
|
+
|
|
197
225
|
def _add_qingming_festival(self, name) -> date:
|
|
198
226
|
"""
|
|
199
227
|
Add Qingming Festival (15th day after the Spring Equinox).
|
holidays/groups/christian.py
CHANGED
|
@@ -455,6 +455,16 @@ class ChristianHolidays:
|
|
|
455
455
|
"""
|
|
456
456
|
return self._add_holiday_mar_19(name)
|
|
457
457
|
|
|
458
|
+
def _add_saint_patricks_day(self, name) -> date:
|
|
459
|
+
"""
|
|
460
|
+
Add Saint Patrick's Day (March 17th).
|
|
461
|
+
|
|
462
|
+
Saint Patrick's Day is a religious and cultural holiday held on 17 March,
|
|
463
|
+
the traditional death date of Saint Patrick, the foremost patron saint of Ireland.
|
|
464
|
+
https://en.wikipedia.org/wiki/Saint_Patrick's_Day
|
|
465
|
+
"""
|
|
466
|
+
return self._add_holiday_mar_17(name)
|
|
467
|
+
|
|
458
468
|
def _add_saints_peter_and_paul_day(self, name) -> date:
|
|
459
469
|
"""
|
|
460
470
|
Add Feast of Saints Peter and Paul (June 29th).
|
holidays/groups/custom.py
CHANGED
|
@@ -31,17 +31,23 @@ class StaticHolidays:
|
|
|
31
31
|
setattr(self, attribute_name, value)
|
|
32
32
|
self.has_special_holidays = True
|
|
33
33
|
|
|
34
|
-
# Substituted
|
|
34
|
+
# "Substituted" labels.
|
|
35
35
|
elif attribute_name.startswith("substituted_") and (
|
|
36
36
|
value := getattr(cls, attribute_name, None)
|
|
37
37
|
):
|
|
38
38
|
setattr(self, attribute_name, value)
|
|
39
|
-
self.has_substituted_holidays = True
|
|
40
39
|
|
|
41
40
|
# Populate substituted holidays from adjacent years.
|
|
42
41
|
self.weekend_workdays = set()
|
|
43
42
|
for special_public_holidays in getattr(self, "special_public_holidays", {}).values():
|
|
44
43
|
for special_public_holiday in _normalize_tuple(special_public_holidays):
|
|
44
|
+
# Normally, special holiday is a 3 item tuple: (month, day, name).
|
|
45
|
+
if len(special_public_holiday) < 4: # Skip non-substituted holidays.
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
# Handle cross-year substituted holidays.
|
|
45
49
|
if len(special_public_holiday) == 5: # The fifth element is the year.
|
|
46
50
|
_, _, from_month, from_day, from_year = special_public_holiday
|
|
47
51
|
self.weekend_workdays.add(date(from_year, from_month, from_day))
|
|
52
|
+
|
|
53
|
+
self.has_substituted_holidays = True
|
holidays/groups/eastern.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
|
|
|
@@ -25,6 +26,7 @@ class EasternCalendarHolidays:
|
|
|
25
26
|
self,
|
|
26
27
|
name: str,
|
|
27
28
|
dt_estimated: tuple[Optional[date], bool],
|
|
29
|
+
*,
|
|
28
30
|
show_estimated: bool = True,
|
|
29
31
|
days_delta: int = 0,
|
|
30
32
|
) -> Optional[date]:
|
|
@@ -47,3 +49,27 @@ class EasternCalendarHolidays:
|
|
|
47
49
|
if dt
|
|
48
50
|
else None
|
|
49
51
|
)
|
|
52
|
+
|
|
53
|
+
def _add_eastern_calendar_holiday_set(
|
|
54
|
+
self,
|
|
55
|
+
name: str,
|
|
56
|
+
dts_estimated: Iterable[tuple[date, bool]],
|
|
57
|
+
*,
|
|
58
|
+
show_estimated: bool = True,
|
|
59
|
+
days_delta: int = 0,
|
|
60
|
+
) -> set[date]:
|
|
61
|
+
"""
|
|
62
|
+
Add Eastern (Buddhist, Chinese, Hindu, Islamic, Mongolian) calendar holidays.
|
|
63
|
+
|
|
64
|
+
Adds customizable estimation label to holiday name if holiday date is an estimation.
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
dt
|
|
69
|
+
for dt_estimated in dts_estimated
|
|
70
|
+
if (
|
|
71
|
+
dt := self._add_eastern_calendar_holiday(
|
|
72
|
+
name, dt_estimated, show_estimated=show_estimated, days_delta=days_delta
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
}
|
holidays/groups/hebrew.py
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
from collections.abc import Iterable
|
|
14
14
|
from datetime import date
|
|
15
|
-
from typing import
|
|
15
|
+
from typing import Union
|
|
16
16
|
|
|
17
|
-
from holidays.calendars import _HebrewLunisolar
|
|
18
17
|
from holidays.calendars.gregorian import _timedelta
|
|
18
|
+
from holidays.calendars.hebrew import _HebrewLunisolar
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class HebrewCalendarHolidays:
|
|
@@ -29,15 +29,16 @@ class HebrewCalendarHolidays:
|
|
|
29
29
|
def _add_hebrew_calendar_holiday(
|
|
30
30
|
self, name: str, holiday_date: date, days_delta: Union[int, Iterable[int]] = 0
|
|
31
31
|
) -> set[date]:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
"""
|
|
33
|
+
Add Hebrew calendar holiday.
|
|
34
|
+
"""
|
|
35
|
+
return {
|
|
36
|
+
dt
|
|
37
|
+
for delta in ((days_delta,) if isinstance(days_delta, int) else days_delta)
|
|
38
|
+
if (dt := self._add_holiday(name, _timedelta(holiday_date, delta)))
|
|
39
|
+
}
|
|
37
40
|
|
|
38
|
-
def _add_hanukkah(
|
|
39
|
-
self, name: str, days_delta: Union[int, Iterable[int]] = 0
|
|
40
|
-
) -> set[Optional[date]]:
|
|
41
|
+
def _add_hanukkah(self, name: str, days_delta: Union[int, Iterable[int]] = 0) -> set[date]:
|
|
41
42
|
"""
|
|
42
43
|
Add Hanukkah.
|
|
43
44
|
In some Gregorian years, there may be two Hanukkah dates.
|
|
@@ -46,10 +47,11 @@ class HebrewCalendarHolidays:
|
|
|
46
47
|
and subsequent rededication of the Second Temple.
|
|
47
48
|
https://en.wikipedia.org/wiki/Hanukkah
|
|
48
49
|
"""
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
self.
|
|
52
|
-
|
|
50
|
+
return {
|
|
51
|
+
dt
|
|
52
|
+
for hanukkah_dt in self._hebrew_calendar.hanukkah_date(self._year)
|
|
53
|
+
for dt in self._add_hebrew_calendar_holiday(name, hanukkah_dt, days_delta)
|
|
54
|
+
}
|
|
53
55
|
|
|
54
56
|
def _add_lag_baomer(self, name: str, days_delta: Union[int, Iterable[int]] = 0) -> set[date]:
|
|
55
57
|
"""
|
holidays/groups/hindu.py
CHANGED
|
@@ -14,7 +14,7 @@ from collections.abc import Iterable
|
|
|
14
14
|
from datetime import date
|
|
15
15
|
from typing import Optional
|
|
16
16
|
|
|
17
|
-
from holidays.calendars import _HinduLunisolar
|
|
17
|
+
from holidays.calendars.hindu import _HinduLunisolar
|
|
18
18
|
from holidays.groups.eastern import EasternCalendarHolidays
|
|
19
19
|
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
23
23
|
Hindu lunisolar calendar holidays.
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
|
-
def __init__(self, cls=None, show_estimated=False) -> None:
|
|
26
|
+
def __init__(self, cls=None, *, show_estimated=False) -> None:
|
|
27
27
|
self._hindu_calendar = cls() if cls else _HinduLunisolar()
|
|
28
28
|
self._hindu_calendar_show_estimated = show_estimated
|
|
29
29
|
|
|
@@ -38,7 +38,10 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
40
|
return self._add_eastern_calendar_holiday(
|
|
41
|
-
name,
|
|
41
|
+
name,
|
|
42
|
+
dt_estimated,
|
|
43
|
+
show_estimated=self._hindu_calendar_show_estimated,
|
|
44
|
+
days_delta=days_delta,
|
|
42
45
|
)
|
|
43
46
|
|
|
44
47
|
def _add_hindu_calendar_holiday_set(
|
|
@@ -50,14 +53,12 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
50
53
|
Adds customizable estimation label to holiday name if holiday date
|
|
51
54
|
is an estimation.
|
|
52
55
|
"""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return added_dates
|
|
56
|
+
return self._add_eastern_calendar_holiday_set(
|
|
57
|
+
name,
|
|
58
|
+
dts_estimated,
|
|
59
|
+
show_estimated=self._hindu_calendar_show_estimated,
|
|
60
|
+
days_delta=days_delta,
|
|
61
|
+
)
|
|
61
62
|
|
|
62
63
|
def _add_bhai_dooj(self, name) -> Optional[date]:
|
|
63
64
|
"""
|
|
@@ -162,11 +163,18 @@ class HinduCalendarHolidays(EasternCalendarHolidays):
|
|
|
162
163
|
|
|
163
164
|
def _add_gudi_padwa(self, name) -> Optional[date]:
|
|
164
165
|
"""
|
|
165
|
-
Add Gudi Padwa.
|
|
166
|
+
Add Gudi Padwa / Ugadi.
|
|
167
|
+
|
|
168
|
+
Gudi Padwa is the traditional New Year festival celebrated in
|
|
169
|
+
Maharashtra. On the same day, the festival is also observed as
|
|
170
|
+
Ugadi in Karnataka, Telangana, and Andhra Pradesh.
|
|
171
|
+
|
|
172
|
+
It falls on the first day of Chaitra (March–April) according to
|
|
173
|
+
the Hindu lunisolar calendar.
|
|
166
174
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
References:
|
|
176
|
+
* https://en.wikipedia.org/wiki/Gudi_Padwa
|
|
177
|
+
* https://en.wikipedia.org/wiki/Ugadi
|
|
170
178
|
"""
|
|
171
179
|
return self._add_hindu_calendar_holiday(
|
|
172
180
|
name, self._hindu_calendar.gudi_padwa_date(self._year)
|
holidays/groups/international.py
CHANGED
|
@@ -212,7 +212,7 @@ class InternationalHolidays:
|
|
|
212
212
|
"""
|
|
213
213
|
return self._add_holiday_mar_8(name)
|
|
214
214
|
|
|
215
|
-
def _add_world_war_two_victory_day(self, name, is_western=True):
|
|
215
|
+
def _add_world_war_two_victory_day(self, name, *, is_western=True):
|
|
216
216
|
"""
|
|
217
217
|
Add Day of Victory in World War II in Europe (May 8).
|
|
218
218
|
https://en.wikipedia.org/wiki/Victory_in_Europe_Day
|