holidays 0.26__py3-none-any.whl → 0.27__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. holidays/__init__.py +1 -1
  2. holidays/calendars/__init__.py +5 -7
  3. holidays/calendars/buddhist.py +1 -3
  4. holidays/calendars/chinese.py +1 -3
  5. holidays/calendars/custom.py +1 -3
  6. holidays/calendars/hindu.py +1 -3
  7. holidays/calendars/islamic.py +1341 -1345
  8. holidays/calendars/thai.py +217 -26
  9. holidays/countries/__init__.py +4 -0
  10. holidays/countries/albania.py +6 -17
  11. holidays/countries/andorra.py +2 -6
  12. holidays/countries/angola.py +53 -39
  13. holidays/countries/argentina.py +13 -24
  14. holidays/countries/aruba.py +109 -48
  15. holidays/countries/australia.py +31 -69
  16. holidays/countries/azerbaijan.py +30 -38
  17. holidays/countries/bahrain.py +5 -5
  18. holidays/countries/bangladesh.py +1 -3
  19. holidays/countries/belarus.py +1 -3
  20. holidays/countries/belize.py +4 -16
  21. holidays/countries/bolivia.py +2 -6
  22. holidays/countries/bosnia_and_herzegovina.py +5 -17
  23. holidays/countries/botswana.py +9 -18
  24. holidays/countries/brazil.py +2 -5
  25. holidays/countries/brunei.py +427 -0
  26. holidays/countries/bulgaria.py +2 -6
  27. holidays/countries/burkina_faso.py +141 -0
  28. holidays/countries/burundi.py +2 -5
  29. holidays/countries/cambodia.py +323 -0
  30. holidays/countries/cameroon.py +71 -77
  31. holidays/countries/canada.py +19 -28
  32. holidays/countries/chad.py +133 -0
  33. holidays/countries/chile.py +4 -11
  34. holidays/countries/china.py +1 -2
  35. holidays/countries/colombia.py +17 -15
  36. holidays/countries/costa_rica.py +2 -6
  37. holidays/countries/curacao.py +100 -46
  38. holidays/countries/cyprus.py +2 -6
  39. holidays/countries/czechia.py +4 -12
  40. holidays/countries/denmark.py +1 -3
  41. holidays/countries/dominican_republic.py +1 -3
  42. holidays/countries/ecuador.py +54 -54
  43. holidays/countries/egypt.py +2 -5
  44. holidays/countries/eswatini.py +34 -44
  45. holidays/countries/ethiopia.py +5 -14
  46. holidays/countries/finland.py +1 -3
  47. holidays/countries/gabon.py +49 -53
  48. holidays/countries/greece.py +1 -2
  49. holidays/countries/honduras.py +16 -13
  50. holidays/countries/hongkong.py +7 -8
  51. holidays/countries/hungary.py +93 -92
  52. holidays/countries/india.py +4 -11
  53. holidays/countries/indonesia.py +120 -114
  54. holidays/countries/ireland.py +5 -15
  55. holidays/countries/isle_of_man.py +9 -4
  56. holidays/countries/israel.py +6 -18
  57. holidays/countries/italy.py +1 -2
  58. holidays/countries/jamaica.py +10 -18
  59. holidays/countries/japan.py +10 -16
  60. holidays/countries/kazakhstan.py +7 -22
  61. holidays/countries/kenya.py +1 -3
  62. holidays/countries/kyrgyzstan.py +2 -5
  63. holidays/countries/latvia.py +2 -6
  64. holidays/countries/lesotho.py +52 -32
  65. holidays/countries/lithuania.py +4 -12
  66. holidays/countries/madagascar.py +3 -9
  67. holidays/countries/malawi.py +34 -26
  68. holidays/countries/malaysia.py +223 -248
  69. holidays/countries/marshall_islands.py +4 -9
  70. holidays/countries/mexico.py +1 -3
  71. holidays/countries/moldova.py +3 -6
  72. holidays/countries/monaco.py +16 -26
  73. holidays/countries/montenegro.py +23 -19
  74. holidays/countries/morocco.py +2 -5
  75. holidays/countries/mozambique.py +35 -31
  76. holidays/countries/namibia.py +54 -35
  77. holidays/countries/new_zealand.py +11 -21
  78. holidays/countries/nicaragua.py +26 -22
  79. holidays/countries/nigeria.py +6 -17
  80. holidays/countries/north_macedonia.py +3 -8
  81. holidays/countries/norway.py +1 -3
  82. holidays/countries/pakistan.py +71 -72
  83. holidays/countries/panama.py +25 -24
  84. holidays/countries/paraguay.py +54 -47
  85. holidays/countries/philippines.py +6 -2
  86. holidays/countries/poland.py +3 -9
  87. holidays/countries/portugal.py +3 -11
  88. holidays/countries/romania.py +3 -5
  89. holidays/countries/saudi_arabia.py +8 -22
  90. holidays/countries/serbia.py +19 -29
  91. holidays/countries/singapore.py +70 -74
  92. holidays/countries/slovakia.py +1 -4
  93. holidays/countries/south_africa.py +60 -62
  94. holidays/countries/south_korea.py +14 -23
  95. holidays/countries/spain.py +2 -5
  96. holidays/countries/sweden.py +1 -3
  97. holidays/countries/taiwan.py +2 -5
  98. holidays/countries/thailand.py +34 -81
  99. holidays/countries/turkey.py +1 -3
  100. holidays/countries/ukraine.py +6 -18
  101. holidays/countries/united_arab_emirates.py +21 -29
  102. holidays/countries/united_kingdom.py +47 -67
  103. holidays/countries/united_states.py +42 -72
  104. holidays/countries/vatican_city.py +1 -3
  105. holidays/countries/venezuela.py +8 -6
  106. holidays/countries/vietnam.py +6 -18
  107. holidays/countries/zambia.py +63 -33
  108. holidays/countries/zimbabwe.py +56 -37
  109. holidays/financial/european_central_bank.py +1 -3
  110. holidays/financial/ny_stock_exchange.py +31 -48
  111. holidays/groups/__init__.py +18 -0
  112. holidays/groups/buddhist.py +71 -0
  113. holidays/groups/chinese.py +235 -0
  114. holidays/groups/christian.py +483 -0
  115. holidays/groups/hindu.py +71 -0
  116. holidays/groups/international.py +157 -0
  117. holidays/groups/islamic.py +288 -0
  118. holidays/groups/thai.py +157 -0
  119. holidays/helpers.py +20 -0
  120. holidays/holiday_base.py +49 -75
  121. holidays/holiday_groups.py +11 -1190
  122. holidays/locale/am/LC_MESSAGES/ET.po +18 -15
  123. holidays/locale/ar/LC_MESSAGES/CA.po +43 -43
  124. holidays/locale/ar/LC_MESSAGES/ET.po +18 -15
  125. holidays/locale/ar/LC_MESSAGES/UA.po +16 -14
  126. holidays/locale/be/LC_MESSAGES/BY.po +9 -8
  127. holidays/locale/bg/LC_MESSAGES/BG.po +14 -12
  128. holidays/locale/da/LC_MESSAGES/DK.po +7 -6
  129. holidays/locale/el/LC_MESSAGES/CY.po +5 -3
  130. holidays/locale/el/LC_MESSAGES/GR.po +13 -13
  131. holidays/locale/en/LC_MESSAGES/CA.po +43 -43
  132. holidays/locale/en_US/LC_MESSAGES/AR.po +26 -25
  133. holidays/locale/en_US/LC_MESSAGES/AW.mo +0 -0
  134. holidays/locale/en_US/LC_MESSAGES/AW.po +87 -0
  135. holidays/locale/en_US/LC_MESSAGES/BG.po +14 -12
  136. holidays/locale/en_US/LC_MESSAGES/BN.mo +0 -0
  137. holidays/locale/en_US/LC_MESSAGES/BN.po +96 -0
  138. holidays/locale/en_US/LC_MESSAGES/BY.po +9 -8
  139. holidays/locale/en_US/LC_MESSAGES/CA.po +43 -43
  140. holidays/locale/en_US/LC_MESSAGES/CL.po +18 -18
  141. holidays/locale/en_US/LC_MESSAGES/CO.po +19 -19
  142. holidays/locale/en_US/LC_MESSAGES/CR.po +6 -5
  143. holidays/locale/en_US/LC_MESSAGES/CW.mo +0 -0
  144. holidays/locale/en_US/LC_MESSAGES/CW.po +82 -0
  145. holidays/locale/en_US/LC_MESSAGES/CY.po +5 -3
  146. holidays/locale/en_US/LC_MESSAGES/DK.po +7 -6
  147. holidays/locale/en_US/LC_MESSAGES/DO.po +12 -12
  148. holidays/locale/en_US/LC_MESSAGES/EC.po +11 -12
  149. holidays/locale/en_US/LC_MESSAGES/ET.po +18 -15
  150. holidays/locale/en_US/LC_MESSAGES/FI.po +13 -13
  151. holidays/locale/en_US/LC_MESSAGES/GR.po +13 -13
  152. holidays/locale/en_US/LC_MESSAGES/HN.mo +0 -0
  153. holidays/locale/en_US/LC_MESSAGES/HN.po +13 -13
  154. holidays/locale/en_US/LC_MESSAGES/HU.mo +0 -0
  155. holidays/locale/en_US/LC_MESSAGES/HU.po +109 -0
  156. holidays/locale/en_US/LC_MESSAGES/JP.po +19 -17
  157. holidays/locale/en_US/LC_MESSAGES/KH.mo +0 -0
  158. holidays/locale/en_US/LC_MESSAGES/KH.po +139 -0
  159. holidays/locale/en_US/LC_MESSAGES/MC.mo +0 -0
  160. holidays/locale/en_US/LC_MESSAGES/MC.po +16 -15
  161. holidays/locale/en_US/LC_MESSAGES/MD.po +5 -5
  162. holidays/locale/en_US/LC_MESSAGES/MX.po +3 -2
  163. holidays/locale/en_US/LC_MESSAGES/NI.mo +0 -0
  164. holidays/locale/en_US/LC_MESSAGES/NI.po +13 -13
  165. holidays/locale/en_US/LC_MESSAGES/NO.po +1 -1
  166. holidays/locale/en_US/LC_MESSAGES/PL.po +23 -21
  167. holidays/locale/en_US/LC_MESSAGES/PT.po +31 -31
  168. holidays/locale/en_US/LC_MESSAGES/PY.po +13 -11
  169. holidays/locale/en_US/LC_MESSAGES/RO.po +4 -3
  170. holidays/locale/en_US/LC_MESSAGES/RS.po +10 -10
  171. holidays/locale/en_US/LC_MESSAGES/SE.po +1 -1
  172. holidays/locale/en_US/LC_MESSAGES/SK.po +14 -14
  173. holidays/locale/en_US/LC_MESSAGES/TH.po +41 -41
  174. holidays/locale/en_US/LC_MESSAGES/UA.po +16 -14
  175. holidays/locale/en_US/LC_MESSAGES/VE.po +6 -6
  176. holidays/locale/es/LC_MESSAGES/AR.po +26 -25
  177. holidays/locale/es/LC_MESSAGES/CL.po +18 -18
  178. holidays/locale/es/LC_MESSAGES/CO.po +19 -19
  179. holidays/locale/es/LC_MESSAGES/CR.po +6 -5
  180. holidays/locale/es/LC_MESSAGES/DO.po +12 -12
  181. holidays/locale/es/LC_MESSAGES/EC.po +11 -12
  182. holidays/locale/es/LC_MESSAGES/HN.po +12 -12
  183. holidays/locale/es/LC_MESSAGES/MX.po +3 -2
  184. holidays/locale/es/LC_MESSAGES/NI.po +10 -10
  185. holidays/locale/es/LC_MESSAGES/PY.po +13 -11
  186. holidays/locale/es/LC_MESSAGES/VE.po +6 -6
  187. holidays/locale/fi/LC_MESSAGES/FI.po +13 -13
  188. holidays/locale/fr/LC_MESSAGES/CA.po +43 -43
  189. holidays/locale/fr/LC_MESSAGES/MC.po +15 -14
  190. holidays/locale/hu/LC_MESSAGES/HU.mo +0 -0
  191. holidays/locale/hu/LC_MESSAGES/HU.po +109 -0
  192. holidays/locale/ja/LC_MESSAGES/JP.po +19 -17
  193. holidays/locale/km/LC_MESSAGES/KH.mo +0 -0
  194. holidays/locale/km/LC_MESSAGES/KH.po +139 -0
  195. holidays/locale/ms/LC_MESSAGES/BN.mo +0 -0
  196. holidays/locale/ms/LC_MESSAGES/BN.po +96 -0
  197. holidays/locale/nl/LC_MESSAGES/AW.mo +0 -0
  198. holidays/locale/nl/LC_MESSAGES/AW.po +87 -0
  199. holidays/locale/nl/LC_MESSAGES/CW.mo +0 -0
  200. holidays/locale/nl/LC_MESSAGES/CW.po +82 -0
  201. holidays/locale/no/LC_MESSAGES/NO.po +1 -1
  202. holidays/locale/pap/LC_MESSAGES/AW.mo +0 -0
  203. holidays/locale/pap/LC_MESSAGES/AW.po +87 -0
  204. holidays/locale/pap/LC_MESSAGES/CW.mo +0 -0
  205. holidays/locale/pap/LC_MESSAGES/CW.po +82 -0
  206. holidays/locale/pl/LC_MESSAGES/PL.po +23 -21
  207. holidays/locale/pt_PT/LC_MESSAGES/PT.po +31 -31
  208. holidays/locale/ro/LC_MESSAGES/MD.po +5 -5
  209. holidays/locale/ro/LC_MESSAGES/RO.po +4 -3
  210. holidays/locale/sk/LC_MESSAGES/SK.po +14 -14
  211. holidays/locale/sr/LC_MESSAGES/RS.po +10 -10
  212. holidays/locale/sv/LC_MESSAGES/FI.po +13 -13
  213. holidays/locale/sv/LC_MESSAGES/SE.po +1 -1
  214. holidays/locale/th/LC_MESSAGES/BN.mo +0 -0
  215. holidays/locale/th/LC_MESSAGES/BN.po +96 -0
  216. holidays/locale/th/LC_MESSAGES/CA.po +43 -43
  217. holidays/locale/th/LC_MESSAGES/KH.mo +0 -0
  218. holidays/locale/th/LC_MESSAGES/KH.po +145 -0
  219. holidays/locale/th/LC_MESSAGES/TH.po +41 -41
  220. holidays/locale/uk/LC_MESSAGES/AR.po +26 -25
  221. holidays/locale/uk/LC_MESSAGES/AW.mo +0 -0
  222. holidays/locale/uk/LC_MESSAGES/AW.po +87 -0
  223. holidays/locale/uk/LC_MESSAGES/CL.po +18 -18
  224. holidays/locale/uk/LC_MESSAGES/CO.po +19 -19
  225. holidays/locale/uk/LC_MESSAGES/CR.po +6 -5
  226. holidays/locale/uk/LC_MESSAGES/CW.mo +0 -0
  227. holidays/locale/uk/LC_MESSAGES/CW.po +82 -0
  228. holidays/locale/uk/LC_MESSAGES/DK.po +7 -6
  229. holidays/locale/uk/LC_MESSAGES/DO.po +12 -12
  230. holidays/locale/uk/LC_MESSAGES/EC.po +11 -12
  231. holidays/locale/uk/LC_MESSAGES/FI.po +13 -13
  232. holidays/locale/uk/LC_MESSAGES/HN.mo +0 -0
  233. holidays/locale/uk/LC_MESSAGES/HN.po +13 -13
  234. holidays/locale/uk/LC_MESSAGES/HU.mo +0 -0
  235. holidays/locale/uk/LC_MESSAGES/HU.po +109 -0
  236. holidays/locale/uk/LC_MESSAGES/MC.po +15 -14
  237. holidays/locale/uk/LC_MESSAGES/MD.po +5 -5
  238. holidays/locale/uk/LC_MESSAGES/MX.po +3 -2
  239. holidays/locale/uk/LC_MESSAGES/NI.mo +0 -0
  240. holidays/locale/uk/LC_MESSAGES/NI.po +13 -13
  241. holidays/locale/uk/LC_MESSAGES/NO.po +1 -1
  242. holidays/locale/uk/LC_MESSAGES/PL.po +23 -21
  243. holidays/locale/uk/LC_MESSAGES/PY.po +13 -11
  244. holidays/locale/uk/LC_MESSAGES/RO.po +4 -3
  245. holidays/locale/uk/LC_MESSAGES/SE.po +1 -1
  246. holidays/locale/uk/LC_MESSAGES/SK.po +14 -14
  247. holidays/locale/uk/LC_MESSAGES/UA.po +16 -14
  248. holidays/locale/uk/LC_MESSAGES/VE.po +6 -6
  249. holidays/registry.py +7 -11
  250. holidays/utils.py +5 -15
  251. {holidays-0.26.dist-info → holidays-0.27.dist-info}/METADATA +25 -7
  252. holidays-0.27.dist-info/RECORD +449 -0
  253. holidays-0.26.dist-info/RECORD +0 -402
  254. {holidays-0.26.dist-info → holidays-0.27.dist-info}/LICENSE +0 -0
  255. {holidays-0.26.dist-info → holidays-0.27.dist-info}/WHEEL +0 -0
  256. {holidays-0.26.dist-info → holidays-0.27.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,483 @@
1
+ # python-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: dr-prodigy <maurizio.montel@gmail.com> (c) 2017-2022
8
+ # ryanss <ryanssdev@icloud.com> (c) 2014-2017
9
+ # Website: https://github.com/dr-prodigy/python-holidays
10
+ # License: MIT (see LICENSE file)
11
+
12
+ from datetime import date
13
+ from datetime import timedelta as td
14
+
15
+ from dateutil.easter import EASTER_ORTHODOX, EASTER_WESTERN, easter
16
+
17
+ from holidays.calendars import GREGORIAN_CALENDAR, JULIAN_CALENDAR
18
+ from holidays.constants import JAN, FEB, MAR, APR, JUN, JUL, AUG, SEP, NOV, DEC
19
+
20
+
21
+ class ChristianHolidays:
22
+ """
23
+ Christian holidays.
24
+ """
25
+
26
+ def __init__(self, calendar=GREGORIAN_CALENDAR) -> None:
27
+ self.__verify_calendar(calendar)
28
+ self.__calendar = calendar
29
+
30
+ def __get_christmas_day(self, calendar=None):
31
+ """
32
+ Get Christmas Day date.
33
+ """
34
+ calendar = calendar or self.__calendar
35
+ self.__verify_calendar(calendar)
36
+
37
+ return (
38
+ date(self._year, DEC, 25)
39
+ if self.__is_gregorian_calendar(calendar)
40
+ else date(self._year, JAN, 7) # Orthodox.
41
+ )
42
+
43
+ def __get_easter_sunday(self, calendar=None):
44
+ """
45
+ Get Easter Sunday date.
46
+ """
47
+ calendar = calendar or self.__calendar
48
+ self.__verify_calendar(calendar)
49
+
50
+ return easter(
51
+ self._year,
52
+ method=EASTER_ORTHODOX if calendar == JULIAN_CALENDAR else EASTER_WESTERN,
53
+ )
54
+
55
+ @staticmethod
56
+ def __is_gregorian_calendar(calendar):
57
+ """
58
+ Return True if `calendar` is Gregorian calendar.
59
+ Return False otherwise.
60
+ """
61
+ return calendar == GREGORIAN_CALENDAR
62
+
63
+ @staticmethod
64
+ def __verify_calendar(calendar):
65
+ """
66
+ Verify calendar type.
67
+ """
68
+ if calendar not in {GREGORIAN_CALENDAR, JULIAN_CALENDAR}:
69
+ raise ValueError(
70
+ f"Unknown calendar name: {calendar}. "
71
+ "Use `GREGORIAN_CALENDAR` or `JULIAN_CALENDAR`."
72
+ )
73
+
74
+ @property
75
+ def _christmas_day(self):
76
+ """
77
+ Return Christmas Day date.
78
+ """
79
+ return self.__get_christmas_day()
80
+
81
+ @property
82
+ def _easter_sunday(self):
83
+ """
84
+ Return Easter Sunday date.
85
+ """
86
+ return self.__get_easter_sunday()
87
+
88
+ def _add_all_saints_day(self, name) -> date:
89
+ """
90
+ Add All Saints' Day (November 1st).
91
+
92
+ Also known as All Hallows' Day, the Feast of All Saints,
93
+ the Feast of All Hallows, the Solemnity of All Saints, and Hallowmas.
94
+ https://en.wikipedia.org/wiki/All_Saints%27_Day
95
+ """
96
+ return self._add_holiday(name, NOV, 1)
97
+
98
+ def _add_all_souls_day(self, name) -> date:
99
+ """
100
+ Add All Souls' Day (November 2nd).
101
+
102
+ All Souls' Day is a day of prayer and remembrance for the faithful
103
+ departed, observed by certain Christian denominations on 2 November.
104
+ https://en.wikipedia.org/wiki/All_Souls%27_Day
105
+ """
106
+ return self._add_holiday(name, NOV, 2)
107
+
108
+ def _add_ascension_thursday(self, name) -> date:
109
+ """
110
+ Add Ascension Thursday (39 days after the Easter Sunday).
111
+
112
+ The Solemnity of the Ascension of Jesus Christ, also called Ascension
113
+ Day, or sometimes Holy Thursday.
114
+ https://en.wikipedia.org/wiki/Feast_of_the_Ascension
115
+ """
116
+ return self._add_holiday(
117
+ name,
118
+ self._easter_sunday + td(days=+39),
119
+ )
120
+
121
+ def _add_ash_monday(self, name) -> date:
122
+ """
123
+ Add Ash Monday (48 days before Easter Sunday).
124
+
125
+ The Clean Monday, also known as Pure Monday, Monday of Lent
126
+ or Green Monday. The first day of Great Lent.
127
+ https://en.wikipedia.org/wiki/Clean_Monday
128
+ """
129
+ return self._add_holiday(
130
+ name,
131
+ self._easter_sunday + td(days=-48),
132
+ )
133
+
134
+ def _add_ash_wednesday(self, name) -> date:
135
+ """
136
+ Add Ash Wednesday (46 days before Easter Sunday).
137
+
138
+ A holy day of prayer and fasting. It marks the beginning of Lent.
139
+ https://en.wikipedia.org/wiki/Ash_Wednesday
140
+ """
141
+ return self._add_holiday(
142
+ name,
143
+ self._easter_sunday + td(days=-46),
144
+ )
145
+
146
+ def _add_assumption_of_mary_day(self, name) -> date:
147
+ """
148
+ Add Assumption Of Mary (August 15th).
149
+
150
+ The Feast of the Assumption of Mary, or simply The Assumption marks the
151
+ occasion of the Virgin Mary's bodily ascent to heaven at the end of
152
+ her life.
153
+ https://en.wikipedia.org/wiki/Assumption_of_Mary
154
+ """
155
+ return self._add_holiday(name, AUG, 15)
156
+
157
+ def _add_candlemas(self, name) -> date:
158
+ """
159
+ Add Candlemas (February 2nd).
160
+
161
+ Also known as the Feast of the Presentation of Jesus Christ,
162
+ the Feast of the Purification of the Blessed Virgin Mary, or the Feast
163
+ of the Holy Encounter, is a Christian holiday commemorating the
164
+ presentation of Jesus at the Temple.
165
+ https://en.wikipedia.org/wiki/Candlemas
166
+ """
167
+ return self._add_holiday(name, FEB, 2)
168
+
169
+ def _add_carnival_monday(self, name) -> date:
170
+ """
171
+ Add Carnival Monday (48 days before Easter Sunday).
172
+
173
+ Carnival is a Catholic Christian festive season that occurs before
174
+ the liturgical season of Lent.
175
+ https://en.wikipedia.org/wiki/Carnival
176
+ """
177
+ return self._add_holiday(
178
+ name,
179
+ self._easter_sunday + td(days=-48),
180
+ )
181
+
182
+ def _add_carnival_tuesday(self, name) -> date:
183
+ """
184
+ Add Carnival Monday (47 days before Easter Sunday).
185
+
186
+ Carnival is a Catholic Christian festive season that occurs before
187
+ the liturgical season of Lent.
188
+ https://en.wikipedia.org/wiki/Carnival
189
+ """
190
+ return self._add_holiday(
191
+ name,
192
+ self._easter_sunday + td(days=-47),
193
+ )
194
+
195
+ def _add_christmas_day(self, name, calendar=None) -> date:
196
+ """
197
+ Add Christmas Day.
198
+
199
+ Christmas is an annual festival commemorating the birth of
200
+ Jesus Christ.
201
+ https://en.wikipedia.org/wiki/Christmas
202
+ """
203
+ calendar = calendar or self.__calendar
204
+ self.__verify_calendar(calendar)
205
+
206
+ return self._add_holiday(
207
+ name,
208
+ self.__get_christmas_day(calendar),
209
+ )
210
+
211
+ def _add_christmas_day_two(self, name, calendar=None) -> date:
212
+ """
213
+ Add Christmas Day 2.
214
+
215
+ A holiday celebrated after Christmas Day, also known as Boxing Day.
216
+ https://en.wikipedia.org/wiki/Boxing_Day
217
+ https://en.wikipedia.org/wiki/Christmas
218
+ """
219
+ calendar = calendar or self.__calendar
220
+ self.__verify_calendar(calendar)
221
+
222
+ return self._add_holiday(
223
+ name,
224
+ self.__get_christmas_day(calendar) + td(days=+1),
225
+ )
226
+
227
+ def _add_christmas_day_three(self, name, calendar=None) -> date:
228
+ """
229
+ Add Christmas Day 3.
230
+
231
+ A holiday celebrated 2 days after Christmas Day (in some countries).
232
+ https://en.wikipedia.org/wiki/Christmas
233
+ """
234
+ calendar = calendar or self.__calendar
235
+ self.__verify_calendar(calendar)
236
+
237
+ return self._add_holiday(
238
+ name,
239
+ self.__get_christmas_day(calendar) + td(days=+2),
240
+ )
241
+
242
+ def _add_christmas_eve(self, name, calendar=None) -> date:
243
+ """
244
+ Add Christmas Eve.
245
+
246
+ Christmas Eve is the evening or entire day before Christmas Day,
247
+ the festival commemorating the birth of Jesus Christ.
248
+ https://en.wikipedia.org/wiki/Christmas_Eve
249
+ """
250
+ calendar = calendar or self.__calendar
251
+ self.__verify_calendar(calendar)
252
+
253
+ return self._add_holiday(
254
+ name,
255
+ self.__get_christmas_day(calendar) + td(days=-1),
256
+ )
257
+
258
+ def _add_corpus_christi_day(self, name) -> date:
259
+ """
260
+ Add Feast Of Corpus Christi (60 days after Easter Sunday).
261
+
262
+ The Feast of Corpus Christi, also known as the Solemnity of the Most
263
+ Holy Body and Blood of Christ, is a Christian liturgical solemnity
264
+ celebrating the Real Presence of the Body and Blood, Soul and Divinity
265
+ of Jesus Christ in the elements of the Eucharist.
266
+ https://en.wikipedia.org/wiki/Feast_of_Corpus_Christi
267
+ """
268
+ return self._add_holiday(
269
+ name,
270
+ self._easter_sunday + td(days=+60),
271
+ )
272
+
273
+ def _add_easter_monday(self, name, calendar=None) -> date:
274
+ """
275
+ Add Easter Monday (1 day after Easter Sunday).
276
+
277
+ Easter Monday refers to the day after Easter Sunday in either the
278
+ Eastern or Western Christian traditions. It is a public holiday in
279
+ some countries.
280
+ https://en.wikipedia.org/wiki/Easter_Monday
281
+ """
282
+ return self._add_holiday(
283
+ name,
284
+ self.__get_easter_sunday(calendar) + td(days=+1),
285
+ )
286
+
287
+ def _add_easter_sunday(self, name, calendar=None) -> date:
288
+ """
289
+ Add Easter Sunday.
290
+
291
+ Easter, also called Pascha or Resurrection Sunday is a Christian
292
+ festival and cultural holiday commemorating the resurrection of Jesus
293
+ from the dead.
294
+ https://en.wikipedia.org/wiki/Easter
295
+ """
296
+ return self._add_holiday(name, self.__get_easter_sunday(calendar))
297
+
298
+ def _add_epiphany_day(self, name, calendar=None) -> date:
299
+ """
300
+ Add Epiphany Day.
301
+
302
+ Epiphany, also known as Theophany in Eastern Christian traditions,
303
+ is a Christian feast day that celebrates the revelation of God
304
+ incarnate as Jesus Christ.
305
+ https://en.wikipedia.org/wiki/Epiphany_(holiday)
306
+ """
307
+ calendar = calendar or self.__calendar
308
+ self.__verify_calendar(calendar)
309
+
310
+ return self._add_holiday(
311
+ name,
312
+ date(self._year, JAN, 6)
313
+ if self.__is_gregorian_calendar(calendar)
314
+ else date(self._year, JAN, 19),
315
+ )
316
+
317
+ def _add_good_friday(self, name, calendar=None) -> date:
318
+ """
319
+ Add Good Friday (2 days before Easter Sunday).
320
+
321
+ Good Friday is a Christian holiday commemorating the crucifixion of
322
+ Jesus and his death at Calvary. It is also known as Holy Friday,
323
+ Great Friday, Great and Holy Friday.
324
+ https://en.wikipedia.org/wiki/Good_Friday
325
+ """
326
+ return self._add_holiday(
327
+ name,
328
+ self.__get_easter_sunday(calendar) + td(days=-2),
329
+ )
330
+
331
+ def _add_holy_saturday(self, name) -> date:
332
+ """
333
+ Add Holy Saturday (1 day before Easter Sunday).
334
+
335
+ Great and Holy Saturday is a day between Good Friday and Easter Sunday.
336
+ https://en.wikipedia.org/wiki/Holy_Saturday
337
+ """
338
+ return self._add_holiday(
339
+ name,
340
+ self._easter_sunday + td(days=-1),
341
+ )
342
+
343
+ def _add_holy_thursday(self, name) -> date:
344
+ """
345
+ Add Holy Thursday (3 days before Easter Sunday).
346
+
347
+ Holy Thursday or Maundy Thursday is the day during Holy Week that
348
+ commemorates the Washing of the Feet (Maundy) and Last Supper of
349
+ Jesus Christ with the Apostles, as described in the canonical gospels.
350
+ https://en.wikipedia.org/wiki/Maundy_Thursday
351
+ """
352
+ return self._add_holiday(
353
+ name,
354
+ self._easter_sunday + td(days=-3),
355
+ )
356
+
357
+ def _add_immaculate_conception_day(self, name) -> date:
358
+ """
359
+ Add Immaculate Conception Day (December 8th).
360
+
361
+ https://en.wikipedia.org/wiki/Immaculate_Conception
362
+ """
363
+ return self._add_holiday(name, DEC, 8)
364
+
365
+ def _add_nativity_of_mary_day(self, name) -> date:
366
+ """
367
+ Add Nativity Of Mary Day (September 8th).
368
+
369
+ The Nativity of the Blessed Virgin Mary, the Nativity of Mary,
370
+ the Marymas or the Birth of the Virgin Mary, refers to a Christian
371
+ feast day celebrating the birth of Mary, mother of Jesus.
372
+ https://en.wikipedia.org/wiki/Nativity_of_Mary
373
+ """
374
+ return self._add_holiday(name, SEP, 8)
375
+
376
+ def _add_palm_sunday(self, name) -> date:
377
+ """
378
+ Add Palm Sunday (7 days before Easter Sunday).
379
+
380
+ Palm Sunday is a Christian moveable feast that falls on the Sunday
381
+ before Easter. The feast commemorates Christ's triumphal entry into
382
+ Jerusalem, an event mentioned in each of the four canonical Gospels.
383
+ Palm Sunday marks the first day of Holy Week.
384
+ https://en.wikipedia.org/wiki/Palm_Sunday
385
+ """
386
+ return self._add_holiday(
387
+ name,
388
+ self._easter_sunday + td(days=-7),
389
+ )
390
+
391
+ def _add_rejoicing_day(self, name) -> date:
392
+ """
393
+ Add Day Of Rejoicing (9 days after Easter Sunday).
394
+
395
+ Add Day Of Rejoicing ("Radonitsa"), in the Russian Orthodox Church is
396
+ a commemoration of the departed observed on the second Tuesday of
397
+ Pascha (Easter).In Ukrainian tradition it is called Provody.
398
+ https://en.wikipedia.org/wiki/Radonitsa
399
+ """
400
+ return self._add_holiday(
401
+ name,
402
+ self._easter_sunday + td(days=+9),
403
+ )
404
+
405
+ def _add_saint_georges_day(self, name) -> date:
406
+ """
407
+ Add Saint George's Day (April 23th).
408
+
409
+ Saint George's Day is celebrated on 23 April, the traditionally
410
+ accepted date of the saint's death.
411
+ https://en.wikipedia.org/wiki/Saint_George%27s_Day
412
+ """
413
+ return self._add_holiday(name, APR, 23)
414
+
415
+ def _add_saint_james_day(self, name) -> date:
416
+ """
417
+ Add Saint James' Day (July 25th).
418
+
419
+ James the Great was one of the Twelve Apostles of Jesus.
420
+ https://en.wikipedia.org/wiki/James_the_Great#Feast
421
+ """
422
+ return self._add_holiday(name, JUL, 25)
423
+
424
+ def _add_saint_johns_day(self, name) -> date:
425
+ """
426
+ Add Saint John's Day (June 24th).
427
+
428
+ The Nativity of John the Baptist is a Christian feast day celebrating
429
+ the birth of John the Baptist.
430
+ https://en.wikipedia.org/wiki/Nativity_of_John_the_Baptist
431
+ """
432
+ return self._add_holiday(name, JUN, 24)
433
+
434
+ def _add_saint_josephs_day(self, name) -> date:
435
+ """
436
+ Add Saint Joseph's Day (March 19th).
437
+
438
+ Saint Joseph's Day, also called the Feast of Saint Joseph or the
439
+ Solemnity of Saint Joseph, is in Western Christianity the principal
440
+ feast day of Saint Joseph, husband of the Virgin Mary and legal father
441
+ of Jesus Christ.
442
+ https://en.wikipedia.org/wiki/Saint_Joseph%27s_Day
443
+ """
444
+ return self._add_holiday(name, MAR, 19)
445
+
446
+ def _add_saints_peter_and_paul_day(self, name) -> date:
447
+ """
448
+ Feast of Saints Peter and Paul (June 29th).
449
+
450
+ A liturgical feast in honor of the martyrdom in Rome of the apostles
451
+ Saint Peter and Saint Paul, which is observed on 29 June.
452
+ https://en.wikipedia.org/wiki/Feast_of_Saints_Peter_and_Paul
453
+ """
454
+ return self._add_holiday(name, JUN, 29)
455
+
456
+ def _add_whit_monday(self, name) -> date:
457
+ """
458
+ Add Whit Monday (50 days after Easter Sunday).
459
+
460
+ Whit Monday or Pentecost Monday, also known as Monday of the
461
+ Holy Spirit, is the holiday celebrated the day after Pentecost.
462
+ https://en.wikipedia.org/wiki/Pentecost
463
+ https://en.wikipedia.org/wiki/Whit_Monday
464
+ """
465
+ return self._add_holiday(
466
+ name,
467
+ self._easter_sunday + td(days=+50),
468
+ )
469
+
470
+ def _add_whit_sunday(self, name) -> date:
471
+ """
472
+ Add Whit Sunday (49 days after Easter Sunday).
473
+
474
+ Whit Sunday, also called Pentecost, is a holiday which commemorates
475
+ the descent of the Holy Spirit upon the Apostles and other followers
476
+ of Jesus Christ while they were in Jerusalem celebrating the
477
+ Feast of Weeks.
478
+ https://en.wikipedia.org/wiki/Pentecost
479
+ """
480
+ return self._add_holiday(
481
+ name,
482
+ self._easter_sunday + td(days=+49),
483
+ )
@@ -0,0 +1,71 @@
1
+ # python-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: dr-prodigy <maurizio.montel@gmail.com> (c) 2017-2022
8
+ # ryanss <ryanssdev@icloud.com> (c) 2014-2017
9
+ # Website: https://github.com/dr-prodigy/python-holidays
10
+ # License: MIT (see LICENSE file)
11
+
12
+ from datetime import date
13
+ from typing import Tuple, Optional
14
+
15
+ from holidays.calendars import _HinduLunisolar
16
+
17
+
18
+ class HinduCalendarHolidays:
19
+ """
20
+ Hindu lunisolar calendar holidays.
21
+ """
22
+
23
+ def __init__(self, calendar=_HinduLunisolar(), show_estimated=False) -> None:
24
+ self._hindu_calendar = calendar
25
+ self._show_estimated = show_estimated
26
+
27
+ def _add_hindu_calendar_holiday(
28
+ self,
29
+ name: str,
30
+ hol_date: Tuple[date, bool],
31
+ ) -> Optional[date]:
32
+ """
33
+ Add Hindu calendar holiday.
34
+
35
+ Adds customizable estimation label to holiday name if holiday date
36
+ is an estimation.
37
+ """
38
+ estimated_label = getattr(self, "estimated_label", "%s* (*estimated)")
39
+
40
+ dt, is_estimated = hol_date
41
+ return self._add_holiday(
42
+ self.tr(estimated_label) % self.tr(name)
43
+ if is_estimated and self._show_estimated
44
+ else name,
45
+ dt,
46
+ )
47
+
48
+ def _add_diwali(self, name) -> Optional[date]:
49
+ """
50
+ Add Diwali Festival.
51
+
52
+ Diwali (Deepavali, Festival of Lights) is one of the most important
53
+ festivals in Indian religions. It is celebrated during the Hindu
54
+ lunisolar months of Ashvin and Kartika (between mid-October and
55
+ mid-November).
56
+ https://en.wikipedia.org/wiki/Diwali
57
+ """
58
+ return self._add_hindu_calendar_holiday(name, self._hindu_calendar.diwali_date(self._year))
59
+
60
+ def _add_thaipusam(self, name) -> Optional[date]:
61
+ """
62
+ Add Thaipusam.
63
+
64
+ Thaipusam is a Tamil Hindu festival celebrated on the full moon
65
+ of the Tamil month of Thai (January/February).
66
+ https://en.wikipedia.org/wiki/Thaipusam
67
+ """
68
+ return self._add_hindu_calendar_holiday(
69
+ name,
70
+ self._hindu_calendar.thaipusam_date(self._year),
71
+ )