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,157 @@
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
+
14
+ from holidays.constants import JAN, MAR, MAY, JUN, OCT, NOV, DEC
15
+
16
+
17
+ class InternationalHolidays:
18
+ """
19
+ International holidays.
20
+ """
21
+
22
+ def _add_africa_day(self, name):
23
+ """
24
+ Add Africa Day (May 25th)
25
+
26
+ Africa Day (formerly African Freedom Day and African Liberation Day)
27
+ is the annual commemoration of the foundation of the Organisation
28
+ of African Unity on 25 May 1963.
29
+ https://en.wikipedia.org/wiki/Africa_Day
30
+ """
31
+ return self._add_holiday(name, MAY, 25)
32
+
33
+ def _add_childrens_day(self, name, variation="JUN"):
34
+ """
35
+ Add International Children's Day (June 1).
36
+
37
+ In 1925, International Children's Day was first proclaimed in Geneva
38
+ during the World Conference on Child Welfare. Since 1950, it is
39
+ celebrated on June 1 in many countries.
40
+
41
+ As such, this entry currently defaults to June 1, though this also
42
+ supports another internationally adopted variant, November 20th.
43
+ https://en.wikipedia.org/wiki/Children's_Day
44
+ """
45
+ if variation == "JUN":
46
+ return self._add_holiday(name, JUN, 1)
47
+ elif variation == "NOV":
48
+ return self._add_holiday(name, NOV, 20)
49
+ else:
50
+ raise ValueError(
51
+ f"Unknown variaton name: {variation}. "
52
+ "This entry currently supports `JUN` and `NOV` variation only."
53
+ )
54
+
55
+ def _add_columbus_day(self, name):
56
+ """
57
+ Add Columbus Day (October 12th)
58
+
59
+ Columbus Day is a national holiday which officially celebrates the
60
+ anniversary of Christopher Columbus's arrival in the Americas.
61
+ https://en.wikipedia.org/wiki/Columbus_Day
62
+ """
63
+ return self._add_holiday(name, OCT, 12)
64
+
65
+ def _add_labor_day(self, name):
66
+ """
67
+ Add International Workers' Day (May 1st)
68
+
69
+ International Workers' Day, also known as Labour Day, is a celebration
70
+ of labourers and the working classes that is promoted by the
71
+ international labour movement.
72
+ https://en.wikipedia.org/wiki/International_Workers%27_Day
73
+ """
74
+ return self._add_holiday(name, MAY, 1)
75
+
76
+ def _add_new_years_day(self, name) -> date:
77
+ """
78
+ Add New Year's Day (January 1st).
79
+
80
+ New Year's Day is a festival observed in most of the world on
81
+ 1 January, the first day of the year in the modern Gregorian calendar.
82
+ https://en.wikipedia.org/wiki/New_Year%27s_Day
83
+ """
84
+ return self._add_holiday(name, JAN, 1)
85
+
86
+ def _add_new_years_day_two(self, name) -> date:
87
+ """
88
+ Add New Year's Day Two (January 2nd).
89
+
90
+ New Year's Day is a festival observed in most of the world on
91
+ 1 January, the first day of the year in the modern Gregorian calendar.
92
+ https://en.wikipedia.org/wiki/New_Year%27s_Day
93
+ """
94
+ return self._add_holiday(name, JAN, 2)
95
+
96
+ def _add_new_years_day_three(self, name) -> date:
97
+ """
98
+ Add New Year's Day Three (January 3rd).
99
+
100
+ New Year's Day is a festival observed in most of the world on
101
+ 1 January, the first day of the year in the modern Gregorian calendar.
102
+ https://en.wikipedia.org/wiki/New_Year%27s_Day
103
+ """
104
+ return self._add_holiday(name, JAN, 3)
105
+
106
+ def _add_new_years_day_four(self, name) -> date:
107
+ """
108
+ Add New Year's Day Four (January 4th).
109
+
110
+ New Year's Day is a festival observed in most of the world on
111
+ 1 January, the first day of the year in the modern Gregorian calendar.
112
+ https://en.wikipedia.org/wiki/New_Year%27s_Day
113
+ """
114
+ return self._add_holiday(name, JAN, 4)
115
+
116
+ def _add_remembrance_day(self, name):
117
+ """
118
+ Add Remembrance Day / Armistice Day (Nov 11th)
119
+
120
+ It's a memorial day since the end of the First World War in 1919
121
+ to honour armed forces members who have died in the line of duty.
122
+ https://en.wikipedia.org/wiki/Remembrance_Day
123
+ """
124
+ return self._add_holiday(name, NOV, 11)
125
+
126
+ def _add_new_years_eve(self, name) -> date:
127
+ """
128
+ Add New Year's Eve (December 31st).
129
+
130
+ In the Gregorian calendar, New Year's Eve, also known as Old Year's
131
+ Day or Saint Sylvester's Day in many countries, is the evening or the
132
+ entire day of the last day of the year, on 31 December.
133
+ https://en.wikipedia.org/wiki/New_Year%27s_Eve
134
+ """
135
+ return self._add_holiday(name, DEC, 31)
136
+
137
+ def _add_womens_day(self, name):
138
+ """
139
+ Add International Women's Day (March 8th).
140
+
141
+ International Women's Day is a global holiday celebrated as a focal
142
+ point in the women's rights movement, bringing attention to issues
143
+ such as gender equality, reproductive rights, and violence and abuse
144
+ against women.
145
+ https://en.wikipedia.org/wiki/International_Women%27s_Day
146
+ """
147
+ return self._add_holiday(name, MAR, 8)
148
+
149
+ def _add_world_war_two_victory_day(self, name):
150
+ """
151
+ Add Victory Day (May 9th)
152
+
153
+ Victory Day is a holiday that commemorates the victory over Nazi
154
+ Germany in 1945.
155
+ https://en.wikipedia.org/wiki/Victory_Day_(9_May)
156
+ """
157
+ return self._add_holiday(name, MAY, 9)
@@ -0,0 +1,288 @@
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
+ from typing import Iterable, Set, Tuple
15
+
16
+ from holidays.calendars import _IslamicLunar
17
+
18
+
19
+ class IslamicHolidays:
20
+ """
21
+ Islamic holidays.
22
+
23
+ The Hijri calendar also known as Islamic calendar, is a lunar
24
+ calendar consisting of 12 lunar months in a year of 354 or 355 days.
25
+ """
26
+
27
+ def __init__(self, calendar=_IslamicLunar()) -> None:
28
+ self._islamic_calendar = calendar
29
+
30
+ def _add_arafah_day(self, name) -> Set[date]:
31
+ """
32
+ Add Day of Arafah (9th day of 12th month).
33
+
34
+ At dawn of this day, Muslim pilgrims will make their way from Mina
35
+ to a nearby hillside and plain called Mount Arafat and the Plain of
36
+ Arafat.
37
+ https://en.wikipedia.org/wiki/Day_of_Arafah
38
+ """
39
+ return self._add_islamic_calendar_holiday(
40
+ name,
41
+ self._islamic_calendar.eid_al_adha_dates(self._year),
42
+ days_delta=-1,
43
+ )
44
+
45
+ def _add_ashura_day(self, name) -> Set[date]:
46
+ """
47
+ Add Ashura Day (10th day of 1st month).
48
+
49
+ Ashura is a day of commemoration in Islam. It occurs annually on the
50
+ 10th of Muharram, the first month of the Islamic calendar.
51
+ https://en.wikipedia.org/wiki/Ashura
52
+ """
53
+ return self._add_islamic_calendar_holiday(
54
+ name,
55
+ self._islamic_calendar.ashura_dates(self._year),
56
+ )
57
+
58
+ def _add_ashura_eve(self, name) -> Set[date]:
59
+ """
60
+ Add Ashura Eve (Day before the 10th day of 1st month).
61
+
62
+ Ashura is a day of commemoration in Islam. It occurs annually on the
63
+ 10th of Muharram, the first month of the Islamic calendar.
64
+ https://en.wikipedia.org/wiki/Ashura
65
+ """
66
+ return self._add_islamic_calendar_holiday(
67
+ name,
68
+ self._islamic_calendar.ashura_dates(self._year),
69
+ days_delta=-1,
70
+ )
71
+
72
+ def _add_eid_al_adha_day(self, name) -> Set[date]:
73
+ """
74
+ Add Eid al-Adha Day (10th day of the 12th month of Islamic calendar).
75
+
76
+ Feast of the Sacrifice. It honours the willingness of Ibrahim
77
+ (Abraham) to sacrifice his son Ismail (Ishmael) as an act of obedience
78
+ to Allah's command.
79
+ https://en.wikipedia.org/wiki/Eid_al-Adha
80
+ """
81
+ return self._add_islamic_calendar_holiday(
82
+ name,
83
+ self._islamic_calendar.eid_al_adha_dates(self._year),
84
+ )
85
+
86
+ def _add_eid_al_adha_day_two(self, name) -> Set[date]:
87
+ """
88
+ Add Eid al-Adha Day Two.
89
+
90
+ https://en.wikipedia.org/wiki/Eid_al-Adha
91
+ """
92
+ return self._add_islamic_calendar_holiday(
93
+ name,
94
+ self._islamic_calendar.eid_al_adha_dates(self._year),
95
+ days_delta=+1,
96
+ )
97
+
98
+ def _add_eid_al_adha_day_three(self, name) -> Set[date]:
99
+ """
100
+ Add Eid al-Adha Day Three.
101
+
102
+ https://en.wikipedia.org/wiki/Eid_al-Adha
103
+ """
104
+ return self._add_islamic_calendar_holiday(
105
+ name,
106
+ self._islamic_calendar.eid_al_adha_dates(self._year),
107
+ days_delta=+2,
108
+ )
109
+
110
+ def _add_eid_al_adha_day_four(self, name) -> Set[date]:
111
+ """
112
+ Add Eid al-Adha Day Four.
113
+
114
+ https://en.wikipedia.org/wiki/Eid_al-Adha
115
+ """
116
+ return self._add_islamic_calendar_holiday(
117
+ name,
118
+ self._islamic_calendar.eid_al_adha_dates(self._year),
119
+ days_delta=+3,
120
+ )
121
+
122
+ def _add_eid_al_fitr_day(self, name) -> Set[date]:
123
+ """
124
+ Add Eid al-Fitr Day (1st day of 10th month of Islamic calendar).
125
+
126
+ Holiday of Breaking the Fast. The religious holiday is celebrated
127
+ by Muslims worldwide because it marks the end of the month-long
128
+ dawn-to-sunset fasting of Ramadan.
129
+ https://en.wikipedia.org/wiki/Eid_al-Fitr
130
+ """
131
+ return self._add_islamic_calendar_holiday(
132
+ name,
133
+ self._islamic_calendar.eid_al_fitr_dates(self._year),
134
+ )
135
+
136
+ def _add_eid_al_fitr_day_two(self, name) -> Set[date]:
137
+ """
138
+ Add Eid al-Fitr Day Two.
139
+
140
+ https://en.wikipedia.org/wiki/Eid_al-Fitr
141
+ """
142
+ return self._add_islamic_calendar_holiday(
143
+ name,
144
+ self._islamic_calendar.eid_al_fitr_dates(self._year),
145
+ days_delta=+1,
146
+ )
147
+
148
+ def _add_eid_al_fitr_day_three(self, name) -> Set[date]:
149
+ """
150
+ Add Eid al-Fitr Day Three.
151
+
152
+ https://en.wikipedia.org/wiki/Eid_al-Fitr
153
+ """
154
+ return self._add_islamic_calendar_holiday(
155
+ name,
156
+ self._islamic_calendar.eid_al_fitr_dates(self._year),
157
+ days_delta=+2,
158
+ )
159
+
160
+ def _add_eid_al_fitr_day_four(self, name) -> Set[date]:
161
+ """
162
+ Add Eid al-Fitr Day Four.
163
+
164
+ https://en.wikipedia.org/wiki/Eid_al-Fitr
165
+ """
166
+ return self._add_islamic_calendar_holiday(
167
+ name,
168
+ self._islamic_calendar.eid_al_fitr_dates(self._year),
169
+ days_delta=+3,
170
+ )
171
+
172
+ def _add_hari_hol_johor(self, name) -> Set[date]:
173
+ """
174
+ Hari Hol Johor.
175
+
176
+ https://publicholidays.com.my/hari-hol-almarhum-sultan-iskandar/
177
+ """
178
+ return self._add_islamic_calendar_holiday(
179
+ name,
180
+ self._islamic_calendar.hari_hol_johor_dates(self._year),
181
+ )
182
+
183
+ def _add_islamic_calendar_holiday(
184
+ self,
185
+ name: str,
186
+ dates: Iterable[Tuple[date, bool]],
187
+ days_delta: int = 0,
188
+ ) -> Set[date]:
189
+ """
190
+ Add lunar calendar holiday.
191
+
192
+ Appends customizable estimation label at the end of holiday name if
193
+ holiday date is an estimation.
194
+ """
195
+ added_dates = set()
196
+ estimated_label = getattr(self, "estimated_label", "%s* (*estimated)")
197
+ for dt, is_estimated in dates:
198
+ if days_delta != 0:
199
+ dt += td(days=days_delta)
200
+
201
+ dt = self._add_holiday(
202
+ self.tr(estimated_label) % self.tr(name) if is_estimated else name,
203
+ dt,
204
+ )
205
+ if dt:
206
+ added_dates.add(dt)
207
+
208
+ return added_dates
209
+
210
+ def _add_islamic_new_year_day(self, name) -> Set[date]:
211
+ """
212
+ Add Islamic New Year Day (last day of Dhu al-Hijjah).
213
+
214
+ The Islamic New Year, also called the Hijri New Year, is the day that
215
+ marks the beginning of a new lunar Hijri year, and is the day on which
216
+ the year count is incremented. The first day of the Islamic year is
217
+ observed by most Muslims on the first day of the month of Muharram.
218
+ https://en.wikipedia.org/wiki/Islamic_New_Year
219
+ """
220
+ return self._add_islamic_calendar_holiday(
221
+ name,
222
+ self._islamic_calendar.hijri_new_year_dates(self._year),
223
+ )
224
+
225
+ def _add_isra_and_miraj_day(self, name):
226
+ """
227
+ Add Isra' and Mi'raj Day (27th day of 7th month).
228
+
229
+ https://en.wikipedia.org/wiki/Isra%27_and_Mi%27raj
230
+ """
231
+ return self._add_islamic_calendar_holiday(
232
+ name,
233
+ self._islamic_calendar.isra_and_miraj_dates(self._year),
234
+ )
235
+
236
+ def _add_mawlid_day(self, name) -> Set[date]:
237
+ """
238
+ Add Mawlid Day (12th day of 3rd month).
239
+
240
+ Mawlid is the observance of the birthday of the Islamic prophet
241
+ Muhammad.
242
+ https://en.wikipedia.org/wiki/Mawlid
243
+ """
244
+ return self._add_islamic_calendar_holiday(
245
+ name,
246
+ self._islamic_calendar.mawlid_dates(self._year),
247
+ )
248
+
249
+ def _add_mawlid_day_two(self, name) -> Set[date]:
250
+ """
251
+ Add Mawlid Day Two.
252
+
253
+ Mawlid is the observance of the birthday of the Islamic prophet
254
+ Muhammad.
255
+ https://en.wikipedia.org/wiki/Mawlid
256
+ """
257
+ return self._add_islamic_calendar_holiday(
258
+ name,
259
+ self._islamic_calendar.mawlid_dates(self._year),
260
+ days_delta=+1,
261
+ )
262
+
263
+ def _add_nuzul_al_quran_day(self, name) -> Set[date]:
264
+ """
265
+ Add Nuzul Al Quran (17th day of 9th month).
266
+
267
+ Nuzul Al Quran is a Muslim festival to remember the day when Prophet
268
+ Muhammad received his first revelation of Islam's sacred book,
269
+ the holy Quran.
270
+ https://zamzam.com/blog/nuzul-al-quran/
271
+ """
272
+ return self._add_islamic_calendar_holiday(
273
+ name,
274
+ self._islamic_calendar.nuzul_al_quran_dates(self._year),
275
+ )
276
+
277
+ def _add_ramadan_beginning_day(self, name) -> Set[date]:
278
+ """
279
+ Add First Day of Ramadan (1st day of 9th month).
280
+
281
+ Ramadan is the ninth month of the Islamic calendar, observed by Muslims
282
+ worldwide as a month of fasting, prayer, reflection, and community
283
+ https://en.wikipedia.org/wiki/Ramadan
284
+ """
285
+ return self._add_islamic_calendar_holiday(
286
+ name,
287
+ self._islamic_calendar.ramadan_beginning_dates(self._year),
288
+ )
@@ -0,0 +1,157 @@
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 Optional
14
+
15
+ from holidays.calendars import _ThaiLunisolar, THAI_CALENDAR
16
+
17
+
18
+ class ThaiCalendarHolidays:
19
+ """
20
+ Thai lunisolar calendar holidays.
21
+
22
+ For more info, see class `_ThaiLunisolar`.
23
+ Calendar-type checking are done by `_ThaiLunisolar`.
24
+ """
25
+
26
+ def __init__(self, calendar=THAI_CALENDAR) -> None:
27
+ self.__calendar = calendar
28
+ self._thai_calendar = _ThaiLunisolar(calendar)
29
+
30
+ def _add_asarnha_bucha(self, name, calendar=None) -> Optional[date]:
31
+ """
32
+ Add Asarnha Bucha.
33
+
34
+ Asalha Pūjā (also written as Asarnha Bucha Day) is a Buddhist festival
35
+ celebrated on the 15th Waxing Day (Full Moon) of Month 8.
36
+
37
+ Khmer variant: always fall on Month 8.
38
+ Thai variant: will use Month 8.8 instead for Athikamat years.
39
+
40
+ https://en.wikipedia.org/wiki/Asalha_Puja
41
+ """
42
+ calendar = calendar or self.__calendar
43
+
44
+ return self._add_thai_calendar_holiday(
45
+ name, self._thai_calendar.asarnha_bucha_date(self._year, calendar)
46
+ )
47
+
48
+ def _add_khao_phansa(self, name, calendar=None) -> Optional[date]:
49
+ """
50
+ Add Khao Phansa.
51
+
52
+ Start of Buddhist Lent (also written as Khao Phansa Day) is a Buddhist
53
+ festival celebrated on the 1st Waning Day of Month 8.
54
+
55
+ Khmer variant: always fall on Month 8.
56
+ Thai variant: will use Month 8.8 instead for Athikamat years.
57
+
58
+ https://en.wikipedia.org/wiki/Vassa
59
+ """
60
+ calendar = calendar or self.__calendar
61
+
62
+ return self._add_thai_calendar_holiday(
63
+ name, self._thai_calendar.khao_phansa_date(self._year, calendar)
64
+ )
65
+
66
+ def _add_loy_krathong(self, name) -> Optional[date]:
67
+ """
68
+ Add Loy Krathong.
69
+
70
+ Also known as "Boun That Louang" and "Bon Om Touk".
71
+ This concides with the 15th Waxing Day (Full Moon) of Month 12
72
+ in Thai Lunar Calendar.
73
+
74
+ https://en.wikipedia.org/wiki/Loy_Krathong
75
+ https://en.wikipedia.org/wiki/Bon_Om_Touk
76
+ """
77
+
78
+ return self._add_thai_calendar_holiday(
79
+ name, self._thai_calendar.loy_krathong_date(self._year)
80
+ )
81
+
82
+ def _add_makha_bucha(self, name, calendar=None) -> Optional[date]:
83
+ """
84
+ Add Makha Bucha.
85
+
86
+ Māgha Pūjā (also written as Makha Bucha Day) is a Buddhist festival
87
+ celebrated on the 15th Waxing Day (Full Moon) of Month 3.
88
+
89
+ Khmer variant: always fall on Month 3.
90
+ Thai variant: will use Month 4 instead for Athikamat years.
91
+
92
+ https://en.wikipedia.org/wiki/M%C4%81gha_P%C5%ABj%C4%81
93
+ """
94
+ calendar = calendar or self.__calendar
95
+
96
+ return self._add_thai_calendar_holiday(
97
+ name, self._thai_calendar.makha_bucha_date(self._year, calendar)
98
+ )
99
+
100
+ def _add_pchum_ben(self, name) -> Optional[date]:
101
+ """
102
+ Add Pchum Ben.
103
+
104
+ Also known as "Prachum Bandar".
105
+ This concides with the 15th Waning Day (New Moon) of Month 10 in
106
+ Thai Lunar Calendar.
107
+
108
+ https://en.wikipedia.org/wiki/Pchum_Ben
109
+ """
110
+
111
+ return self._add_thai_calendar_holiday(
112
+ name, self._thai_calendar.pchum_ben_date(self._year)
113
+ )
114
+
115
+ def _add_preah_neangkoal(self, name) -> Optional[date]:
116
+ """
117
+ Add Preah Reach Pithi Chrat Preah Neangkoal.
118
+
119
+ Also known as "Cambodian Royal Ploughing Ceremony". This always
120
+ concides with the 4th Waning Day of Month 6 in Khmer Lunar Calendar.
121
+
122
+ https://en.wikipedia.org/wiki/Royal_Ploughing_Ceremony
123
+ """
124
+
125
+ return self._add_thai_calendar_holiday(
126
+ name, self._thai_calendar.preah_neangkoal_date(self._year)
127
+ )
128
+
129
+ def _add_thai_calendar_holiday(self, name, dt) -> Optional[date]:
130
+ """
131
+ Add Thai calendar holiday.
132
+
133
+ If the result from `_ThaiLunisolar` is none then no holidays added.
134
+ """
135
+ if dt is None:
136
+ return None
137
+
138
+ return self._add_holiday(name, dt)
139
+
140
+ def _add_visakha_bucha(self, name, calendar=None) -> Optional[date]:
141
+ """
142
+ Add Visakha Bucha.
143
+
144
+ Vesak(also written as Makha Bucha Day and Meak Bochea Day) is a
145
+ Buddhist festival celebrated on the 15th Waxing Day (Full Moon)
146
+ of Month 6.
147
+
148
+ Khmer variant: always fall on Month 6.
149
+ Thai variant: will use Month 7 instead for Athikamat years.
150
+
151
+ https://en.wikipedia.org/wiki/M%C4%81gha_P%C5%ABj%C4%81
152
+ """
153
+ calendar = calendar or self.__calendar
154
+
155
+ return self._add_thai_calendar_holiday(
156
+ name, self._thai_calendar.visakha_bucha_date(self._year, calendar)
157
+ )
holidays/helpers.py ADDED
@@ -0,0 +1,20 @@
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 <dr.prodigy.github@gmail.com> (c) 2017-2023
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
+
13
+ def _normalize_tuple(data):
14
+ """Normalize tuple.
15
+
16
+ :return:
17
+ An unchanged object for tuple of tuples, e.g., ((JAN, 10), (DEC, 31)).
18
+ An object put into a tuple otherwise, e.g., ((JAN, 10),).
19
+ """
20
+ return data if not data or type(data[0]) == tuple else (data,)