holidays 0.83__py3-none-any.whl → 0.85__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 +0 -2
- holidays/calendars/__init__.py +0 -2
- holidays/calendars/balinese_saka.py +2 -3
- holidays/calendars/buddhist.py +3 -4
- holidays/calendars/burmese.py +9 -10
- holidays/calendars/chinese.py +8 -9
- holidays/calendars/hebrew.py +10 -11
- holidays/calendars/hindu.py +27 -28
- holidays/calendars/mandaean.py +2 -3
- holidays/calendars/mongolian.py +4 -5
- holidays/calendars/persian.py +2 -3
- holidays/calendars/sinhala.py +25 -14
- holidays/calendars/thai.py +13 -14
- holidays/calendars/tibetan.py +12 -13
- holidays/constants.py +0 -2
- holidays/countries/__init__.py +0 -2
- holidays/countries/aland_islands.py +4 -4
- holidays/countries/american_samoa.py +4 -4
- holidays/countries/angola.py +1 -2
- holidays/countries/austria.py +1 -1
- holidays/countries/azerbaijan.py +2 -0
- holidays/countries/china.py +10 -1
- holidays/countries/ecuador.py +12 -4
- holidays/countries/french_guiana.py +4 -4
- holidays/countries/french_polynesia.py +4 -4
- holidays/countries/french_southern_territories.py +4 -4
- holidays/countries/guadeloupe.py +4 -4
- holidays/countries/guam.py +4 -4
- holidays/countries/guernsey.py +1 -2
- holidays/countries/italy.py +2 -2
- holidays/countries/jersey.py +1 -2
- holidays/countries/malta.py +1 -1
- holidays/countries/marshall_islands.py +8 -6
- holidays/countries/martinique.py +4 -4
- holidays/countries/mauritania.py +2 -4
- holidays/countries/mayotte.py +4 -4
- holidays/countries/new_caledonia.py +4 -4
- holidays/countries/northern_mariana_islands.py +4 -4
- holidays/countries/portugal.py +6 -3
- holidays/countries/puerto_rico.py +4 -4
- holidays/countries/reunion.py +4 -4
- holidays/countries/saint_barthelemy.py +4 -4
- holidays/countries/saint_martin.py +4 -4
- holidays/countries/saint_pierre_and_miquelon.py +4 -4
- holidays/countries/samoa.py +1 -3
- holidays/countries/sint_maarten.py +1 -1
- holidays/countries/spain.py +418 -214
- holidays/countries/sri_lanka.py +37 -33
- holidays/countries/svalbard_and_jan_mayen.py +4 -4
- holidays/countries/taiwan.py +2 -2
- holidays/countries/thailand.py +4 -1
- holidays/countries/turkey.py +7 -4
- holidays/countries/united_kingdom.py +1 -2
- holidays/countries/united_states.py +5 -2
- holidays/countries/united_states_minor_outlying_islands.py +4 -4
- holidays/countries/united_states_virgin_islands.py +4 -4
- holidays/countries/wallis_and_futuna.py +4 -4
- holidays/financial/__init__.py +1 -3
- holidays/financial/ice_futures_europe.py +6 -2
- holidays/financial/national_stock_exchange_of_india.py +141 -38
- holidays/groups/__init__.py +0 -2
- holidays/groups/balinese_saka.py +2 -3
- holidays/groups/buddhist.py +4 -5
- holidays/groups/burmese.py +11 -12
- holidays/groups/chinese.py +18 -19
- holidays/groups/christian.py +20 -0
- holidays/groups/eastern.py +2 -3
- holidays/groups/hebrew.py +7 -10
- holidays/groups/hindu.py +36 -37
- holidays/groups/mandaean.py +13 -14
- holidays/groups/mongolian.py +7 -8
- holidays/groups/persian.py +14 -15
- holidays/groups/sinhala.py +13 -14
- holidays/groups/thai.py +12 -13
- holidays/groups/tibetan.py +16 -17
- holidays/holiday_base.py +34 -33
- holidays/ical.py +1 -2
- holidays/locale/ca/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/en_IN/LC_MESSAGES/XNSE.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/EC.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/LK.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/TR.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/US.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/XNSE.mo +0 -0
- holidays/locale/es/LC_MESSAGES/EC.mo +0 -0
- holidays/locale/es/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/hi/LC_MESSAGES/XNSE.mo +0 -0
- holidays/locale/si_LK/LC_MESSAGES/LK.mo +0 -0
- holidays/locale/ta_LK/LC_MESSAGES/LK.mo +0 -0
- holidays/locale/th/LC_MESSAGES/CN.mo +0 -0
- holidays/locale/th/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/th/LC_MESSAGES/HK.mo +0 -0
- holidays/locale/th/LC_MESSAGES/KR.mo +0 -0
- holidays/locale/th/LC_MESSAGES/MO.mo +0 -0
- holidays/locale/th/LC_MESSAGES/US.mo +0 -0
- holidays/locale/tr/LC_MESSAGES/TR.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/EC.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/ES.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/TR.mo +0 -0
- holidays/mixins/__init__.py +0 -2
- holidays/mixins/child_entity.py +1 -3
- holidays/observed_holiday_base.py +12 -13
- holidays/registry.py +4 -4
- holidays/utils.py +13 -14
- holidays/version.py +1 -1
- {holidays-0.83.dist-info → holidays-0.85.dist-info}/METADATA +4 -5
- {holidays-0.83.dist-info → holidays-0.85.dist-info}/RECORD +112 -111
- {holidays-0.83.dist-info → holidays-0.85.dist-info}/licenses/CONTRIBUTORS +2 -0
- {holidays-0.83.dist-info → holidays-0.85.dist-info}/WHEEL +0 -0
- {holidays-0.83.dist-info → holidays-0.85.dist-info}/licenses/LICENSE +0 -0
- {holidays-0.83.dist-info → holidays-0.85.dist-info}/top_level.txt +0 -0
holidays/groups/sinhala.py
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
from collections.abc import Iterable
|
|
14
14
|
from datetime import date
|
|
15
|
-
from typing import Optional
|
|
16
15
|
|
|
17
16
|
from holidays.calendars.sinhala import _SinhalaLunar
|
|
18
17
|
from holidays.groups.eastern import EasternCalendarHolidays
|
|
@@ -37,8 +36,8 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
37
36
|
self._sinhala_calendar_show_estimated = show_estimated
|
|
38
37
|
|
|
39
38
|
def _add_sinhala_calendar_holiday(
|
|
40
|
-
self, name: str, dt_estimated: tuple[
|
|
41
|
-
) ->
|
|
39
|
+
self, name: str, dt_estimated: tuple[date | None, bool]
|
|
40
|
+
) -> date | None:
|
|
42
41
|
"""
|
|
43
42
|
Add Sinhala calendar holiday.
|
|
44
43
|
|
|
@@ -65,7 +64,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
65
64
|
days_delta=days_delta,
|
|
66
65
|
)
|
|
67
66
|
|
|
68
|
-
def _add_bak_poya(self, name) ->
|
|
67
|
+
def _add_bak_poya(self, name) -> date | None:
|
|
69
68
|
"""
|
|
70
69
|
Add Bak Poya (first full moon day of the 5th lunar month).
|
|
71
70
|
|
|
@@ -75,7 +74,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
75
74
|
name, self._sinhala_calendar.bak_poya_date(self._year)
|
|
76
75
|
)
|
|
77
76
|
|
|
78
|
-
def _add_binara_poya(self, name) ->
|
|
77
|
+
def _add_binara_poya(self, name) -> date | None:
|
|
79
78
|
"""
|
|
80
79
|
Add Binara Poya (first full moon day of the 10th lunar month).
|
|
81
80
|
|
|
@@ -95,7 +94,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
95
94
|
name, self._sinhala_calendar.duruthu_poya_date(self._year)
|
|
96
95
|
)
|
|
97
96
|
|
|
98
|
-
def _add_esala_poya(self, name) ->
|
|
97
|
+
def _add_esala_poya(self, name) -> date | None:
|
|
99
98
|
"""
|
|
100
99
|
Add Esala Poya (first full moon day of the 8th lunar month).
|
|
101
100
|
|
|
@@ -105,7 +104,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
105
104
|
name, self._sinhala_calendar.esala_poya_date(self._year)
|
|
106
105
|
)
|
|
107
106
|
|
|
108
|
-
def _add_il_poya(self, name) ->
|
|
107
|
+
def _add_il_poya(self, name) -> date | None:
|
|
109
108
|
"""
|
|
110
109
|
Add Il Poya (first full moon day of the 12th lunar month).
|
|
111
110
|
|
|
@@ -116,7 +115,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
116
115
|
name, self._sinhala_calendar.il_poya_date(self._year)
|
|
117
116
|
)
|
|
118
117
|
|
|
119
|
-
def _add_medin_poya(self, name) ->
|
|
118
|
+
def _add_medin_poya(self, name) -> date | None:
|
|
120
119
|
"""
|
|
121
120
|
Add Medin Poya (first full moon day of the 4th lunar month).
|
|
122
121
|
|
|
@@ -126,7 +125,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
126
125
|
name, self._sinhala_calendar.medin_poya_date(self._year)
|
|
127
126
|
)
|
|
128
127
|
|
|
129
|
-
def _add_nawam_poya(self, name) ->
|
|
128
|
+
def _add_nawam_poya(self, name) -> date | None:
|
|
130
129
|
"""
|
|
131
130
|
Add Nawam Poya (first full moon day of the 3rd lunar month).
|
|
132
131
|
|
|
@@ -137,7 +136,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
137
136
|
name, self._sinhala_calendar.nawam_poya_date(self._year)
|
|
138
137
|
)
|
|
139
138
|
|
|
140
|
-
def _add_nikini_poya(self, name) ->
|
|
139
|
+
def _add_nikini_poya(self, name) -> date | None:
|
|
141
140
|
"""
|
|
142
141
|
Add Nikini Poya (first full moon day of the 9th lunar month).
|
|
143
142
|
|
|
@@ -147,7 +146,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
147
146
|
name, self._sinhala_calendar.nikini_poya_date(self._year)
|
|
148
147
|
)
|
|
149
148
|
|
|
150
|
-
def _add_poson_poya(self, name) ->
|
|
149
|
+
def _add_poson_poya(self, name) -> date | None:
|
|
151
150
|
"""
|
|
152
151
|
Add Poson Poya (first full moon day of the 7th lunar month).
|
|
153
152
|
|
|
@@ -157,7 +156,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
157
156
|
name, self._sinhala_calendar.poson_poya_date(self._year)
|
|
158
157
|
)
|
|
159
158
|
|
|
160
|
-
def _add_unduvap_poya(self, name) ->
|
|
159
|
+
def _add_unduvap_poya(self, name) -> date | None:
|
|
161
160
|
"""
|
|
162
161
|
Add Unduvap Poya (first full moon day of the 1st lunar month).
|
|
163
162
|
|
|
@@ -168,7 +167,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
168
167
|
name, self._sinhala_calendar.unduvap_poya_date(self._year)
|
|
169
168
|
)
|
|
170
169
|
|
|
171
|
-
def _add_vap_poya(self, name) ->
|
|
170
|
+
def _add_vap_poya(self, name) -> date | None:
|
|
172
171
|
"""
|
|
173
172
|
Add Vap Poya (first full moon day of the 11th lunar month).
|
|
174
173
|
|
|
@@ -178,7 +177,7 @@ class SinhalaCalendarHolidays(EasternCalendarHolidays):
|
|
|
178
177
|
name, self._sinhala_calendar.vap_poya_date(self._year)
|
|
179
178
|
)
|
|
180
179
|
|
|
181
|
-
def _add_vesak_poya(self, name) ->
|
|
180
|
+
def _add_vesak_poya(self, name) -> date | None:
|
|
182
181
|
"""
|
|
183
182
|
Add Vesak Poya (first full moon day of the 6th lunar month).
|
|
184
183
|
|
holidays/groups/thai.py
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from typing import Optional
|
|
15
14
|
|
|
16
15
|
from holidays.calendars.thai import THAI_CALENDAR, _ThaiLunisolar
|
|
17
16
|
|
|
@@ -28,7 +27,7 @@ class ThaiCalendarHolidays:
|
|
|
28
27
|
self.__calendar = calendar
|
|
29
28
|
self._thai_calendar = _ThaiLunisolar(calendar)
|
|
30
29
|
|
|
31
|
-
def _add_asarnha_bucha(self, name) ->
|
|
30
|
+
def _add_asarnha_bucha(self, name) -> date | None:
|
|
32
31
|
"""
|
|
33
32
|
Add Asarnha Bucha.
|
|
34
33
|
|
|
@@ -42,7 +41,7 @@ class ThaiCalendarHolidays:
|
|
|
42
41
|
name, self._thai_calendar.asarnha_bucha_date(self._year)
|
|
43
42
|
)
|
|
44
43
|
|
|
45
|
-
def _add_boun_haw_khao_padapdin(self, name) ->
|
|
44
|
+
def _add_boun_haw_khao_padapdin(self, name) -> date | None:
|
|
46
45
|
"""
|
|
47
46
|
Add Boun Haw Khao Padapdin.
|
|
48
47
|
|
|
@@ -56,7 +55,7 @@ class ThaiCalendarHolidays:
|
|
|
56
55
|
name, self._thai_calendar.boun_haw_khao_padapdin_date(self._year)
|
|
57
56
|
)
|
|
58
57
|
|
|
59
|
-
def _add_boun_haw_khao_salark(self, name) ->
|
|
58
|
+
def _add_boun_haw_khao_salark(self, name) -> date | None:
|
|
60
59
|
"""
|
|
61
60
|
Add Boun Haw Khao Salark.
|
|
62
61
|
|
|
@@ -70,7 +69,7 @@ class ThaiCalendarHolidays:
|
|
|
70
69
|
name, self._thai_calendar.boun_haw_khao_salark_date(self._year)
|
|
71
70
|
)
|
|
72
71
|
|
|
73
|
-
def _add_boun_suang_heua(self, name) ->
|
|
72
|
+
def _add_boun_suang_heua(self, name) -> date | None:
|
|
74
73
|
"""
|
|
75
74
|
Add Boun Suang Huea.
|
|
76
75
|
|
|
@@ -84,7 +83,7 @@ class ThaiCalendarHolidays:
|
|
|
84
83
|
name, self._thai_calendar.boun_suang_heua_date(self._year)
|
|
85
84
|
)
|
|
86
85
|
|
|
87
|
-
def _add_khao_phansa(self, name) ->
|
|
86
|
+
def _add_khao_phansa(self, name) -> date | None:
|
|
88
87
|
"""
|
|
89
88
|
Add Khao Phansa.
|
|
90
89
|
|
|
@@ -98,7 +97,7 @@ class ThaiCalendarHolidays:
|
|
|
98
97
|
name, self._thai_calendar.khao_phansa_date(self._year)
|
|
99
98
|
)
|
|
100
99
|
|
|
101
|
-
def _add_loy_krathong(self, name) ->
|
|
100
|
+
def _add_loy_krathong(self, name) -> date | None:
|
|
102
101
|
"""
|
|
103
102
|
Add Loy Krathong.
|
|
104
103
|
|
|
@@ -114,7 +113,7 @@ class ThaiCalendarHolidays:
|
|
|
114
113
|
name, self._thai_calendar.loy_krathong_date(self._year)
|
|
115
114
|
)
|
|
116
115
|
|
|
117
|
-
def _add_makha_bucha(self, name, calendar=None) ->
|
|
116
|
+
def _add_makha_bucha(self, name, calendar=None) -> date | None:
|
|
118
117
|
"""
|
|
119
118
|
Add Makha Bucha.
|
|
120
119
|
|
|
@@ -132,7 +131,7 @@ class ThaiCalendarHolidays:
|
|
|
132
131
|
name, self._thai_calendar.makha_bucha_date(self._year, calendar)
|
|
133
132
|
)
|
|
134
133
|
|
|
135
|
-
def _add_ok_phansa(self, name) ->
|
|
134
|
+
def _add_ok_phansa(self, name) -> date | None:
|
|
136
135
|
"""
|
|
137
136
|
Add Ok Phansa.
|
|
138
137
|
|
|
@@ -146,7 +145,7 @@ class ThaiCalendarHolidays:
|
|
|
146
145
|
name, self._thai_calendar.ok_phansa_date(self._year)
|
|
147
146
|
)
|
|
148
147
|
|
|
149
|
-
def _add_pchum_ben(self, name) ->
|
|
148
|
+
def _add_pchum_ben(self, name) -> date | None:
|
|
150
149
|
"""
|
|
151
150
|
Add Pchum Ben.
|
|
152
151
|
|
|
@@ -161,7 +160,7 @@ class ThaiCalendarHolidays:
|
|
|
161
160
|
name, self._thai_calendar.pchum_ben_date(self._year)
|
|
162
161
|
)
|
|
163
162
|
|
|
164
|
-
def _add_preah_neangkoal(self, name) ->
|
|
163
|
+
def _add_preah_neangkoal(self, name) -> date | None:
|
|
165
164
|
"""
|
|
166
165
|
Add Preah Reach Pithi Chrat Preah Neangkoal.
|
|
167
166
|
|
|
@@ -175,7 +174,7 @@ class ThaiCalendarHolidays:
|
|
|
175
174
|
name, self._thai_calendar.preah_neangkoal_date(self._year)
|
|
176
175
|
)
|
|
177
176
|
|
|
178
|
-
def _add_thai_calendar_holiday(self, name, dt) ->
|
|
177
|
+
def _add_thai_calendar_holiday(self, name, dt) -> date | None:
|
|
179
178
|
"""
|
|
180
179
|
Add Thai calendar holiday.
|
|
181
180
|
|
|
@@ -186,7 +185,7 @@ class ThaiCalendarHolidays:
|
|
|
186
185
|
|
|
187
186
|
return self._add_holiday(name, dt)
|
|
188
187
|
|
|
189
|
-
def _add_visakha_bucha(self, name, calendar=None) ->
|
|
188
|
+
def _add_visakha_bucha(self, name, calendar=None) -> date | None:
|
|
190
189
|
"""
|
|
191
190
|
Add Visakha Bucha.
|
|
192
191
|
|
holidays/groups/tibetan.py
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from typing import Optional
|
|
15
14
|
|
|
16
15
|
from holidays.calendars.tibetan import _TibetanLunisolar
|
|
17
16
|
from holidays.groups.eastern import EasternCalendarHolidays
|
|
@@ -27,8 +26,8 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
27
26
|
self._tibetan_calendar_show_estimated = show_estimated
|
|
28
27
|
|
|
29
28
|
def _add_tibetan_calendar_holiday(
|
|
30
|
-
self, name: str, dt_estimated: tuple[
|
|
31
|
-
) ->
|
|
29
|
+
self, name: str, dt_estimated: tuple[date | None, bool], days_delta: int = 0
|
|
30
|
+
) -> date | None:
|
|
32
31
|
"""
|
|
33
32
|
Add Tibetan calendar holiday.
|
|
34
33
|
|
|
@@ -42,7 +41,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
42
41
|
days_delta=days_delta,
|
|
43
42
|
)
|
|
44
43
|
|
|
45
|
-
def _add_blessed_rainy_day(self, name) ->
|
|
44
|
+
def _add_blessed_rainy_day(self, name) -> date | None:
|
|
46
45
|
"""
|
|
47
46
|
Add Blessed Rainy Day (September Equinox of Autumn Calendar).
|
|
48
47
|
"""
|
|
@@ -50,7 +49,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
50
49
|
name, self._tibetan_calendar.blessed_rainy_day_date(self._year)
|
|
51
50
|
)
|
|
52
51
|
|
|
53
|
-
def _add_birth_of_guru_rinpoche(self, name) ->
|
|
52
|
+
def _add_birth_of_guru_rinpoche(self, name) -> date | None:
|
|
54
53
|
"""
|
|
55
54
|
Add Birth of Guru Rinpoche (10th day of the 5th lunar month).
|
|
56
55
|
"""
|
|
@@ -58,7 +57,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
58
57
|
name, self._tibetan_calendar.birth_of_guru_rinpoche_date(self._year)
|
|
59
58
|
)
|
|
60
59
|
|
|
61
|
-
def _add_buddha_first_sermon(self, name) ->
|
|
60
|
+
def _add_buddha_first_sermon(self, name) -> date | None:
|
|
62
61
|
"""
|
|
63
62
|
Add Buddha First Sermon (4th day of the 6th lunar month).
|
|
64
63
|
"""
|
|
@@ -66,7 +65,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
66
65
|
name, self._tibetan_calendar.buddha_first_sermon_date(self._year)
|
|
67
66
|
)
|
|
68
67
|
|
|
69
|
-
def _add_buddha_parinirvana(self, name) ->
|
|
68
|
+
def _add_buddha_parinirvana(self, name) -> date | None:
|
|
70
69
|
"""
|
|
71
70
|
Add Buddha Parinirvana (15th day of the 4th lunar month).
|
|
72
71
|
"""
|
|
@@ -74,7 +73,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
74
73
|
name, self._tibetan_calendar.buddha_parinirvana_date(self._year)
|
|
75
74
|
)
|
|
76
75
|
|
|
77
|
-
def _add_day_of_offering(self, name) ->
|
|
76
|
+
def _add_day_of_offering(self, name) -> date | None:
|
|
78
77
|
"""
|
|
79
78
|
Add Day of Offering (1st day of the 12th lunar month).
|
|
80
79
|
"""
|
|
@@ -82,7 +81,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
82
81
|
name, self._tibetan_calendar.day_of_offering_date(self._year)
|
|
83
82
|
)
|
|
84
83
|
|
|
85
|
-
def _add_death_of_zhabdrung(self, name) ->
|
|
84
|
+
def _add_death_of_zhabdrung(self, name) -> date | None:
|
|
86
85
|
"""
|
|
87
86
|
Add Death of Zhabdrung (10th day of the 3rd lunar month).
|
|
88
87
|
"""
|
|
@@ -90,7 +89,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
90
89
|
name, self._tibetan_calendar.death_of_zhabdrung_date(self._year)
|
|
91
90
|
)
|
|
92
91
|
|
|
93
|
-
def _add_descending_day_of_lord_buddha(self, name) ->
|
|
92
|
+
def _add_descending_day_of_lord_buddha(self, name) -> date | None:
|
|
94
93
|
"""
|
|
95
94
|
Add Descending Day of Lord Buddha (22nd day of the 9th lunar month).
|
|
96
95
|
"""
|
|
@@ -98,7 +97,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
98
97
|
name, self._tibetan_calendar.descending_day_of_lord_buddha_date(self._year)
|
|
99
98
|
)
|
|
100
99
|
|
|
101
|
-
def _add_losar(self, name) ->
|
|
100
|
+
def _add_losar(self, name) -> date | None:
|
|
102
101
|
"""
|
|
103
102
|
Add Losar (1st day of the 1st lunar month).
|
|
104
103
|
"""
|
|
@@ -106,7 +105,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
106
105
|
name, self._tibetan_calendar.losar_date(self._year)
|
|
107
106
|
)
|
|
108
107
|
|
|
109
|
-
def _add_losar_day_two(self, name) ->
|
|
108
|
+
def _add_losar_day_two(self, name) -> date | None:
|
|
110
109
|
"""
|
|
111
110
|
Add Losar Day Two.
|
|
112
111
|
"""
|
|
@@ -114,7 +113,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
114
113
|
name, self._tibetan_calendar.losar_date(self._year), days_delta=+1
|
|
115
114
|
)
|
|
116
115
|
|
|
117
|
-
def _add_thimphu_drubchen_day(self, name) ->
|
|
116
|
+
def _add_thimphu_drubchen_day(self, name) -> date | None:
|
|
118
117
|
"""
|
|
119
118
|
Add Thimphu Drubchen (6th day of the 8th lunar month).
|
|
120
119
|
"""
|
|
@@ -122,7 +121,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
122
121
|
name, self._tibetan_calendar.thimphu_drubchen_date(self._year), days_delta=+1
|
|
123
122
|
)
|
|
124
123
|
|
|
125
|
-
def _add_thimphu_tshechu_day(self, name) ->
|
|
124
|
+
def _add_thimphu_tshechu_day(self, name) -> date | None:
|
|
126
125
|
"""
|
|
127
126
|
Add Thimphu Tshechu (10th day of the 8th lunar month).
|
|
128
127
|
"""
|
|
@@ -130,7 +129,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
130
129
|
name, self._tibetan_calendar.thimphu_tshechu_date(self._year)
|
|
131
130
|
)
|
|
132
131
|
|
|
133
|
-
def _add_thimphu_tshechu_day_two(self, name) ->
|
|
132
|
+
def _add_thimphu_tshechu_day_two(self, name) -> date | None:
|
|
134
133
|
"""
|
|
135
134
|
Add Thimphu Tshechu Day 2.
|
|
136
135
|
"""
|
|
@@ -138,7 +137,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
138
137
|
name, self._tibetan_calendar.thimphu_tshechu_date(self._year), days_delta=+1
|
|
139
138
|
)
|
|
140
139
|
|
|
141
|
-
def _add_thimphu_tshechu_day_three(self, name) ->
|
|
140
|
+
def _add_thimphu_tshechu_day_three(self, name) -> date | None:
|
|
142
141
|
"""
|
|
143
142
|
Add Thimphu Tshechu Day 3.
|
|
144
143
|
"""
|
|
@@ -146,7 +145,7 @@ class TibetanCalendarHolidays(EasternCalendarHolidays):
|
|
|
146
145
|
name, self._tibetan_calendar.thimphu_tshechu_date(self._year), days_delta=+2
|
|
147
146
|
)
|
|
148
147
|
|
|
149
|
-
def _add_tibetan_winter_solstice(self, name) ->
|
|
148
|
+
def _add_tibetan_winter_solstice(self, name) -> date | None:
|
|
150
149
|
"""
|
|
151
150
|
Add Winter Solstice Day.
|
|
152
151
|
"""
|
holidays/holiday_base.py
CHANGED
|
@@ -21,7 +21,7 @@ from datetime import date, datetime, timedelta, timezone
|
|
|
21
21
|
from functools import cached_property
|
|
22
22
|
from gettext import gettext, translation
|
|
23
23
|
from pathlib import Path
|
|
24
|
-
from typing import Any, Literal,
|
|
24
|
+
from typing import Any, Literal, Union, cast
|
|
25
25
|
|
|
26
26
|
from dateutil.parser import parse
|
|
27
27
|
|
|
@@ -43,15 +43,16 @@ from holidays.calendars.gregorian import (
|
|
|
43
43
|
from holidays.constants import HOLIDAY_NAME_DELIMITER, PUBLIC, DEFAULT_START_YEAR, DEFAULT_END_YEAR
|
|
44
44
|
from holidays.helpers import _normalize_arguments, _normalize_tuple
|
|
45
45
|
|
|
46
|
-
CategoryArg =
|
|
47
|
-
DateArg =
|
|
48
|
-
DateLike =
|
|
49
|
-
SpecialHoliday =
|
|
50
|
-
SubstitutedHoliday =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
]
|
|
54
|
-
|
|
46
|
+
CategoryArg = str | Iterable[str]
|
|
47
|
+
DateArg = date | tuple[int, int] | tuple[int, int, int]
|
|
48
|
+
DateLike = date | datetime | str | float | int
|
|
49
|
+
SpecialHoliday = tuple[int, int, str] | tuple[tuple[int, int, str], ...]
|
|
50
|
+
SubstitutedHoliday = (
|
|
51
|
+
tuple[int, int, int, int]
|
|
52
|
+
| tuple[int, int, int, int, int]
|
|
53
|
+
| tuple[tuple[int, int, int, int] | tuple[int, int, int, int, int], ...]
|
|
54
|
+
)
|
|
55
|
+
YearArg = int | Iterable[int]
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
class HolidayBase(dict[date, str]):
|
|
@@ -199,9 +200,9 @@ class HolidayBase(dict[date, str]):
|
|
|
199
200
|
is requested."""
|
|
200
201
|
observed: bool
|
|
201
202
|
"""Whether dates when public holiday are observed are included."""
|
|
202
|
-
subdiv:
|
|
203
|
+
subdiv: str | None = None
|
|
203
204
|
"""The subdiv requested as ISO 3166-2 code or one of the aliases."""
|
|
204
|
-
special_holidays: dict[int,
|
|
205
|
+
special_holidays: dict[int, SpecialHoliday | SubstitutedHoliday] = {}
|
|
205
206
|
"""A list of the country-wide special (as opposite to regular) holidays for
|
|
206
207
|
a specific year."""
|
|
207
208
|
_deprecated_subdivisions: tuple[str, ...] = ()
|
|
@@ -213,7 +214,7 @@ class HolidayBase(dict[date, str]):
|
|
|
213
214
|
"""Working days moved to weekends."""
|
|
214
215
|
default_category: str = PUBLIC
|
|
215
216
|
"""The entity category used by default."""
|
|
216
|
-
default_language:
|
|
217
|
+
default_language: str | None = None
|
|
217
218
|
"""The entity language used by default."""
|
|
218
219
|
categories: set[str] = set()
|
|
219
220
|
"""Requested holiday categories."""
|
|
@@ -225,19 +226,19 @@ class HolidayBase(dict[date, str]):
|
|
|
225
226
|
"""Start year of holidays presence for this entity."""
|
|
226
227
|
end_year: int = DEFAULT_END_YEAR
|
|
227
228
|
"""End year of holidays presence for this entity."""
|
|
228
|
-
parent_entity:
|
|
229
|
+
parent_entity: type["HolidayBase"] | None = None
|
|
229
230
|
"""Optional parent entity to reference as a base."""
|
|
230
231
|
|
|
231
232
|
def __init__(
|
|
232
233
|
self,
|
|
233
|
-
years:
|
|
234
|
+
years: YearArg | None = None,
|
|
234
235
|
expand: bool = True,
|
|
235
236
|
observed: bool = True,
|
|
236
|
-
subdiv:
|
|
237
|
-
prov:
|
|
238
|
-
state:
|
|
239
|
-
language:
|
|
240
|
-
categories:
|
|
237
|
+
subdiv: str | None = None,
|
|
238
|
+
prov: str | None = None, # Deprecated.
|
|
239
|
+
state: str | None = None, # Deprecated.
|
|
240
|
+
language: str | None = None,
|
|
241
|
+
categories: CategoryArg | None = None,
|
|
241
242
|
) -> None:
|
|
242
243
|
"""
|
|
243
244
|
Args:
|
|
@@ -605,7 +606,7 @@ class HolidayBase(dict[date, str]):
|
|
|
605
606
|
The corresponding `datetime.date` representation.
|
|
606
607
|
"""
|
|
607
608
|
|
|
608
|
-
dt:
|
|
609
|
+
dt: date | None = None
|
|
609
610
|
# Try to catch `date` and `str` type keys first.
|
|
610
611
|
# Using type() here to skip date subclasses.
|
|
611
612
|
# Key is `date`.
|
|
@@ -662,7 +663,7 @@ class HolidayBase(dict[date, str]):
|
|
|
662
663
|
def __radd__(self, other: Any) -> "HolidayBase":
|
|
663
664
|
return self.__add__(other)
|
|
664
665
|
|
|
665
|
-
def __reduce__(self) ->
|
|
666
|
+
def __reduce__(self) -> str | tuple[Any, ...]:
|
|
666
667
|
return super().__reduce__()
|
|
667
668
|
|
|
668
669
|
def __repr__(self) -> str:
|
|
@@ -794,7 +795,7 @@ class HolidayBase(dict[date, str]):
|
|
|
794
795
|
"""Returns True if the year is leap. Returns False otherwise."""
|
|
795
796
|
return isleap(self._year)
|
|
796
797
|
|
|
797
|
-
def _add_holiday(self, name: str, *args) ->
|
|
798
|
+
def _add_holiday(self, name: str, *args) -> date | None:
|
|
798
799
|
"""Add a holiday."""
|
|
799
800
|
if not args:
|
|
800
801
|
raise TypeError("Incorrect number of arguments.")
|
|
@@ -936,7 +937,7 @@ class HolidayBase(dict[date, str]):
|
|
|
936
937
|
for category in self._sorted_categories
|
|
937
938
|
)
|
|
938
939
|
|
|
939
|
-
def append(self, *args:
|
|
940
|
+
def append(self, *args: dict[DateLike, str] | list[DateLike] | DateLike) -> None:
|
|
940
941
|
"""Alias for [update()][holidays.holiday_base.HolidayBase.update] to mimic list type.
|
|
941
942
|
|
|
942
943
|
Args:
|
|
@@ -953,7 +954,7 @@ class HolidayBase(dict[date, str]):
|
|
|
953
954
|
"""Return a copy of the object."""
|
|
954
955
|
return copy.copy(self)
|
|
955
956
|
|
|
956
|
-
def get(self, key: DateLike, default:
|
|
957
|
+
def get(self, key: DateLike, default: str | Any = None) -> str | Any:
|
|
957
958
|
"""Retrieve the holiday name(s) for a given date.
|
|
958
959
|
|
|
959
960
|
If the date is a holiday, returns the holiday name as a string.
|
|
@@ -1055,9 +1056,9 @@ class HolidayBase(dict[date, str]):
|
|
|
1055
1056
|
|
|
1056
1057
|
def get_closest_holiday(
|
|
1057
1058
|
self,
|
|
1058
|
-
target_date:
|
|
1059
|
+
target_date: DateLike | None = None,
|
|
1059
1060
|
direction: Literal["forward", "backward"] = "forward",
|
|
1060
|
-
) ->
|
|
1061
|
+
) -> tuple[date, str] | None:
|
|
1061
1062
|
"""Find the closest holiday relative to a given date.
|
|
1062
1063
|
|
|
1063
1064
|
If `direction` is "forward", returns the next holiday after `target_date`.
|
|
@@ -1170,7 +1171,7 @@ class HolidayBase(dict[date, str]):
|
|
|
1170
1171
|
dt = self.__keytransform__(key)
|
|
1171
1172
|
return dt in self.weekend_workdays if self._is_weekend(dt) else dt not in self
|
|
1172
1173
|
|
|
1173
|
-
def pop(self, key: DateLike, default:
|
|
1174
|
+
def pop(self, key: DateLike, default: str | Any = None) -> str | Any:
|
|
1174
1175
|
"""Remove a holiday for a given date and return its name.
|
|
1175
1176
|
|
|
1176
1177
|
If the specified date is a holiday, it will be removed, and its name will
|
|
@@ -1276,7 +1277,7 @@ class HolidayBase(dict[date, str]):
|
|
|
1276
1277
|
return popped
|
|
1277
1278
|
|
|
1278
1279
|
def update( # type: ignore[override]
|
|
1279
|
-
self, *args:
|
|
1280
|
+
self, *args: dict[DateLike, str] | list[DateLike] | DateLike
|
|
1280
1281
|
) -> None:
|
|
1281
1282
|
"""Update the object, overwriting existing dates.
|
|
1282
1283
|
|
|
@@ -1319,11 +1320,11 @@ class HolidaySum(HolidayBase):
|
|
|
1319
1320
|
* Holidays are generated (expanded) for all years included in the operands.
|
|
1320
1321
|
"""
|
|
1321
1322
|
|
|
1322
|
-
country:
|
|
1323
|
+
country: str | list[str] # type: ignore[assignment]
|
|
1323
1324
|
"""Countries included in the addition."""
|
|
1324
|
-
market:
|
|
1325
|
+
market: str | list[str] # type: ignore[assignment]
|
|
1325
1326
|
"""Markets included in the addition."""
|
|
1326
|
-
subdiv:
|
|
1327
|
+
subdiv: str | list[str] | None # type: ignore[assignment]
|
|
1327
1328
|
"""Subdivisions included in the addition."""
|
|
1328
1329
|
holidays: list[HolidayBase]
|
|
1329
1330
|
"""The original HolidayBase objects included in the addition."""
|
|
@@ -1382,7 +1383,7 @@ class HolidaySum(HolidayBase):
|
|
|
1382
1383
|
# and Milano, or ... you get the picture.
|
|
1383
1384
|
# Same goes when countries and markets are being mixed (working, yet
|
|
1384
1385
|
# still nonsensical).
|
|
1385
|
-
value:
|
|
1386
|
+
value: str | list[str] | None
|
|
1386
1387
|
for attr in ("country", "market", "subdiv"):
|
|
1387
1388
|
a1 = getattr(h1, attr, None)
|
|
1388
1389
|
a2 = getattr(h2, attr, None)
|
holidays/ical.py
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
import re
|
|
14
14
|
import uuid
|
|
15
15
|
from datetime import date, datetime, timezone
|
|
16
|
-
from typing import Union
|
|
17
16
|
|
|
18
17
|
from holidays.calendars.gregorian import _timedelta
|
|
19
18
|
from holidays.holiday_base import HolidayBase
|
|
@@ -166,7 +165,7 @@ class ICalExporter:
|
|
|
166
165
|
"END:VEVENT",
|
|
167
166
|
]
|
|
168
167
|
|
|
169
|
-
def generate(self, return_bytes: bool = False) ->
|
|
168
|
+
def generate(self, return_bytes: bool = False) -> str | bytes:
|
|
170
169
|
"""Generate iCalendar data.
|
|
171
170
|
|
|
172
171
|
Args:
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
holidays/mixins/__init__.py
CHANGED
holidays/mixins/child_entity.py
CHANGED
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
from typing import Optional
|
|
15
|
-
|
|
16
14
|
from holidays.holiday_base import HolidayBase
|
|
17
15
|
|
|
18
16
|
|
|
@@ -22,7 +20,7 @@ class ChildEntity:
|
|
|
22
20
|
parent_entity: type[HolidayBase]
|
|
23
21
|
"""The parent entity class."""
|
|
24
22
|
|
|
25
|
-
parent_entity_subdivision_code:
|
|
23
|
+
parent_entity_subdivision_code: str | None = None
|
|
26
24
|
"""The parent entity's corresponding ISO 3166-2 subdivision code."""
|
|
27
25
|
|
|
28
26
|
subdivisions: tuple[str, ...] = ()
|