holidays 0.25__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 (331) hide show
  1. holidays/__init__.py +1 -1
  2. holidays/calendars/__init__.py +9 -7
  3. holidays/calendars/buddhist.py +445 -0
  4. holidays/calendars/chinese.py +1238 -431
  5. holidays/calendars/custom.py +1 -3
  6. holidays/calendars/hebrew.py +2 -2
  7. holidays/calendars/hindu.py +445 -0
  8. holidays/calendars/islamic.py +1347 -1347
  9. holidays/calendars/thai.py +229 -38
  10. holidays/countries/__init__.py +8 -0
  11. holidays/countries/albania.py +6 -17
  12. holidays/countries/andorra.py +2 -6
  13. holidays/countries/angola.py +53 -39
  14. holidays/countries/argentina.py +25 -35
  15. holidays/countries/armenia.py +1 -0
  16. holidays/countries/aruba.py +109 -48
  17. holidays/countries/australia.py +31 -69
  18. holidays/countries/austria.py +1 -0
  19. holidays/countries/azerbaijan.py +44 -71
  20. holidays/countries/bahrain.py +7 -7
  21. holidays/countries/bangladesh.py +1 -3
  22. holidays/countries/belarus.py +2 -3
  23. holidays/countries/belize.py +128 -0
  24. holidays/countries/bolivia.py +2 -6
  25. holidays/countries/bosnia_and_herzegovina.py +5 -17
  26. holidays/countries/botswana.py +37 -44
  27. holidays/countries/brazil.py +4 -7
  28. holidays/countries/brunei.py +427 -0
  29. holidays/countries/bulgaria.py +3 -6
  30. holidays/countries/burkina_faso.py +141 -0
  31. holidays/countries/burundi.py +2 -5
  32. holidays/countries/cambodia.py +323 -0
  33. holidays/countries/cameroon.py +183 -0
  34. holidays/countries/canada.py +20 -28
  35. holidays/countries/chad.py +133 -0
  36. holidays/countries/chile.py +6 -13
  37. holidays/countries/china.py +21 -25
  38. holidays/countries/colombia.py +18 -15
  39. holidays/countries/costa_rica.py +25 -27
  40. holidays/countries/cuba.py +28 -15
  41. holidays/countries/curacao.py +100 -46
  42. holidays/countries/cyprus.py +3 -6
  43. holidays/countries/czechia.py +4 -12
  44. holidays/countries/denmark.py +2 -3
  45. holidays/countries/dominican_republic.py +2 -3
  46. holidays/countries/ecuador.py +55 -54
  47. holidays/countries/egypt.py +2 -5
  48. holidays/countries/el_salvador.py +101 -0
  49. holidays/countries/eswatini.py +34 -44
  50. holidays/countries/ethiopia.py +7 -14
  51. holidays/countries/finland.py +2 -3
  52. holidays/countries/france.py +1 -0
  53. holidays/countries/gabon.py +139 -0
  54. holidays/countries/georgia.py +1 -0
  55. holidays/countries/germany.py +1 -0
  56. holidays/countries/greece.py +7 -6
  57. holidays/countries/honduras.py +17 -13
  58. holidays/countries/hongkong.py +117 -126
  59. holidays/countries/hungary.py +93 -92
  60. holidays/countries/iceland.py +1 -0
  61. holidays/countries/india.py +4 -11
  62. holidays/countries/indonesia.py +178 -142
  63. holidays/countries/ireland.py +5 -15
  64. holidays/countries/isle_of_man.py +23 -5
  65. holidays/countries/israel.py +12 -24
  66. holidays/countries/italy.py +6 -7
  67. holidays/countries/jamaica.py +10 -18
  68. holidays/countries/japan.py +11 -16
  69. holidays/countries/kazakhstan.py +7 -22
  70. holidays/countries/kenya.py +44 -26
  71. holidays/countries/kyrgyzstan.py +2 -5
  72. holidays/countries/latvia.py +2 -6
  73. holidays/countries/lesotho.py +52 -32
  74. holidays/countries/liechtenstein.py +1 -0
  75. holidays/countries/lithuania.py +4 -12
  76. holidays/countries/madagascar.py +3 -9
  77. holidays/countries/malawi.py +34 -26
  78. holidays/countries/malaysia.py +335 -343
  79. holidays/countries/marshall_islands.py +4 -9
  80. holidays/countries/mexico.py +2 -3
  81. holidays/countries/moldova.py +4 -6
  82. holidays/countries/monaco.py +17 -26
  83. holidays/countries/montenegro.py +34 -24
  84. holidays/countries/morocco.py +8 -5
  85. holidays/countries/mozambique.py +35 -31
  86. holidays/countries/namibia.py +54 -35
  87. holidays/countries/netherlands.py +1 -0
  88. holidays/countries/new_zealand.py +166 -134
  89. holidays/countries/nicaragua.py +27 -22
  90. holidays/countries/nigeria.py +6 -17
  91. holidays/countries/north_macedonia.py +3 -8
  92. holidays/countries/norway.py +2 -3
  93. holidays/countries/pakistan.py +73 -75
  94. holidays/countries/panama.py +25 -24
  95. holidays/countries/paraguay.py +55 -47
  96. holidays/countries/peru.py +1 -0
  97. holidays/countries/philippines.py +6 -2
  98. holidays/countries/poland.py +4 -9
  99. holidays/countries/portugal.py +4 -11
  100. holidays/countries/romania.py +4 -5
  101. holidays/countries/russia.py +1 -0
  102. holidays/countries/san_marino.py +26 -27
  103. holidays/countries/saudi_arabia.py +8 -22
  104. holidays/countries/serbia.py +22 -31
  105. holidays/countries/singapore.py +181 -189
  106. holidays/countries/slovakia.py +2 -4
  107. holidays/countries/south_africa.py +60 -62
  108. holidays/countries/south_korea.py +59 -26
  109. holidays/countries/spain.py +7 -10
  110. holidays/countries/sweden.py +2 -3
  111. holidays/countries/switzerland.py +1 -0
  112. holidays/countries/taiwan.py +20 -20
  113. holidays/countries/thailand.py +36 -82
  114. holidays/countries/turkey.py +1 -3
  115. holidays/countries/ukraine.py +7 -18
  116. holidays/countries/united_arab_emirates.py +23 -31
  117. holidays/countries/united_kingdom.py +124 -116
  118. holidays/countries/united_states.py +42 -72
  119. holidays/countries/uruguay.py +1 -0
  120. holidays/countries/vatican_city.py +64 -32
  121. holidays/countries/venezuela.py +9 -6
  122. holidays/countries/vietnam.py +6 -20
  123. holidays/countries/zambia.py +63 -33
  124. holidays/countries/zimbabwe.py +56 -37
  125. holidays/financial/european_central_bank.py +15 -16
  126. holidays/financial/ny_stock_exchange.py +80 -86
  127. holidays/groups/__init__.py +18 -0
  128. holidays/groups/buddhist.py +71 -0
  129. holidays/groups/chinese.py +235 -0
  130. holidays/groups/christian.py +483 -0
  131. holidays/groups/hindu.py +71 -0
  132. holidays/groups/international.py +157 -0
  133. holidays/groups/islamic.py +288 -0
  134. holidays/groups/thai.py +157 -0
  135. holidays/helpers.py +20 -0
  136. holidays/holiday_base.py +54 -76
  137. holidays/holiday_groups.py +11 -1053
  138. holidays/locale/am/LC_MESSAGES/ET.mo +0 -0
  139. holidays/locale/am/LC_MESSAGES/ET.po +20 -15
  140. holidays/locale/ar/LC_MESSAGES/CA.mo +0 -0
  141. holidays/locale/ar/LC_MESSAGES/CA.po +184 -0
  142. holidays/locale/ar/LC_MESSAGES/ET.mo +0 -0
  143. holidays/locale/ar/LC_MESSAGES/ET.po +92 -0
  144. holidays/locale/ar/LC_MESSAGES/UA.mo +0 -0
  145. holidays/locale/ar/LC_MESSAGES/UA.po +97 -0
  146. holidays/locale/be/LC_MESSAGES/BY.po +11 -13
  147. holidays/locale/bg/LC_MESSAGES/BG.po +13 -15
  148. holidays/locale/da/LC_MESSAGES/DK.po +13 -12
  149. holidays/locale/de/LC_MESSAGES/AT.po +14 -14
  150. holidays/locale/de/LC_MESSAGES/CH.po +91 -56
  151. holidays/locale/de/LC_MESSAGES/DE.po +32 -32
  152. holidays/locale/de/LC_MESSAGES/LI.po +23 -23
  153. holidays/locale/el/LC_MESSAGES/CY.po +16 -16
  154. holidays/locale/el/LC_MESSAGES/GR.mo +0 -0
  155. holidays/locale/el/LC_MESSAGES/GR.po +21 -17
  156. holidays/locale/en/LC_MESSAGES/CA.po +43 -43
  157. holidays/locale/en_US/LC_MESSAGES/AM.mo +0 -0
  158. holidays/locale/en_US/LC_MESSAGES/AM.po +20 -20
  159. holidays/locale/en_US/LC_MESSAGES/AR.mo +0 -0
  160. holidays/locale/en_US/LC_MESSAGES/AR.po +34 -33
  161. holidays/locale/en_US/LC_MESSAGES/AT.po +13 -13
  162. holidays/locale/en_US/LC_MESSAGES/AW.mo +0 -0
  163. holidays/locale/en_US/LC_MESSAGES/AW.po +87 -0
  164. holidays/locale/en_US/LC_MESSAGES/BG.po +13 -15
  165. holidays/locale/en_US/LC_MESSAGES/BN.mo +0 -0
  166. holidays/locale/en_US/LC_MESSAGES/BN.po +96 -0
  167. holidays/locale/en_US/LC_MESSAGES/BY.po +11 -13
  168. holidays/locale/en_US/LC_MESSAGES/CA.mo +0 -0
  169. holidays/locale/en_US/LC_MESSAGES/CA.po +70 -37
  170. holidays/locale/en_US/LC_MESSAGES/CH.po +91 -56
  171. holidays/locale/en_US/LC_MESSAGES/CL.po +39 -38
  172. holidays/locale/en_US/LC_MESSAGES/CO.mo +0 -0
  173. holidays/locale/en_US/LC_MESSAGES/CO.po +27 -27
  174. holidays/locale/en_US/LC_MESSAGES/CR.mo +0 -0
  175. holidays/locale/en_US/LC_MESSAGES/CR.po +19 -19
  176. holidays/locale/en_US/LC_MESSAGES/CU.po +10 -10
  177. holidays/locale/en_US/LC_MESSAGES/CW.mo +0 -0
  178. holidays/locale/en_US/LC_MESSAGES/CW.po +82 -0
  179. holidays/locale/en_US/LC_MESSAGES/CY.po +16 -16
  180. holidays/locale/en_US/LC_MESSAGES/DE.po +30 -30
  181. holidays/locale/en_US/LC_MESSAGES/DK.po +12 -11
  182. holidays/locale/en_US/LC_MESSAGES/DO.po +12 -12
  183. holidays/locale/en_US/LC_MESSAGES/EC.po +11 -12
  184. holidays/locale/en_US/LC_MESSAGES/ET.mo +0 -0
  185. holidays/locale/en_US/LC_MESSAGES/ET.po +20 -15
  186. holidays/locale/en_US/LC_MESSAGES/FI.po +15 -15
  187. holidays/locale/en_US/LC_MESSAGES/FR.po +27 -24
  188. holidays/locale/en_US/LC_MESSAGES/GE.po +23 -27
  189. holidays/locale/en_US/LC_MESSAGES/GR.mo +0 -0
  190. holidays/locale/en_US/LC_MESSAGES/GR.po +21 -17
  191. holidays/locale/en_US/LC_MESSAGES/HN.mo +0 -0
  192. holidays/locale/en_US/LC_MESSAGES/HN.po +17 -12
  193. holidays/locale/en_US/LC_MESSAGES/HU.mo +0 -0
  194. holidays/locale/en_US/LC_MESSAGES/HU.po +109 -0
  195. holidays/locale/en_US/LC_MESSAGES/IS.po +17 -17
  196. holidays/locale/en_US/LC_MESSAGES/JP.po +25 -25
  197. holidays/locale/en_US/LC_MESSAGES/KH.mo +0 -0
  198. holidays/locale/en_US/LC_MESSAGES/KH.po +139 -0
  199. holidays/locale/en_US/LC_MESSAGES/LI.po +22 -22
  200. holidays/locale/en_US/LC_MESSAGES/MC.mo +0 -0
  201. holidays/locale/en_US/LC_MESSAGES/MC.po +27 -27
  202. holidays/locale/en_US/LC_MESSAGES/MD.po +13 -13
  203. holidays/locale/en_US/LC_MESSAGES/MX.po +9 -12
  204. holidays/locale/en_US/LC_MESSAGES/NI.mo +0 -0
  205. holidays/locale/en_US/LC_MESSAGES/NI.po +15 -15
  206. holidays/locale/en_US/LC_MESSAGES/NL.po +12 -12
  207. holidays/locale/en_US/LC_MESSAGES/NO.po +13 -13
  208. holidays/locale/en_US/LC_MESSAGES/PE.po +30 -30
  209. holidays/locale/en_US/LC_MESSAGES/PL.po +38 -21
  210. holidays/locale/en_US/LC_MESSAGES/PT.po +39 -36
  211. holidays/locale/en_US/LC_MESSAGES/PY.po +16 -16
  212. holidays/locale/en_US/LC_MESSAGES/RO.po +12 -12
  213. holidays/locale/en_US/LC_MESSAGES/RS.mo +0 -0
  214. holidays/locale/en_US/LC_MESSAGES/RS.po +17 -19
  215. holidays/locale/en_US/LC_MESSAGES/RU.po +11 -10
  216. holidays/locale/en_US/LC_MESSAGES/SE.po +19 -19
  217. holidays/locale/en_US/LC_MESSAGES/SK.po +17 -18
  218. holidays/locale/en_US/LC_MESSAGES/TH.po +41 -41
  219. holidays/locale/en_US/LC_MESSAGES/UA.po +18 -19
  220. holidays/locale/en_US/LC_MESSAGES/UY.po +15 -15
  221. holidays/locale/en_US/LC_MESSAGES/VE.po +16 -16
  222. holidays/locale/es/LC_MESSAGES/AR.mo +0 -0
  223. holidays/locale/es/LC_MESSAGES/AR.po +34 -33
  224. holidays/locale/es/LC_MESSAGES/CL.po +39 -38
  225. holidays/locale/es/LC_MESSAGES/CO.mo +0 -0
  226. holidays/locale/es/LC_MESSAGES/CO.po +24 -24
  227. holidays/locale/es/LC_MESSAGES/CR.mo +0 -0
  228. holidays/locale/es/LC_MESSAGES/CR.po +19 -19
  229. holidays/locale/es/LC_MESSAGES/CU.po +10 -10
  230. holidays/locale/es/LC_MESSAGES/DO.po +12 -12
  231. holidays/locale/es/LC_MESSAGES/EC.po +11 -12
  232. holidays/locale/es/LC_MESSAGES/HN.mo +0 -0
  233. holidays/locale/es/LC_MESSAGES/HN.po +17 -12
  234. holidays/locale/es/LC_MESSAGES/MX.po +9 -12
  235. holidays/locale/es/LC_MESSAGES/NI.po +12 -12
  236. holidays/locale/es/LC_MESSAGES/PE.po +30 -30
  237. holidays/locale/es/LC_MESSAGES/PY.po +16 -16
  238. holidays/locale/es/LC_MESSAGES/UY.po +15 -15
  239. holidays/locale/es/LC_MESSAGES/VE.po +16 -16
  240. holidays/locale/fi/LC_MESSAGES/FI.po +16 -16
  241. holidays/locale/fr/LC_MESSAGES/CA.po +43 -43
  242. holidays/locale/fr/LC_MESSAGES/CH.po +91 -56
  243. holidays/locale/fr/LC_MESSAGES/FR.po +27 -24
  244. holidays/locale/fr/LC_MESSAGES/MC.po +23 -23
  245. holidays/locale/hu/LC_MESSAGES/HU.mo +0 -0
  246. holidays/locale/hu/LC_MESSAGES/HU.po +109 -0
  247. holidays/locale/hy/LC_MESSAGES/AM.po +16 -16
  248. holidays/locale/is/LC_MESSAGES/IS.po +18 -18
  249. holidays/locale/it/LC_MESSAGES/CH.po +91 -56
  250. holidays/locale/ja/LC_MESSAGES/JP.po +25 -25
  251. holidays/locale/ka/LC_MESSAGES/GE.po +23 -27
  252. holidays/locale/km/LC_MESSAGES/KH.mo +0 -0
  253. holidays/locale/km/LC_MESSAGES/KH.po +139 -0
  254. holidays/locale/ms/LC_MESSAGES/BN.mo +0 -0
  255. holidays/locale/ms/LC_MESSAGES/BN.po +96 -0
  256. holidays/locale/nl/LC_MESSAGES/AW.mo +0 -0
  257. holidays/locale/nl/LC_MESSAGES/AW.po +87 -0
  258. holidays/locale/nl/LC_MESSAGES/CW.mo +0 -0
  259. holidays/locale/nl/LC_MESSAGES/CW.po +82 -0
  260. holidays/locale/nl/LC_MESSAGES/NL.po +13 -13
  261. holidays/locale/no/LC_MESSAGES/NO.po +14 -14
  262. holidays/locale/pap/LC_MESSAGES/AW.mo +0 -0
  263. holidays/locale/pap/LC_MESSAGES/AW.po +87 -0
  264. holidays/locale/pap/LC_MESSAGES/CW.mo +0 -0
  265. holidays/locale/pap/LC_MESSAGES/CW.po +82 -0
  266. holidays/locale/pl/LC_MESSAGES/PL.po +38 -21
  267. holidays/locale/pt_PT/LC_MESSAGES/PT.po +39 -36
  268. holidays/locale/ro/LC_MESSAGES/MD.po +14 -15
  269. holidays/locale/ro/LC_MESSAGES/RO.po +13 -14
  270. holidays/locale/ru/LC_MESSAGES/RU.po +11 -9
  271. holidays/locale/sk/LC_MESSAGES/SK.po +17 -18
  272. holidays/locale/sr/LC_MESSAGES/RS.mo +0 -0
  273. holidays/locale/sr/LC_MESSAGES/RS.po +15 -17
  274. holidays/locale/sv/LC_MESSAGES/FI.po +16 -16
  275. holidays/locale/sv/LC_MESSAGES/SE.po +20 -20
  276. holidays/locale/th/LC_MESSAGES/BN.mo +0 -0
  277. holidays/locale/th/LC_MESSAGES/BN.po +96 -0
  278. holidays/locale/th/LC_MESSAGES/CA.po +42 -42
  279. holidays/locale/th/LC_MESSAGES/KH.mo +0 -0
  280. holidays/locale/th/LC_MESSAGES/KH.po +145 -0
  281. holidays/locale/th/LC_MESSAGES/TH.po +41 -41
  282. holidays/locale/uk/LC_MESSAGES/AR.mo +0 -0
  283. holidays/locale/uk/LC_MESSAGES/AR.po +35 -35
  284. holidays/locale/uk/LC_MESSAGES/AT.po +15 -16
  285. holidays/locale/uk/LC_MESSAGES/AW.mo +0 -0
  286. holidays/locale/uk/LC_MESSAGES/AW.po +87 -0
  287. holidays/locale/uk/LC_MESSAGES/CH.po +92 -58
  288. holidays/locale/uk/LC_MESSAGES/CL.po +40 -40
  289. holidays/locale/uk/LC_MESSAGES/CO.mo +0 -0
  290. holidays/locale/uk/LC_MESSAGES/CO.po +28 -29
  291. holidays/locale/uk/LC_MESSAGES/CR.mo +0 -0
  292. holidays/locale/uk/LC_MESSAGES/CR.po +20 -21
  293. holidays/locale/uk/LC_MESSAGES/CU.po +11 -12
  294. holidays/locale/uk/LC_MESSAGES/CW.mo +0 -0
  295. holidays/locale/uk/LC_MESSAGES/CW.po +82 -0
  296. holidays/locale/uk/LC_MESSAGES/DE.po +33 -34
  297. holidays/locale/uk/LC_MESSAGES/DK.po +14 -14
  298. holidays/locale/uk/LC_MESSAGES/DO.po +13 -14
  299. holidays/locale/uk/LC_MESSAGES/EC.po +12 -14
  300. holidays/locale/uk/LC_MESSAGES/FI.po +17 -18
  301. holidays/locale/uk/LC_MESSAGES/FR.po +28 -26
  302. holidays/locale/uk/LC_MESSAGES/HN.mo +0 -0
  303. holidays/locale/uk/LC_MESSAGES/HN.po +18 -14
  304. holidays/locale/uk/LC_MESSAGES/HU.mo +0 -0
  305. holidays/locale/uk/LC_MESSAGES/HU.po +109 -0
  306. holidays/locale/uk/LC_MESSAGES/IS.po +19 -20
  307. holidays/locale/uk/LC_MESSAGES/LI.po +24 -25
  308. holidays/locale/uk/LC_MESSAGES/MC.po +27 -28
  309. holidays/locale/uk/LC_MESSAGES/MD.po +14 -15
  310. holidays/locale/uk/LC_MESSAGES/MX.po +10 -14
  311. holidays/locale/uk/LC_MESSAGES/NI.mo +0 -0
  312. holidays/locale/uk/LC_MESSAGES/NI.po +16 -17
  313. holidays/locale/uk/LC_MESSAGES/NL.po +14 -15
  314. holidays/locale/uk/LC_MESSAGES/NO.po +15 -16
  315. holidays/locale/uk/LC_MESSAGES/PE.po +31 -32
  316. holidays/locale/uk/LC_MESSAGES/PL.po +38 -21
  317. holidays/locale/uk/LC_MESSAGES/PY.po +17 -18
  318. holidays/locale/uk/LC_MESSAGES/RO.po +13 -14
  319. holidays/locale/uk/LC_MESSAGES/SE.po +21 -22
  320. holidays/locale/uk/LC_MESSAGES/SK.po +18 -20
  321. holidays/locale/uk/LC_MESSAGES/UA.po +17 -17
  322. holidays/locale/uk/LC_MESSAGES/UY.po +16 -17
  323. holidays/locale/uk/LC_MESSAGES/VE.po +17 -18
  324. holidays/registry.py +21 -12
  325. holidays/utils.py +87 -17
  326. {holidays-0.25.dist-info → holidays-0.27.dist-info}/METADATA +282 -265
  327. holidays-0.27.dist-info/RECORD +449 -0
  328. holidays-0.25.dist-info/RECORD +0 -390
  329. {holidays-0.25.dist-info → holidays-0.27.dist-info}/LICENSE +0 -0
  330. {holidays-0.25.dist-info → holidays-0.27.dist-info}/WHEEL +0 -0
  331. {holidays-0.25.dist-info → holidays-0.27.dist-info}/top_level.txt +0 -0
@@ -9,1056 +9,14 @@
9
9
  # Website: https://github.com/dr-prodigy/python-holidays
10
10
  # License: MIT (see LICENSE file)
11
11
 
12
- from datetime import date
13
- from datetime import timedelta as td
14
- from typing import Iterable, Set, Tuple
15
-
16
- from dateutil.easter import EASTER_ORTHODOX, EASTER_WESTERN, easter
17
- from korean_lunar_calendar import KoreanLunarCalendar
18
-
19
- from holidays.calendars import _ChineseLuniSolar, _IslamicLunar
20
- from holidays.calendars import GREGORIAN_CALENDAR, JULIAN_CALENDAR
21
- from holidays.constants import JAN, FEB, MAR, MAY, JUN, AUG, SEP, NOV, DEC
22
-
23
-
24
- class ChristianHolidays:
25
- """
26
- Christian holidays.
27
- """
28
-
29
- def __init__(self, calendar=GREGORIAN_CALENDAR) -> None:
30
- self.__verify_calendar(calendar)
31
- self.__calendar = calendar
32
-
33
- def __get_christmas_day(self, calendar=None):
34
- """
35
- Get Christmas Day date.
36
- """
37
- calendar = calendar or self.__calendar
38
- self.__verify_calendar(calendar)
39
-
40
- return (
41
- date(self._year, DEC, 25)
42
- if self.__is_gregorian_calendar(calendar)
43
- else date(self._year, JAN, 7) # Orthodox.
44
- )
45
-
46
- def __get_easter_sunday(self, calendar=None):
47
- """
48
- Get Easter Sunday date.
49
- """
50
- calendar = calendar or self.__calendar
51
- self.__verify_calendar(calendar)
52
-
53
- return easter(
54
- self._year,
55
- method=EASTER_ORTHODOX
56
- if calendar == JULIAN_CALENDAR
57
- else EASTER_WESTERN,
58
- )
59
-
60
- @staticmethod
61
- def __is_gregorian_calendar(calendar):
62
- """
63
- Return True if `calendar` is Gregorian calendar.
64
- Return False otherwise.
65
- """
66
- return calendar == GREGORIAN_CALENDAR
67
-
68
- @staticmethod
69
- def __verify_calendar(calendar):
70
- """
71
- Verify calendar type.
72
- """
73
- if calendar not in {GREGORIAN_CALENDAR, JULIAN_CALENDAR}:
74
- raise ValueError(
75
- f"Unknown calendar name: {calendar}. "
76
- "Use `GREGORIAN_CALENDAR` or `JULIAN_CALENDAR`."
77
- )
78
-
79
- @property
80
- def _christmas_day(self):
81
- """
82
- Return Christmas Day date.
83
- """
84
- return self.__get_christmas_day()
85
-
86
- @property
87
- def _easter_sunday(self):
88
- """
89
- Return Easter Sunday date.
90
- """
91
- return self.__get_easter_sunday()
92
-
93
- def _add_all_saints_day(self, name) -> date:
94
- """
95
- Add All Saints' Day (November 1st).
96
-
97
- Also known as All Hallows' Day, the Feast of All Saints,
98
- the Feast of All Hallows, the Solemnity of All Saints, and Hallowmas.
99
- https://en.wikipedia.org/wiki/All_Saints%27_Day
100
- """
101
- return self._add_holiday(name, NOV, 1)
102
-
103
- def _add_all_souls_day(self, name) -> date:
104
- """
105
- Add All Souls' Day (November 2nd).
106
-
107
- All Souls' Day is a day of prayer and remembrance for the faithful
108
- departed, observed by certain Christian denominations on 2 November.
109
- https://en.wikipedia.org/wiki/All_Souls%27_Day
110
- """
111
- return self._add_holiday(name, NOV, 2)
112
-
113
- def _add_ascension_thursday(self, name) -> date:
114
- """
115
- Add Ascension Thursday (39 days after the Easter Sunday).
116
-
117
- The Solemnity of the Ascension of Jesus Christ, also called Ascension
118
- Day, or sometimes Holy Thursday.
119
- https://en.wikipedia.org/wiki/Feast_of_the_Ascension
120
- """
121
- return self._add_holiday(
122
- name,
123
- self._easter_sunday + td(days=+39),
124
- )
125
-
126
- def _add_ash_monday(self, name) -> date:
127
- """
128
- Add Ash Monday (48 days before Easter Sunday).
129
-
130
- The Clean Monday, also known as Pure Monday, Monday of Lent
131
- or Green Monday. The first day of Great Lent.
132
- https://en.wikipedia.org/wiki/Clean_Monday
133
- """
134
- return self._add_holiday(
135
- name,
136
- self._easter_sunday + td(days=-48),
137
- )
138
-
139
- def _add_ash_wednesday(self, name) -> date:
140
- """
141
- Add Ash Wednesday (46 days before Easter Sunday).
142
-
143
- A holy day of prayer and fasting. It marks the beginning of Lent.
144
- https://en.wikipedia.org/wiki/Ash_Wednesday
145
- """
146
- return self._add_holiday(
147
- name,
148
- self._easter_sunday + td(days=-46),
149
- )
150
-
151
- def _add_assumption_of_mary_day(self, name) -> date:
152
- """
153
- Add Assumption Of Mary (August 15th).
154
-
155
- The Feast of the Assumption of Mary, or simply The Assumption marks the
156
- occasion of the Virgin Mary's bodily ascent to heaven at the end of
157
- her life.
158
- https://en.wikipedia.org/wiki/Assumption_of_Mary
159
- """
160
- return self._add_holiday(name, AUG, 15)
161
-
162
- def _add_candlemas(self, name) -> date:
163
- """
164
- Add Candlemas (February 2nd).
165
-
166
- Also known as the Feast of the Presentation of Jesus Christ,
167
- the Feast of the Purification of the Blessed Virgin Mary, or the Feast
168
- of the Holy Encounter, is a Christian holiday commemorating the
169
- presentation of Jesus at the Temple.
170
- https://en.wikipedia.org/wiki/Candlemas
171
- """
172
- return self._add_holiday(name, FEB, 2)
173
-
174
- def _add_carnival_monday(self, name) -> date:
175
- """
176
- Add Carnival Monday (48 days before Easter Sunday).
177
-
178
- Carnival is a Catholic Christian festive season that occurs before
179
- the liturgical season of Lent.
180
- https://en.wikipedia.org/wiki/Carnival
181
- """
182
- return self._add_holiday(
183
- name,
184
- self._easter_sunday + td(days=-48),
185
- )
186
-
187
- def _add_carnival_tuesday(self, name) -> date:
188
- """
189
- Add Carnival Monday (47 days before Easter Sunday).
190
-
191
- Carnival is a Catholic Christian festive season that occurs before
192
- the liturgical season of Lent.
193
- https://en.wikipedia.org/wiki/Carnival
194
- """
195
- return self._add_holiday(
196
- name,
197
- self._easter_sunday + td(days=-47),
198
- )
199
-
200
- def _add_christmas_day(self, name, calendar=None) -> date:
201
- """
202
- Add Christmas Day.
203
-
204
- Christmas is an annual festival commemorating the birth of
205
- Jesus Christ.
206
- https://en.wikipedia.org/wiki/Christmas
207
- """
208
- calendar = calendar or self.__calendar
209
- self.__verify_calendar(calendar)
210
-
211
- return self._add_holiday(
212
- name,
213
- self.__get_christmas_day(calendar),
214
- )
215
-
216
- def _add_christmas_day_two(self, name, calendar=None) -> date:
217
- """
218
- Add Christmas Day 2.
219
-
220
- A holiday celebrated after Christmas Day, also known as Boxing Day.
221
- https://en.wikipedia.org/wiki/Boxing_Day
222
- https://en.wikipedia.org/wiki/Christmas
223
- """
224
- calendar = calendar or self.__calendar
225
- self.__verify_calendar(calendar)
226
-
227
- return self._add_holiday(
228
- name,
229
- self.__get_christmas_day(calendar) + td(days=+1),
230
- )
231
-
232
- def _add_christmas_day_three(self, name, calendar=None) -> date:
233
- """
234
- Add Christmas Day 3.
235
-
236
- A holiday celebrated 2 days after Christmas Day (in some countries).
237
- https://en.wikipedia.org/wiki/Christmas
238
- """
239
- calendar = calendar or self.__calendar
240
- self.__verify_calendar(calendar)
241
-
242
- return self._add_holiday(
243
- name,
244
- self.__get_christmas_day(calendar) + td(days=+2),
245
- )
246
-
247
- def _add_christmas_eve(self, name, calendar=None) -> date:
248
- """
249
- Add Christmas Eve.
250
-
251
- Christmas Eve is the evening or entire day before Christmas Day,
252
- the festival commemorating the birth of Jesus Christ.
253
- https://en.wikipedia.org/wiki/Christmas_Eve
254
- """
255
- calendar = calendar or self.__calendar
256
- self.__verify_calendar(calendar)
257
-
258
- return self._add_holiday(
259
- name,
260
- self.__get_christmas_day(calendar) + td(days=-1),
261
- )
262
-
263
- def _add_corpus_christi_day(self, name) -> date:
264
- """
265
- Add Feast Of Corpus Christi (60 days after Easter Sunday).
266
-
267
- The Feast of Corpus Christi, also known as the Solemnity of the Most
268
- Holy Body and Blood of Christ, is a Christian liturgical solemnity
269
- celebrating the Real Presence of the Body and Blood, Soul and Divinity
270
- of Jesus Christ in the elements of the Eucharist.
271
- https://en.wikipedia.org/wiki/Feast_of_Corpus_Christi
272
- """
273
- return self._add_holiday(
274
- name,
275
- self._easter_sunday + td(days=+60),
276
- )
277
-
278
- def _add_easter_monday(self, name, calendar=None) -> date:
279
- """
280
- Add Easter Monday (1 day after Easter Sunday).
281
-
282
- Easter Monday refers to the day after Easter Sunday in either the
283
- Eastern or Western Christian traditions. It is a public holiday in
284
- some countries.
285
- https://en.wikipedia.org/wiki/Easter_Monday
286
- """
287
- return self._add_holiday(
288
- name,
289
- self.__get_easter_sunday(calendar) + td(days=+1),
290
- )
291
-
292
- def _add_easter_sunday(self, name, calendar=None) -> date:
293
- """
294
- Add Easter Sunday.
295
-
296
- Easter, also called Pascha or Resurrection Sunday is a Christian
297
- festival and cultural holiday commemorating the resurrection of Jesus
298
- from the dead.
299
- https://en.wikipedia.org/wiki/Easter
300
- """
301
- return self._add_holiday(name, self.__get_easter_sunday(calendar))
302
-
303
- def _add_epiphany_day(self, name, calendar=None) -> date:
304
- """
305
- Add Epiphany Day.
306
-
307
- Epiphany, also known as Theophany in Eastern Christian traditions,
308
- is a Christian feast day that celebrates the revelation of God
309
- incarnate as Jesus Christ.
310
- https://en.wikipedia.org/wiki/Epiphany_(holiday)
311
- """
312
- calendar = calendar or self.__calendar
313
- self.__verify_calendar(calendar)
314
-
315
- return self._add_holiday(
316
- name,
317
- date(self._year, JAN, 6)
318
- if self.__is_gregorian_calendar(calendar)
319
- else date(self._year, JAN, 19),
320
- )
321
-
322
- def _add_good_friday(self, name, calendar=None) -> date:
323
- """
324
- Add Good Friday (2 days before Easter Sunday).
325
-
326
- Good Friday is a Christian holiday commemorating the crucifixion of
327
- Jesus and his death at Calvary. It is also known as Holy Friday,
328
- Great Friday, Great and Holy Friday.
329
- https://en.wikipedia.org/wiki/Good_Friday
330
- """
331
- return self._add_holiday(
332
- name,
333
- self.__get_easter_sunday(calendar) + td(days=-2),
334
- )
335
-
336
- def _add_holy_saturday(self, name) -> date:
337
- """
338
- Add Holy Saturday (1 day before Easter Sunday).
339
-
340
- Great and Holy Saturday is a day between Good Friday and Easter Sunday.
341
- https://en.wikipedia.org/wiki/Holy_Saturday
342
- """
343
- return self._add_holiday(
344
- name,
345
- self._easter_sunday + td(days=-1),
346
- )
347
-
348
- def _add_holy_thursday(self, name) -> date:
349
- """
350
- Add Holy Thursday (3 days before Easter Sunday).
351
-
352
- Holy Thursday or Maundy Thursday is the day during Holy Week that
353
- commemorates the Washing of the Feet (Maundy) and Last Supper of
354
- Jesus Christ with the Apostles, as described in the canonical gospels.
355
- https://en.wikipedia.org/wiki/Maundy_Thursday
356
- """
357
- return self._add_holiday(
358
- name,
359
- self._easter_sunday + td(days=-3),
360
- )
361
-
362
- def _add_immaculate_conception_day(self, name) -> date:
363
- """
364
- Add Immaculate Conception Day (December 8th).
365
-
366
- https://en.wikipedia.org/wiki/Immaculate_Conception
367
- """
368
- return self._add_holiday(name, DEC, 8)
369
-
370
- def _add_nativity_of_mary_day(self, name) -> date:
371
- """
372
- Add Nativity Of Mary Day (September 8th).
373
-
374
- The Nativity of the Blessed Virgin Mary, the Nativity of Mary,
375
- the Marymas or the Birth of the Virgin Mary, refers to a Christian
376
- feast day celebrating the birth of Mary, mother of Jesus.
377
- https://en.wikipedia.org/wiki/Nativity_of_Mary
378
- """
379
- return self._add_holiday(name, SEP, 8)
380
-
381
- def _add_palm_sunday(self, name) -> date:
382
- """
383
- Add Palm Sunday (7 days before Easter Sunday).
384
-
385
- Palm Sunday is a Christian moveable feast that falls on the Sunday
386
- before Easter. The feast commemorates Christ's triumphal entry into
387
- Jerusalem, an event mentioned in each of the four canonical Gospels.
388
- Palm Sunday marks the first day of Holy Week.
389
- https://en.wikipedia.org/wiki/Palm_Sunday
390
- """
391
- return self._add_holiday(
392
- name,
393
- self._easter_sunday + td(days=-7),
394
- )
395
-
396
- def _add_rejoicing_day(self, name) -> date:
397
- """
398
- Add Day Of Rejoicing (9 days after Easter Sunday).
399
-
400
- Add Day Of Rejoicing ("Radonitsa"), in the Russian Orthodox Church is
401
- a commemoration of the departed observed on the second Tuesday of
402
- Pascha (Easter).In Ukrainian tradition it is called Provody.
403
- https://en.wikipedia.org/wiki/Radonitsa
404
- """
405
- return self._add_holiday(
406
- name,
407
- self._easter_sunday + td(days=+9),
408
- )
409
-
410
- def _add_saint_johns_day(self, name) -> date:
411
- """
412
- Add Saint John's Day (June 24th).
413
-
414
- The Nativity of John the Baptist is a Christian feast day celebrating
415
- the birth of John the Baptist.
416
- https://en.wikipedia.org/wiki/Nativity_of_John_the_Baptist
417
- """
418
- return self._add_holiday(name, JUN, 24)
419
-
420
- def _add_saint_josephs_day(self, name) -> date:
421
- """
422
- Add Saint Joseph's Day (March 19th).
423
-
424
- Saint Joseph's Day, also called the Feast of Saint Joseph or the
425
- Solemnity of Saint Joseph, is in Western Christianity the principal
426
- feast day of Saint Joseph, husband of the Virgin Mary and legal father
427
- of Jesus Christ.
428
- https://en.wikipedia.org/wiki/Saint_Joseph%27s_Day
429
- """
430
- return self._add_holiday(name, MAR, 19)
431
-
432
- def _add_saints_peter_and_paul_day(self, name) -> date:
433
- """
434
- Feast of Saints Peter and Paul (June 29th).
435
-
436
- A liturgical feast in honor of the martyrdom in Rome of the apostles
437
- Saint Peter and Saint Paul, which is observed on 29 June.
438
- https://en.wikipedia.org/wiki/Feast_of_Saints_Peter_and_Paul
439
- """
440
- return self._add_holiday(name, JUN, 29)
441
-
442
- def _add_whit_monday(self, name) -> date:
443
- """
444
- Add Whit Monday (50 days after Easter Sunday).
445
-
446
- Whit Monday or Pentecost Monday, also known as Monday of the
447
- Holy Spirit, is the holiday celebrated the day after Pentecost.
448
- https://en.wikipedia.org/wiki/Pentecost
449
- https://en.wikipedia.org/wiki/Whit_Monday
450
- """
451
- return self._add_holiday(
452
- name,
453
- self._easter_sunday + td(days=+50),
454
- )
455
-
456
- def _add_whit_sunday(self, name) -> date:
457
- """
458
- Add Whit Sunday (49 days after Easter Sunday).
459
-
460
- Whit Sunday, also called Pentecost, is a holiday which commemorates
461
- the descent of the Holy Spirit upon the Apostles and other followers
462
- of Jesus Christ while they were in Jerusalem celebrating the
463
- Feast of Weeks.
464
- https://en.wikipedia.org/wiki/Pentecost
465
- """
466
- return self._add_holiday(
467
- name,
468
- self._easter_sunday + td(days=+49),
469
- )
470
-
471
-
472
- class ChineseCalendarHolidays:
473
- """
474
- Chinese lunisolar calendar holidays.
475
- """
476
-
477
- def __init__(self) -> None:
478
- self._chinese_calendar = _ChineseLuniSolar()
479
-
480
- @property
481
- def _chinese_new_year(self):
482
- """
483
- Return Chinese New Year date.
484
- """
485
- return self._chinese_calendar.lunar_n_y_date(self._year)
486
-
487
- def _add_dragon_boat_festival(self, name) -> date:
488
- """
489
- Add Dragon Boat Festival (5th day of 5th lunar month).
490
-
491
- The Dragon Boat Festival is a traditional Chinese holiday which occurs
492
- on the fifth day of the fifth month of the Chinese calendar.
493
- https://en.wikipedia.org/wiki/Dragon_Boat_Festival
494
- """
495
- return self._add_chinese_calendar_holiday(name, 5, 5)
496
-
497
- def _add_chinese_calendar_holiday(self, name, month, day) -> date:
498
- """
499
- Add Chinese lunar calendar holiday.
500
- """
501
- return self._add_holiday(
502
- name,
503
- self._convert_chinese_to_gre(month, day),
504
- )
505
-
506
- def _add_chinese_new_years_eve(self, name) -> date:
507
- """
508
- Add Chinese New Year's Eve (last day of 12th lunar month).
509
-
510
- Chinese New Year's Eve is the day before the Chinese New Year.
511
- https://en.wikipedia.org/wiki/Chinese_New_Year%27s_Eve
512
- """
513
- return self._add_holiday(
514
- name,
515
- self._chinese_new_year + td(days=-1),
516
- )
517
-
518
- def _add_chinese_new_years_day(self, name) -> date:
519
- """
520
- Add Chinese New Year's Day (first day of the first lunar month).
521
-
522
- Chinese New Year is the festival that celebrates the beginning of
523
- a new year on the traditional lunisolar and solar Chinese calendar.
524
- https://en.wikipedia.org/wiki/Chinese_New_Year
525
- """
526
- return self._add_holiday(
527
- name,
528
- self._chinese_new_year,
529
- )
530
-
531
- def _add_chinese_new_years_day_two(self, name) -> date:
532
- """
533
- Add Chinese New Year's Day Two.
534
-
535
- https://en.wikipedia.org/wiki/Chinese_New_Year
536
- """
537
- return self._add_holiday(
538
- name,
539
- self._chinese_new_year + td(days=+1),
540
- )
541
-
542
- def _add_chinese_new_years_day_three(self, name) -> date:
543
- """
544
- Add Chinese New Year's Day Three.
545
-
546
- https://en.wikipedia.org/wiki/Chinese_New_Year
547
- """
548
- return self._add_holiday(
549
- name,
550
- self._chinese_new_year + td(days=+2),
551
- )
552
-
553
- def _add_chinese_new_years_day_four(self, name) -> date:
554
- """
555
- Add Chinese New Year's Day Four.
556
-
557
- https://en.wikipedia.org/wiki/Chinese_New_Year
558
- """
559
- return self._add_holiday(
560
- name,
561
- self._chinese_new_year + td(days=+3),
562
- )
563
-
564
- def _add_chinese_new_years_day_five(self, name) -> date:
565
- """
566
- Add Chinese New Year's Day Five.
567
-
568
- https://en.wikipedia.org/wiki/Chinese_New_Year
569
- """
570
- return self._add_holiday(
571
- name,
572
- self._chinese_new_year + td(days=+4),
573
- )
574
-
575
- def _add_mid_autumn_festival(self, name):
576
- """
577
- Add Mid Autumn Festival (15th day of the 8th lunar month).
578
-
579
- The Mid-Autumn Festival, also known as the Moon Festival or
580
- Mooncake Festival.
581
- https://en.wikipedia.org/wiki/Mid-Autumn_Festival
582
- """
583
- return self._add_chinese_calendar_holiday(name, 8, 15)
584
-
585
- def _convert_chinese_to_gre(self, month, day):
586
- """
587
- Convert lunar calendar date to Gregorian calendar date.
588
- """
589
- return self._chinese_calendar.lunar_to_gre(self._year, month, day)
590
-
591
-
592
- class InternationalHolidays:
593
- """
594
- International holidays.
595
- """
596
-
597
- def _add_labor_day(self, name):
598
- """
599
- Add International Workers' Day (May 1st)
600
-
601
- International Workers' Day, also known as Labour Day, is a celebration
602
- of labourers and the working classes that is promoted by the
603
- international labour movement.
604
- https://en.wikipedia.org/wiki/International_Workers%27_Day
605
- """
606
- return self._add_holiday(name, MAY, 1)
607
-
608
- def _add_new_years_day(self, name) -> date:
609
- """
610
- Add New Year's Day (January 1st).
611
-
612
- New Year's Day is a festival observed in most of the world on
613
- 1 January, the first day of the year in the modern Gregorian calendar.
614
- https://en.wikipedia.org/wiki/New_Year%27s_Day
615
- """
616
- return self._add_holiday(name, JAN, 1)
617
-
618
- def _add_new_years_day_two(self, name) -> date:
619
- """
620
- Add New Year's Day Two (January 2nd).
621
-
622
- New Year's Day is a festival observed in most of the world on
623
- 1 January, the first day of the year in the modern Gregorian calendar.
624
- https://en.wikipedia.org/wiki/New_Year%27s_Day
625
- """
626
- return self._add_holiday(name, JAN, 2)
627
-
628
- def _add_new_years_day_three(self, name) -> date:
629
- """
630
- Add New Year's Day Three (January 3rd).
631
-
632
- New Year's Day is a festival observed in most of the world on
633
- 1 January, the first day of the year in the modern Gregorian calendar.
634
- https://en.wikipedia.org/wiki/New_Year%27s_Day
635
- """
636
- return self._add_holiday(name, JAN, 3)
637
-
638
- def _add_new_years_day_four(self, name) -> date:
639
- """
640
- Add New Year's Day Four (January 4th).
641
-
642
- New Year's Day is a festival observed in most of the world on
643
- 1 January, the first day of the year in the modern Gregorian calendar.
644
- https://en.wikipedia.org/wiki/New_Year%27s_Day
645
- """
646
- return self._add_holiday(name, JAN, 4)
647
-
648
- def _add_remembrance_day(self, name):
649
- """
650
- Add Remembrance Day / Armistice Day (Nov 11th)
651
-
652
- It's a memorial day since the end of the First World War in 1919
653
- to honour armed forces members who have died in the line of duty.
654
- https://en.wikipedia.org/wiki/Remembrance_Day
655
- """
656
- return self._add_holiday(name, NOV, 11)
657
-
658
- def _add_new_years_eve(self, name) -> date:
659
- """
660
- Add New Year's Eve (December 31st).
661
-
662
- In the Gregorian calendar, New Year's Eve, also known as Old Year's
663
- Day or Saint Sylvester's Day in many countries, is the evening or the
664
- entire day of the last day of the year, on 31 December.
665
- https://en.wikipedia.org/wiki/New_Year%27s_Eve
666
- """
667
- return self._add_holiday(name, DEC, 31)
668
-
669
- def _add_womens_day(self, name):
670
- """
671
- Add International Women's Day (March 8th).
672
-
673
- International Women's Day is a global holiday celebrated as a focal
674
- point in the women's rights movement, bringing attention to issues
675
- such as gender equality, reproductive rights, and violence and abuse
676
- against women.
677
- https://en.wikipedia.org/wiki/International_Women%27s_Day
678
- """
679
- return self._add_holiday(name, MAR, 8)
680
-
681
- def _add_world_war_two_victory_day(self, name):
682
- """
683
- Add Victory Day (May 9th)
684
-
685
- Victory Day is a holiday that commemorates the victory over Nazi
686
- Germany in 1945.
687
- https://en.wikipedia.org/wiki/Victory_Day_(9_May)
688
- """
689
- return self._add_holiday(name, MAY, 9)
690
-
691
-
692
- class IslamicHolidays:
693
- """
694
- Islamic holidays.
695
-
696
- The Hijri calendar also known as Islamic calendar, is a lunar
697
- calendar consisting of 12 lunar months in a year of 354 or 355 days.
698
- """
699
-
700
- def __init__(self, calendar=_IslamicLunar()) -> None:
701
- self._islamic_calendar = calendar
702
-
703
- def _add_arafah_day(self, name) -> Set[date]:
704
- """
705
- Add Day of Arafah (9th day of 12th month).
706
-
707
- At dawn of this day, Muslim pilgrims will make their way from Mina
708
- to a nearby hillside and plain called Mount Arafat and the Plain of
709
- Arafat.
710
- https://en.wikipedia.org/wiki/Day_of_Arafah
711
- """
712
- return self._add_islamic_calendar_holiday(
713
- name,
714
- self._islamic_calendar.eid_al_adha_dates(self._year),
715
- days_delta=-1,
716
- )
717
-
718
- def _add_ashura_day(self, name) -> Set[date]:
719
- """
720
- Add Ashura Day (10th day of 1st month).
721
-
722
- Ashura is a day of commemoration in Islam. It occurs annually on the
723
- 10th of Muharram, the first month of the Islamic calendar.
724
- https://en.wikipedia.org/wiki/Ashura
725
- """
726
- return self._add_islamic_calendar_holiday(
727
- name,
728
- self._islamic_calendar.ashura_dates(self._year),
729
- )
730
-
731
- def _add_ashura_eve(self, name) -> Set[date]:
732
- """
733
- Add Ashura Eve (Day before the 10th day of 1st month).
734
-
735
- Ashura is a day of commemoration in Islam. It occurs annually on the
736
- 10th of Muharram, the first month of the Islamic calendar.
737
- https://en.wikipedia.org/wiki/Ashura
738
- """
739
- return self._add_islamic_calendar_holiday(
740
- name,
741
- self._islamic_calendar.ashura_dates(self._year),
742
- days_delta=-1,
743
- )
744
-
745
- def _add_eid_al_adha_day(self, name) -> Set[date]:
746
- """
747
- Add Eid al-Adha Day (10th day of the 12th month of Islamic calendar).
748
-
749
- Feast of the Sacrifice. It honours the willingness of Ibrahim
750
- (Abraham) to sacrifice his son Ismail (Ishmael) as an act of obedience
751
- to Allah's command.
752
- https://en.wikipedia.org/wiki/Eid_al-Adha
753
- """
754
- return self._add_islamic_calendar_holiday(
755
- name,
756
- self._islamic_calendar.eid_al_adha_dates(self._year),
757
- )
758
-
759
- def _add_eid_al_adha_day_two(self, name) -> Set[date]:
760
- """
761
- Add Eid al-Adha Day Two.
762
-
763
- https://en.wikipedia.org/wiki/Eid_al-Adha
764
- """
765
- return self._add_islamic_calendar_holiday(
766
- name,
767
- self._islamic_calendar.eid_al_adha_dates(self._year),
768
- days_delta=+1,
769
- )
770
-
771
- def _add_eid_al_adha_day_three(self, name) -> Set[date]:
772
- """
773
- Add Eid al-Adha Day Three.
774
-
775
- https://en.wikipedia.org/wiki/Eid_al-Adha
776
- """
777
- return self._add_islamic_calendar_holiday(
778
- name,
779
- self._islamic_calendar.eid_al_adha_dates(self._year),
780
- days_delta=+2,
781
- )
782
-
783
- def _add_eid_al_adha_day_four(self, name) -> Set[date]:
784
- """
785
- Add Eid al-Adha Day Four.
786
-
787
- https://en.wikipedia.org/wiki/Eid_al-Adha
788
- """
789
- return self._add_islamic_calendar_holiday(
790
- name,
791
- self._islamic_calendar.eid_al_adha_dates(self._year),
792
- days_delta=+3,
793
- )
794
-
795
- def _add_eid_al_fitr_day(self, name) -> Set[date]:
796
- """
797
- Add Eid al-Fitr Day (1st day of 10th month of Islamic calendar).
798
-
799
- Holiday of Breaking the Fast. The religious holiday is celebrated
800
- by Muslims worldwide because it marks the end of the month-long
801
- dawn-to-sunset fasting of Ramadan.
802
- https://en.wikipedia.org/wiki/Eid_al-Fitr
803
- """
804
- return self._add_islamic_calendar_holiday(
805
- name,
806
- self._islamic_calendar.eid_al_fitr_dates(self._year),
807
- )
808
-
809
- def _add_eid_al_fitr_day_two(self, name) -> Set[date]:
810
- """
811
- Add Eid al-Fitr Day Two.
812
-
813
- https://en.wikipedia.org/wiki/Eid_al-Fitr
814
- """
815
- return self._add_islamic_calendar_holiday(
816
- name,
817
- self._islamic_calendar.eid_al_fitr_dates(self._year),
818
- days_delta=+1,
819
- )
820
-
821
- def _add_eid_al_fitr_day_three(self, name) -> Set[date]:
822
- """
823
- Add Eid al-Fitr Day Three.
824
-
825
- https://en.wikipedia.org/wiki/Eid_al-Fitr
826
- """
827
- return self._add_islamic_calendar_holiday(
828
- name,
829
- self._islamic_calendar.eid_al_fitr_dates(self._year),
830
- days_delta=+2,
831
- )
832
-
833
- def _add_eid_al_fitr_day_four(self, name) -> Set[date]:
834
- """
835
- Add Eid al-Fitr Day Four.
836
-
837
- https://en.wikipedia.org/wiki/Eid_al-Fitr
838
- """
839
- return self._add_islamic_calendar_holiday(
840
- name,
841
- self._islamic_calendar.eid_al_fitr_dates(self._year),
842
- days_delta=+3,
843
- )
844
-
845
- def _add_hari_hol_johor(self, name) -> Set[date]:
846
- """
847
- Hari Hol Johor.
848
-
849
- https://publicholidays.com.my/hari-hol-almarhum-sultan-iskandar/
850
- """
851
- return self._add_islamic_calendar_holiday(
852
- name,
853
- self._islamic_calendar.hari_hol_johor_dates(self._year),
854
- )
855
-
856
- def _add_islamic_calendar_holiday(
857
- self,
858
- name: str,
859
- dates: Iterable[Tuple[date, bool]],
860
- days_delta: int = 0,
861
- ) -> Set[date]:
862
- """
863
- Add lunar calendar holiday.
864
-
865
- Appends customizable estimation label at the end of holiday name if
866
- holiday date is an estimation.
867
- """
868
- added_dates = set()
869
- estimated_label = getattr(self, "estimated_label", "estimated")
870
- for dt, is_estimated in dates:
871
- if days_delta != 0:
872
- dt += td(days=days_delta)
873
- dt = self._add_holiday(
874
- f"{name}* (*{estimated_label})" if is_estimated else name,
875
- dt,
876
- )
877
- if dt:
878
- added_dates.add(dt)
879
-
880
- return added_dates
881
-
882
- def _add_islamic_new_year_day(self, name) -> Set[date]:
883
- """
884
- Add Islamic New Year Day (last day of Dhu al-Hijjah).
885
-
886
- The Islamic New Year, also called the Hijri New Year, is the day that
887
- marks the beginning of a new lunar Hijri year, and is the day on which
888
- the year count is incremented. The first day of the Islamic year is
889
- observed by most Muslims on the first day of the month of Muharram.
890
- https://en.wikipedia.org/wiki/Islamic_New_Year
891
- """
892
- return self._add_islamic_calendar_holiday(
893
- name,
894
- self._islamic_calendar.hijri_new_year_dates(self._year),
895
- )
896
-
897
- def _add_isra_and_miraj_day(self, name):
898
- """
899
- Add Isra' and Mi'raj Day (27th day of 7th month).
900
-
901
- https://en.wikipedia.org/wiki/Isra%27_and_Mi%27raj
902
- """
903
- return self._add_islamic_calendar_holiday(
904
- name,
905
- self._islamic_calendar.isra_and_miraj_dates(self._year),
906
- )
907
-
908
- def _add_mawlid_day(self, name) -> Set[date]:
909
- """
910
- Add Mawlid Day (12th day of 3rd month).
911
-
912
- Mawlid is the observance of the birthday of the Islamic prophet
913
- Muhammad.
914
- https://en.wikipedia.org/wiki/Mawlid
915
- """
916
- return self._add_islamic_calendar_holiday(
917
- name,
918
- self._islamic_calendar.mawlid_dates(self._year),
919
- )
920
-
921
- def _add_mawlid_day_two(self, name) -> Set[date]:
922
- """
923
- Add Mawlid Day Two.
924
-
925
- Mawlid is the observance of the birthday of the Islamic prophet
926
- Muhammad.
927
- https://en.wikipedia.org/wiki/Mawlid
928
- """
929
- return self._add_islamic_calendar_holiday(
930
- name,
931
- self._islamic_calendar.mawlid_dates(self._year),
932
- days_delta=+1,
933
- )
934
-
935
- def _add_nuzul_al_quran_day(self, name) -> Set[date]:
936
- """
937
- Add Nuzul Al Quran (17th day of 9th month).
938
-
939
- Nuzul Al Quran is a Muslim festival to remember the day when Prophet
940
- Muhammad received his first revelation of Islam's sacred book,
941
- the holy Quran.
942
- https://zamzam.com/blog/nuzul-al-quran/
943
- """
944
- return self._add_islamic_calendar_holiday(
945
- name,
946
- self._islamic_calendar.nuzul_al_quran_dates(self._year),
947
- )
948
-
949
- def _add_ramadan_beginning_day(self, name) -> Set[date]:
950
- """
951
- Add First Day of Ramadan (1st day of 9th month).
952
-
953
- Ramadan is the ninth month of the Islamic calendar, observed by Muslims
954
- worldwide as a month of fasting, prayer, reflection, and community
955
- https://en.wikipedia.org/wiki/Ramadan
956
- """
957
- return self._add_islamic_calendar_holiday(
958
- name,
959
- self._islamic_calendar.ramadan_beginning_dates(self._year),
960
- )
961
-
962
-
963
- class KoreanCalendarHolidays:
964
- """
965
- Korean lunisolar calendar holidays.
966
- """
967
-
968
- def __init__(self) -> None:
969
- self._korean_calendar = KoreanLunarCalendar()
970
-
971
- @property
972
- def _korean_new_year(self):
973
- """
974
- Return Korean Lunisolar calendar New Year date.
975
- """
976
- return self._convert_korean_to_gre(self._year, 1, 1)
977
-
978
- def _add_korean_calendar_holiday(self, name, month, day) -> date:
979
- """
980
- Add lunar calendar holiday.
981
- """
982
- return self._add_holiday(
983
- name,
984
- self._convert_korean_to_gre(self._year, month, day),
985
- )
986
-
987
- def _add_korean_new_years_day(self, name) -> date:
988
- """
989
- Add Korean New Years Day (second new moon after the winter solstice).
990
-
991
- Korean New Year, Seollal is a festival and national holiday
992
- commemorating the first day of the Chinese lunisolar calendar.
993
- https://en.wikipedia.org/wiki/Korean_New_Year
994
- """
995
- return self._add_holiday(
996
- name,
997
- self._korean_new_year,
998
- )
999
-
1000
- def _add_korean_new_years_day_two(self, name) -> date:
1001
- """
1002
- Add Korean New Years Day Two (1 day after New Years Day).
1003
-
1004
- https://en.wikipedia.org/wiki/Korean_New_Year
1005
- """
1006
- return self._add_holiday(
1007
- name,
1008
- self._korean_new_year + td(days=+1),
1009
- )
1010
-
1011
- def _add_korean_new_years_day_three(self, name) -> date:
1012
- """
1013
- Add Korean New Years Day Three (2 days after New Years Day).
1014
-
1015
- https://en.wikipedia.org/wiki/Korean_New_Year
1016
- """
1017
- return self._add_holiday(
1018
- name,
1019
- self._korean_new_year + td(days=+2),
1020
- )
1021
-
1022
- def _add_korean_new_years_day_four(self, name) -> date:
1023
- """
1024
- Add Korean New Years Day Four (3 days after New Years Day).
1025
-
1026
- https://en.wikipedia.org/wiki/Korean_New_Year
1027
- """
1028
- return self._add_holiday(
1029
- name,
1030
- self._korean_new_year + td(days=+3),
1031
- )
1032
-
1033
- def _add_korean_new_years_day_five(self, name) -> date:
1034
- """
1035
- Add Korean New Years Day Five (4 days after New Years Day).
1036
-
1037
- https://en.wikipedia.org/wiki/Korean_New_Year
1038
- """
1039
- return self._add_holiday(
1040
- name,
1041
- self._korean_new_year + td(days=+4),
1042
- )
1043
-
1044
- def _add_korean_new_years_eve(self, name) -> date:
1045
- """
1046
- Add Korean New Years Eve (1 day before New Years Day).
1047
-
1048
- https://en.wikipedia.org/wiki/Korean_New_Year
1049
- """
1050
- return self._add_holiday(
1051
- name,
1052
- self._korean_new_year + td(days=-1),
1053
- )
1054
-
1055
- def _convert_korean_to_gre(self, year: int, month: int, day: int) -> date:
1056
- """
1057
- Get solar date.
1058
- """
1059
- self._korean_calendar.setLunarDate(year, month, day, False)
1060
- return date(
1061
- self._korean_calendar.solarYear,
1062
- self._korean_calendar.solarMonth,
1063
- self._korean_calendar.solarDay,
1064
- )
12
+ # flake8: noqa: F401
13
+
14
+ from holidays.groups import (
15
+ BuddhistCalendarHolidays,
16
+ ChineseCalendarHolidays,
17
+ ChristianHolidays,
18
+ HinduCalendarHolidays,
19
+ InternationalHolidays,
20
+ IslamicHolidays,
21
+ ThaiCalendarHolidays,
22
+ )