holidays 0.48__py3-none-any.whl → 0.50__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- holidays/__init__.py +12 -1
- holidays/calendars/gregorian.py +22 -7
- holidays/calendars/persian.py +3 -2
- holidays/calendars/thai.py +24 -20
- holidays/countries/__init__.py +1 -0
- holidays/countries/angola.py +2 -2
- holidays/countries/aruba.py +2 -3
- holidays/countries/botswana.py +19 -9
- holidays/countries/cambodia.py +7 -8
- holidays/countries/canada.py +2 -1
- holidays/countries/chile.py +14 -11
- holidays/countries/curacao.py +3 -4
- holidays/countries/finland.py +2 -2
- holidays/countries/georgia.py +17 -1
- holidays/countries/greenland.py +96 -0
- holidays/countries/hongkong.py +398 -133
- holidays/countries/isle_of_man.py +3 -8
- holidays/countries/israel.py +13 -13
- holidays/countries/italy.py +163 -133
- holidays/countries/japan.py +52 -33
- holidays/countries/jersey.py +11 -9
- holidays/countries/laos.py +7 -23
- holidays/countries/madagascar.py +2 -3
- holidays/countries/malaysia.py +545 -235
- holidays/countries/monaco.py +4 -6
- holidays/countries/netherlands.py +2 -3
- holidays/countries/new_zealand.py +5 -5
- holidays/countries/russia.py +18 -4
- holidays/countries/saudi_arabia.py +2 -3
- holidays/countries/south_korea.py +17 -4
- holidays/countries/sweden.py +2 -3
- holidays/countries/switzerland.py +18 -17
- holidays/deprecation.py +33 -0
- holidays/financial/__init__.py +1 -0
- holidays/financial/ice_futures_europe.py +47 -0
- holidays/financial/ny_stock_exchange.py +17 -4
- holidays/groups/chinese.py +2 -3
- holidays/groups/christian.py +18 -19
- holidays/groups/islamic.py +2 -2
- holidays/groups/persian.py +2 -2
- holidays/helpers.py +9 -3
- holidays/holiday_base.py +18 -15
- holidays/locale/da/LC_MESSAGES/GL.mo +0 -0
- holidays/locale/da/LC_MESSAGES/GL.po +91 -0
- holidays/locale/en_US/LC_MESSAGES/GE.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/GE.po +8 -4
- holidays/locale/en_US/LC_MESSAGES/GL.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/GL.po +92 -0
- holidays/locale/en_US/LC_MESSAGES/MY.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/MY.po +250 -0
- holidays/locale/en_US/LC_MESSAGES/RU.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/RU.po +11 -2
- holidays/locale/ka/LC_MESSAGES/GE.mo +0 -0
- holidays/locale/ka/LC_MESSAGES/GE.po +8 -4
- holidays/locale/kl/LC_MESSAGES/GL.mo +0 -0
- holidays/locale/kl/LC_MESSAGES/GL.po +91 -0
- holidays/locale/ms_MY/LC_MESSAGES/MY.mo +0 -0
- holidays/locale/ms_MY/LC_MESSAGES/MY.po +250 -0
- holidays/locale/ru/LC_MESSAGES/RU.mo +0 -0
- holidays/locale/ru/LC_MESSAGES/RU.po +11 -2
- holidays/locale/uk/LC_MESSAGES/GE.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/GE.po +8 -4
- holidays/mixins.py +31 -0
- holidays/observed_holiday_base.py +66 -37
- holidays/registry.py +12 -1
- {holidays-0.48.dist-info → holidays-0.50.dist-info}/AUTHORS +3 -0
- {holidays-0.48.dist-info → holidays-0.50.dist-info}/METADATA +14 -6
- {holidays-0.48.dist-info → holidays-0.50.dist-info}/RECORD +71 -57
- {holidays-0.48.dist-info → holidays-0.50.dist-info}/LICENSE +0 -0
- {holidays-0.48.dist-info → holidays-0.50.dist-info}/WHEEL +0 -0
- {holidays-0.48.dist-info → holidays-0.50.dist-info}/top_level.txt +0 -0
holidays/__init__.py
CHANGED
|
@@ -12,13 +12,24 @@
|
|
|
12
12
|
|
|
13
13
|
# flake8: noqa: F403
|
|
14
14
|
|
|
15
|
+
import warnings
|
|
16
|
+
|
|
15
17
|
from holidays.constants import *
|
|
18
|
+
from holidays.deprecation import (
|
|
19
|
+
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE,
|
|
20
|
+
FutureIncompatibilityWarning,
|
|
21
|
+
)
|
|
16
22
|
from holidays.holiday_base import *
|
|
17
23
|
from holidays.registry import EntityLoader
|
|
18
24
|
from holidays.utils import *
|
|
19
25
|
|
|
20
|
-
__version__ = "0.
|
|
26
|
+
__version__ = "0.50"
|
|
21
27
|
|
|
22
28
|
|
|
23
29
|
EntityLoader.load("countries", globals())
|
|
24
30
|
EntityLoader.load("financial", globals())
|
|
31
|
+
|
|
32
|
+
warnings.warn(
|
|
33
|
+
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE.format(version=__version__),
|
|
34
|
+
FutureIncompatibilityWarning,
|
|
35
|
+
)
|
holidays/calendars/gregorian.py
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from datetime import timedelta as td
|
|
15
14
|
|
|
16
15
|
GREGORIAN_CALENDAR = "GREGORIAN_CALENDAR"
|
|
17
16
|
|
|
@@ -30,6 +29,19 @@ MONTHS = {
|
|
|
30
29
|
WEEKDAYS = {w: i for i, w in enumerate(("mon", "tue", "wed", "thu", "fri", "sat", "sun"))}
|
|
31
30
|
|
|
32
31
|
|
|
32
|
+
# Holiday names.
|
|
33
|
+
CHRISTMAS = "christmas"
|
|
34
|
+
WINTER_SOLSTICE = "winter_solstice"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _timedelta(dt: date, days: int = 0) -> date:
|
|
38
|
+
"""
|
|
39
|
+
Return date that is `days` days after (days > 0) or before (days < 0) specified date.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
return date.fromordinal(dt.toordinal() + days)
|
|
43
|
+
|
|
44
|
+
|
|
33
45
|
def _get_nth_weekday_from(n: int, weekday: int, from_dt: date) -> date:
|
|
34
46
|
"""
|
|
35
47
|
Return date of a n-th weekday before a specific date
|
|
@@ -39,10 +51,13 @@ def _get_nth_weekday_from(n: int, weekday: int, from_dt: date) -> date:
|
|
|
39
51
|
Examples: 1st Monday, 2nd Saturday, etc).
|
|
40
52
|
"""
|
|
41
53
|
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
return _timedelta(
|
|
55
|
+
from_dt,
|
|
56
|
+
(
|
|
57
|
+
(n - 1) * 7 + (weekday - from_dt.weekday()) % 7
|
|
58
|
+
if n > 0
|
|
59
|
+
else (n + 1) * 7 - (from_dt.weekday() - weekday) % 7
|
|
60
|
+
),
|
|
46
61
|
)
|
|
47
62
|
|
|
48
63
|
|
|
@@ -61,7 +76,7 @@ def _get_nth_weekday_of_month(n: int, weekday: int, month: int, year: int) -> da
|
|
|
61
76
|
if month > 12:
|
|
62
77
|
month = 1
|
|
63
78
|
year += 1
|
|
64
|
-
start_date = date(year, month, 1)
|
|
79
|
+
start_date = _timedelta(date(year, month, 1), -1)
|
|
65
80
|
else:
|
|
66
81
|
start_date = date(year, month, 1)
|
|
67
82
|
|
|
@@ -77,4 +92,4 @@ def _get_nth_weekday_of_month(n: int, weekday: int, month: int, year: int) -> da
|
|
|
77
92
|
def _get_all_sundays(year):
|
|
78
93
|
first_sunday = _get_nth_weekday_of_month(1, SUN, JAN, year)
|
|
79
94
|
for n in range(0, (date(year, DEC, 31) - first_sunday).days + 1, 7):
|
|
80
|
-
yield first_sunday
|
|
95
|
+
yield _timedelta(first_sunday, n)
|
holidays/calendars/persian.py
CHANGED
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from datetime import timedelta as td
|
|
15
14
|
from typing import Optional
|
|
16
15
|
|
|
16
|
+
from holidays.calendars.gregorian import _timedelta
|
|
17
|
+
|
|
17
18
|
|
|
18
19
|
class _Persian:
|
|
19
20
|
"""
|
|
@@ -54,4 +55,4 @@ class _Persian:
|
|
|
54
55
|
|
|
55
56
|
m = j_month - 1
|
|
56
57
|
delta = (31 * m if m < 6 else 186 + 30 * (m - 6)) + j_day - 1
|
|
57
|
-
return start_date
|
|
58
|
+
return _timedelta(start_date, delta)
|
holidays/calendars/thai.py
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from datetime import timedelta as td
|
|
15
14
|
from functools import lru_cache
|
|
16
15
|
from typing import Optional
|
|
17
16
|
|
|
17
|
+
from holidays.calendars.gregorian import _timedelta
|
|
18
|
+
|
|
18
19
|
KHMER_CALENDAR = "KHMER_CALENDAR"
|
|
19
20
|
THAI_CALENDAR = "THAI_CALENDAR"
|
|
20
21
|
|
|
@@ -230,7 +231,7 @@ class _ThaiLunisolar:
|
|
|
230
231
|
elif iter_year in _ThaiLunisolar.ATHIKAWAN_YEARS_GREGORIAN:
|
|
231
232
|
delta_days += 1
|
|
232
233
|
|
|
233
|
-
return _ThaiLunisolar.START_DATE
|
|
234
|
+
return _timedelta(_ThaiLunisolar.START_DATE, delta_days)
|
|
234
235
|
|
|
235
236
|
def makha_bucha_date(self, year: int, calendar=None) -> Optional[date]:
|
|
236
237
|
"""
|
|
@@ -267,13 +268,14 @@ class _ThaiLunisolar:
|
|
|
267
268
|
if not start_date:
|
|
268
269
|
return None
|
|
269
270
|
|
|
270
|
-
return
|
|
271
|
-
|
|
271
|
+
return _timedelta(
|
|
272
|
+
start_date,
|
|
273
|
+
+102
|
|
272
274
|
if (
|
|
273
275
|
year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN
|
|
274
276
|
and not self.__is_khmer_calendar(calendar)
|
|
275
277
|
)
|
|
276
|
-
else +73
|
|
278
|
+
else +73,
|
|
277
279
|
)
|
|
278
280
|
|
|
279
281
|
def visakha_bucha_date(self, year: int, calendar=None) -> Optional[date]:
|
|
@@ -310,13 +312,14 @@ class _ThaiLunisolar:
|
|
|
310
312
|
if not start_date:
|
|
311
313
|
return None
|
|
312
314
|
|
|
313
|
-
return
|
|
314
|
-
|
|
315
|
+
return _timedelta(
|
|
316
|
+
start_date,
|
|
317
|
+
+191
|
|
315
318
|
if (
|
|
316
319
|
year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN
|
|
317
320
|
and not self.__is_khmer_calendar(calendar)
|
|
318
321
|
)
|
|
319
|
-
else +161
|
|
322
|
+
else +161,
|
|
320
323
|
)
|
|
321
324
|
|
|
322
325
|
def preah_neangkoal_date(self, year: int) -> Optional[date]:
|
|
@@ -346,7 +349,7 @@ class _ThaiLunisolar:
|
|
|
346
349
|
if not start_date:
|
|
347
350
|
return None
|
|
348
351
|
|
|
349
|
-
return start_date +
|
|
352
|
+
return _timedelta(start_date, +165)
|
|
350
353
|
|
|
351
354
|
def atthami_bucha_date(self, year: int, calendar=None) -> Optional[date]:
|
|
352
355
|
"""
|
|
@@ -383,13 +386,14 @@ class _ThaiLunisolar:
|
|
|
383
386
|
if not start_date:
|
|
384
387
|
return None
|
|
385
388
|
|
|
386
|
-
return
|
|
387
|
-
|
|
389
|
+
return _timedelta(
|
|
390
|
+
start_date,
|
|
391
|
+
+199
|
|
388
392
|
if (
|
|
389
393
|
year in _ThaiLunisolar.ATHIKAMAT_YEARS_GREGORIAN
|
|
390
394
|
and not self.__is_khmer_calendar(calendar)
|
|
391
395
|
)
|
|
392
|
-
else +169
|
|
396
|
+
else +169,
|
|
393
397
|
)
|
|
394
398
|
|
|
395
399
|
def asarnha_bucha_date(self, year: int) -> Optional[date]:
|
|
@@ -430,7 +434,7 @@ class _ThaiLunisolar:
|
|
|
430
434
|
delta_days = +221
|
|
431
435
|
else:
|
|
432
436
|
delta_days = +220
|
|
433
|
-
return start_date
|
|
437
|
+
return _timedelta(start_date, delta_days)
|
|
434
438
|
|
|
435
439
|
def khao_phansa_date(self, year: int) -> Optional[date]:
|
|
436
440
|
"""
|
|
@@ -469,7 +473,7 @@ class _ThaiLunisolar:
|
|
|
469
473
|
delta_days = +222
|
|
470
474
|
else:
|
|
471
475
|
delta_days = +221
|
|
472
|
-
return start_date
|
|
476
|
+
return _timedelta(start_date, delta_days)
|
|
473
477
|
|
|
474
478
|
def boun_haw_khao_padapdin_date(self, year: int) -> Optional[date]:
|
|
475
479
|
"""
|
|
@@ -503,7 +507,7 @@ class _ThaiLunisolar:
|
|
|
503
507
|
delta_days = +265
|
|
504
508
|
else:
|
|
505
509
|
delta_days = +264
|
|
506
|
-
return start_date
|
|
510
|
+
return _timedelta(start_date, delta_days)
|
|
507
511
|
|
|
508
512
|
def boun_haw_khao_salark_date(self, year: int) -> Optional[date]:
|
|
509
513
|
"""
|
|
@@ -537,7 +541,7 @@ class _ThaiLunisolar:
|
|
|
537
541
|
delta_days = +280
|
|
538
542
|
else:
|
|
539
543
|
delta_days = +279
|
|
540
|
-
return start_date
|
|
544
|
+
return _timedelta(start_date, delta_days)
|
|
541
545
|
|
|
542
546
|
def pchum_ben_date(self, year: int) -> Optional[date]:
|
|
543
547
|
"""
|
|
@@ -571,7 +575,7 @@ class _ThaiLunisolar:
|
|
|
571
575
|
delta_days = +295
|
|
572
576
|
else:
|
|
573
577
|
delta_days = +294
|
|
574
|
-
return start_date
|
|
578
|
+
return _timedelta(start_date, delta_days)
|
|
575
579
|
|
|
576
580
|
def ok_phansa_date(self, year: int) -> Optional[date]:
|
|
577
581
|
"""
|
|
@@ -605,7 +609,7 @@ class _ThaiLunisolar:
|
|
|
605
609
|
delta_days = +310
|
|
606
610
|
else:
|
|
607
611
|
delta_days = +309
|
|
608
|
-
return start_date
|
|
612
|
+
return _timedelta(start_date, delta_days)
|
|
609
613
|
|
|
610
614
|
def boun_suang_heua_date(self, year: int) -> Optional[date]:
|
|
611
615
|
"""
|
|
@@ -639,7 +643,7 @@ class _ThaiLunisolar:
|
|
|
639
643
|
delta_days = +311
|
|
640
644
|
else:
|
|
641
645
|
delta_days = +310
|
|
642
|
-
return start_date
|
|
646
|
+
return _timedelta(start_date, delta_days)
|
|
643
647
|
|
|
644
648
|
def loy_krathong_date(self, year: int) -> Optional[date]:
|
|
645
649
|
"""
|
|
@@ -673,4 +677,4 @@ class _ThaiLunisolar:
|
|
|
673
677
|
delta_days = +339
|
|
674
678
|
else:
|
|
675
679
|
delta_days = +338
|
|
676
|
-
return start_date
|
|
680
|
+
return _timedelta(start_date, delta_days)
|
holidays/countries/__init__.py
CHANGED
|
@@ -67,6 +67,7 @@ from .georgia import Georgia, GE, GEO
|
|
|
67
67
|
from .germany import Germany, DE, DEU
|
|
68
68
|
from .ghana import Ghana, GH, GHA
|
|
69
69
|
from .greece import Greece, GR, GRC
|
|
70
|
+
from .greenland import Greenland, GL, GRL
|
|
70
71
|
from .guam import Guam, GU, GUM, HolidaysGU
|
|
71
72
|
from .guatemala import Guatemala, GT, GUA
|
|
72
73
|
from .honduras import Honduras, HN, HND
|
holidays/countries/angola.py
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
14
|
from gettext import gettext as tr
|
|
15
|
-
from typing import Tuple
|
|
15
|
+
from typing import Optional, Tuple
|
|
16
16
|
|
|
17
17
|
from holidays.calendars.gregorian import AUG, SEP
|
|
18
18
|
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
|
|
@@ -59,7 +59,7 @@ class Angola(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stat
|
|
|
59
59
|
# it rolls over to the following Monday.
|
|
60
60
|
return dt >= date(1996, SEP, 27)
|
|
61
61
|
|
|
62
|
-
def _add_observed(self, dt: date, **kwargs) -> Tuple[bool, date]:
|
|
62
|
+
def _add_observed(self, dt: date, **kwargs) -> Tuple[bool, Optional[date]]:
|
|
63
63
|
# As per Law # #11/18, from 2018/9/10, when public holiday falls on Tuesday or Thursday,
|
|
64
64
|
# the Monday or Friday is also a holiday.
|
|
65
65
|
kwargs.setdefault(
|
holidays/countries/aruba.py
CHANGED
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from datetime import timedelta as td
|
|
15
14
|
from gettext import gettext as tr
|
|
16
15
|
|
|
17
|
-
from holidays.calendars.gregorian import APR, AUG
|
|
16
|
+
from holidays.calendars.gregorian import APR, AUG, _timedelta
|
|
18
17
|
from holidays.groups import ChristianHolidays, InternationalHolidays
|
|
19
18
|
from holidays.holiday_base import HolidayBase
|
|
20
19
|
|
|
@@ -118,7 +117,7 @@ class Aruba(HolidayBase, ChristianHolidays, InternationalHolidays):
|
|
|
118
117
|
else:
|
|
119
118
|
dt = (AUG, 31)
|
|
120
119
|
if self._is_sunday(dt):
|
|
121
|
-
dt = date(self._year, *dt)
|
|
120
|
+
dt = _timedelta(date(self._year, *dt), -1 if self._year >= 1980 else +1)
|
|
122
121
|
self._add_holiday(name, dt)
|
|
123
122
|
|
|
124
123
|
# Dia di Labor/Dia di Obrero.
|
holidays/countries/botswana.py
CHANGED
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
from holidays.calendars.gregorian import JUL
|
|
14
14
|
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
|
|
15
|
-
from holidays.observed_holiday_base import
|
|
15
|
+
from holidays.observed_holiday_base import (
|
|
16
|
+
ObservedHolidayBase,
|
|
17
|
+
SAT_TO_NEXT_MON,
|
|
18
|
+
SUN_TO_NEXT_MON,
|
|
19
|
+
SUN_TO_NEXT_TUE,
|
|
20
|
+
)
|
|
16
21
|
|
|
17
22
|
|
|
18
23
|
class Botswana(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
|
|
@@ -41,16 +46,19 @@ class Botswana(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, St
|
|
|
41
46
|
self._add_observed(self._add_new_years_day("New Year's Day"), rule=SUN_TO_NEXT_TUE)
|
|
42
47
|
self._add_observed(self._add_new_years_day_two("New Year's Day Holiday"))
|
|
43
48
|
|
|
44
|
-
# Easter and easter related calculations
|
|
45
49
|
self._add_good_friday("Good Friday")
|
|
50
|
+
|
|
46
51
|
self._add_holy_saturday("Holy Saturday")
|
|
52
|
+
|
|
47
53
|
self._add_easter_monday("Easter Monday")
|
|
48
|
-
self._add_ascension_thursday("Ascension Day")
|
|
49
54
|
|
|
50
|
-
may_1
|
|
51
|
-
self.
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
self._add_observed(may_1 := self._add_labor_day("Labour Day"))
|
|
56
|
+
if self._year >= 2016:
|
|
57
|
+
self._add_observed(
|
|
58
|
+
may_1, name="Labour Day Holiday", rule=SAT_TO_NEXT_MON, show_observed_label=False
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
self._add_ascension_thursday("Ascension Day")
|
|
54
62
|
|
|
55
63
|
self._add_observed(self._add_holiday_jul_1("Sir Seretse Khama Day"))
|
|
56
64
|
|
|
@@ -63,8 +71,10 @@ class Botswana(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, St
|
|
|
63
71
|
self._add_observed(self._add_christmas_day("Christmas Day"), rule=SUN_TO_NEXT_TUE)
|
|
64
72
|
self._add_observed(dec_26 := self._add_christmas_day_two("Boxing Day"))
|
|
65
73
|
|
|
66
|
-
if self.
|
|
67
|
-
self.
|
|
74
|
+
if self._year >= 2016:
|
|
75
|
+
self._add_observed(
|
|
76
|
+
dec_26, name="Boxing Day Holiday", rule=SAT_TO_NEXT_MON, show_observed_label=False
|
|
77
|
+
)
|
|
68
78
|
|
|
69
79
|
|
|
70
80
|
class BW(Botswana):
|
holidays/countries/cambodia.py
CHANGED
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
# Website: https://github.com/vacanza/python-holidays
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
|
-
from datetime import timedelta as td
|
|
14
13
|
from gettext import gettext as tr
|
|
15
14
|
|
|
16
|
-
from holidays.calendars.gregorian import MAY, AUG, SEP
|
|
15
|
+
from holidays.calendars.gregorian import MAY, AUG, SEP, _timedelta
|
|
17
16
|
from holidays.calendars.thai import KHMER_CALENDAR
|
|
18
17
|
from holidays.groups import InternationalHolidays, StaticHolidays, ThaiCalendarHolidays
|
|
19
18
|
from holidays.holiday_base import HolidayBase
|
|
@@ -98,8 +97,8 @@ class Cambodia(HolidayBase, InternationalHolidays, StaticHolidays, ThaiCalendarH
|
|
|
98
97
|
if self._year in sangkranta_years_apr_14
|
|
99
98
|
else self._add_holiday_apr_13(sangkranta)
|
|
100
99
|
)
|
|
101
|
-
self._add_holiday(sangkranta, dt +
|
|
102
|
-
self._add_holiday(sangkranta, dt +
|
|
100
|
+
self._add_holiday(sangkranta, _timedelta(dt, +1))
|
|
101
|
+
self._add_holiday(sangkranta, _timedelta(dt, +2))
|
|
103
102
|
|
|
104
103
|
# ទិវាពលកម្មអន្តរជាតិ
|
|
105
104
|
# Status: In-Use.
|
|
@@ -253,9 +252,9 @@ class Cambodia(HolidayBase, InternationalHolidays, StaticHolidays, ThaiCalendarH
|
|
|
253
252
|
pchum_ben = tr("ពិធីបុណ្យភ្ផុំបិណ្ឌ")
|
|
254
253
|
pchum_ben_date = self._add_pchum_ben(pchum_ben)
|
|
255
254
|
if pchum_ben_date:
|
|
256
|
-
self._add_holiday(pchum_ben, pchum_ben_date
|
|
255
|
+
self._add_holiday(pchum_ben, _timedelta(pchum_ben_date, -1))
|
|
257
256
|
if self._year >= 2017:
|
|
258
|
-
self._add_holiday(pchum_ben, pchum_ben_date +
|
|
257
|
+
self._add_holiday(pchum_ben, _timedelta(pchum_ben_date, +1))
|
|
259
258
|
|
|
260
259
|
# ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក
|
|
261
260
|
# Status: In-Use.
|
|
@@ -265,8 +264,8 @@ class Cambodia(HolidayBase, InternationalHolidays, StaticHolidays, ThaiCalendarH
|
|
|
265
264
|
bon_om_touk = tr("ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក")
|
|
266
265
|
bon_om_touk_date = self._add_loy_krathong(bon_om_touk)
|
|
267
266
|
if bon_om_touk_date:
|
|
268
|
-
self._add_holiday(bon_om_touk, bon_om_touk_date
|
|
269
|
-
self._add_holiday(bon_om_touk, bon_om_touk_date +
|
|
267
|
+
self._add_holiday(bon_om_touk, _timedelta(bon_om_touk_date, -1))
|
|
268
|
+
self._add_holiday(bon_om_touk, _timedelta(bon_om_touk_date, +1))
|
|
270
269
|
|
|
271
270
|
|
|
272
271
|
class KH(Cambodia):
|
holidays/countries/canada.py
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
14
|
from gettext import gettext as tr
|
|
15
|
+
from typing import Optional
|
|
15
16
|
|
|
16
17
|
from holidays.calendars.gregorian import MAR, APR, JUN, JUL, SEP
|
|
17
18
|
from holidays.constants import GOVERNMENT, OPTIONAL, PUBLIC
|
|
@@ -69,7 +70,7 @@ class Canada(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stat
|
|
|
69
70
|
kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_MON)
|
|
70
71
|
super().__init__(*args, **kwargs)
|
|
71
72
|
|
|
72
|
-
def _get_nearest_monday(self, *args) -> date:
|
|
73
|
+
def _get_nearest_monday(self, *args) -> Optional[date]:
|
|
73
74
|
return self._get_observed_date(date(self._year, *args), rule=ALL_TO_NEAREST_MON)
|
|
74
75
|
|
|
75
76
|
def _add_statutory_holidays(self):
|
holidays/countries/chile.py
CHANGED
|
@@ -17,8 +17,11 @@ from holidays.calendars.gregorian import JUN, SEP
|
|
|
17
17
|
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
|
|
18
18
|
from holidays.observed_holiday_base import (
|
|
19
19
|
ObservedHolidayBase,
|
|
20
|
+
MON_ONLY,
|
|
21
|
+
MON_FRI_ONLY,
|
|
20
22
|
TUE_TO_PREV_FRI,
|
|
21
23
|
WED_TO_NEXT_FRI,
|
|
24
|
+
FRI_ONLY,
|
|
22
25
|
WORKDAY_TO_NEAREST_MON,
|
|
23
26
|
)
|
|
24
27
|
|
|
@@ -84,9 +87,9 @@ class Chile(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stati
|
|
|
84
87
|
return None
|
|
85
88
|
|
|
86
89
|
# New Year's Day.
|
|
87
|
-
|
|
88
|
-
if self._year >= 2017
|
|
89
|
-
self._add_new_years_day_two(tr("Feriado nacional"))
|
|
90
|
+
self._add_new_years_day(tr("Año Nuevo"))
|
|
91
|
+
if self._year >= 2017:
|
|
92
|
+
self._add_observed(self._add_new_years_day_two(tr("Feriado nacional")), rule=MON_ONLY)
|
|
90
93
|
|
|
91
94
|
# Good Friday.
|
|
92
95
|
self._add_good_friday(tr("Viernes Santo"))
|
|
@@ -141,12 +144,12 @@ class Chile(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stati
|
|
|
141
144
|
tr("Día de la Unidad Nacional")
|
|
142
145
|
)
|
|
143
146
|
|
|
144
|
-
if self._year >=
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
if self._year >= 2007:
|
|
148
|
+
self._add_observed(
|
|
149
|
+
# National Holiday.
|
|
150
|
+
self._add_holiday_sep_17(tr("Fiestas Patrias")),
|
|
151
|
+
rule=MON_FRI_ONLY if self._year >= 2017 else MON_ONLY,
|
|
152
|
+
)
|
|
150
153
|
|
|
151
154
|
# Independence Day.
|
|
152
155
|
self._add_holiday_sep_18(tr("Día de la Independencia"))
|
|
@@ -154,8 +157,8 @@ class Chile(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stati
|
|
|
154
157
|
# Army Day.
|
|
155
158
|
self._add_holiday_sep_19(tr("Día de las Glorias del Ejército"))
|
|
156
159
|
|
|
157
|
-
if self._year >= 2008
|
|
158
|
-
self._add_holiday_sep_20(tr("Fiestas Patrias"))
|
|
160
|
+
if self._year >= 2008:
|
|
161
|
+
self._add_observed(self._add_holiday_sep_20(tr("Fiestas Patrias")), rule=FRI_ONLY)
|
|
159
162
|
|
|
160
163
|
if 1932 <= self._year <= 1944:
|
|
161
164
|
self._add_holiday_sep_20(tr("Fiestas Patrias"))
|
holidays/countries/curacao.py
CHANGED
|
@@ -11,10 +11,9 @@
|
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
13
|
from datetime import date
|
|
14
|
-
from datetime import timedelta as td
|
|
15
14
|
from gettext import gettext as tr
|
|
16
15
|
|
|
17
|
-
from holidays.calendars.gregorian import APR, MAY
|
|
16
|
+
from holidays.calendars.gregorian import APR, MAY, _timedelta
|
|
18
17
|
from holidays.groups import ChristianHolidays, InternationalHolidays
|
|
19
18
|
from holidays.holiday_base import HolidayBase
|
|
20
19
|
|
|
@@ -90,7 +89,7 @@ class Curacao(HolidayBase, ChristianHolidays, InternationalHolidays):
|
|
|
90
89
|
)
|
|
91
90
|
dt = date(self._year, APR, 27 if self._year >= 2014 else 30)
|
|
92
91
|
if self._is_sunday(dt):
|
|
93
|
-
dt
|
|
92
|
+
dt = _timedelta(dt, -1 if self._year >= 1980 else +1)
|
|
94
93
|
self._add_holiday(name, dt)
|
|
95
94
|
|
|
96
95
|
# Dia di Obrero.
|
|
@@ -99,7 +98,7 @@ class Curacao(HolidayBase, ChristianHolidays, InternationalHolidays):
|
|
|
99
98
|
|
|
100
99
|
dt = date(self._year, MAY, 1)
|
|
101
100
|
if self._is_sunday(dt) or (self._is_monday(dt) and self._year <= 1979):
|
|
102
|
-
dt
|
|
101
|
+
dt = _timedelta(dt, +1)
|
|
103
102
|
# Labor Day
|
|
104
103
|
self._add_holiday(tr("Dia di Obrero"), dt)
|
|
105
104
|
|
holidays/countries/finland.py
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
# Website: https://github.com/vacanza/python-holidays
|
|
11
11
|
# License: MIT (see LICENSE file)
|
|
12
12
|
|
|
13
|
-
from datetime import timedelta as td
|
|
14
13
|
from gettext import gettext as tr
|
|
15
14
|
|
|
15
|
+
from holidays.calendars.gregorian import _timedelta
|
|
16
16
|
from holidays.groups import ChristianHolidays, InternationalHolidays
|
|
17
17
|
from holidays.holiday_base import HolidayBase
|
|
18
18
|
|
|
@@ -72,7 +72,7 @@ class Finland(HolidayBase, ChristianHolidays, InternationalHolidays):
|
|
|
72
72
|
dt = self._add_holiday_jun_23(name)
|
|
73
73
|
|
|
74
74
|
# Midsummer Day.
|
|
75
|
-
self._add_holiday(tr("Juhannuspäivä"), dt +
|
|
75
|
+
self._add_holiday(tr("Juhannuspäivä"), _timedelta(dt, +1))
|
|
76
76
|
|
|
77
77
|
# All Saints' Day.
|
|
78
78
|
name = tr("Pyhäinpäivä")
|
holidays/countries/georgia.py
CHANGED
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
from gettext import gettext as tr
|
|
14
14
|
|
|
15
|
+
from holidays.calendars.gregorian import MAY
|
|
15
16
|
from holidays.calendars.julian import JULIAN_CALENDAR
|
|
16
|
-
from holidays.
|
|
17
|
+
from holidays.constants import GOVERNMENT, PUBLIC
|
|
18
|
+
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
|
|
17
19
|
from holidays.holiday_base import HolidayBase
|
|
18
20
|
|
|
19
21
|
|
|
@@ -27,12 +29,14 @@ class Georgia(HolidayBase, ChristianHolidays, InternationalHolidays):
|
|
|
27
29
|
"""
|
|
28
30
|
|
|
29
31
|
country = "GE"
|
|
32
|
+
supported_categories = (GOVERNMENT, PUBLIC)
|
|
30
33
|
default_language = "ka"
|
|
31
34
|
supported_languages = ("en_US", "ka", "uk")
|
|
32
35
|
|
|
33
36
|
def __init__(self, *args, **kwargs):
|
|
34
37
|
ChristianHolidays.__init__(self, JULIAN_CALENDAR)
|
|
35
38
|
InternationalHolidays.__init__(self)
|
|
39
|
+
StaticHolidays.__init__(self, GeorgiaStaticHolidays)
|
|
36
40
|
super().__init__(*args, **kwargs)
|
|
37
41
|
|
|
38
42
|
def _populate_public_holidays(self):
|
|
@@ -96,3 +100,15 @@ class GE(Georgia):
|
|
|
96
100
|
|
|
97
101
|
class GEO(Georgia):
|
|
98
102
|
pass
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class GeorgiaStaticHolidays:
|
|
106
|
+
"""
|
|
107
|
+
References:
|
|
108
|
+
- https://www.matsne.gov.ge/ka/document/view/6173967
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
special_government_holidays = {
|
|
112
|
+
# Day of Family Sanctity and Respect for Parents.
|
|
113
|
+
2024: (MAY, 17, tr("ოჯახის სიწმინდისა და მშობლების პატივისცემის დღე")),
|
|
114
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# holidays
|
|
2
|
+
# --------
|
|
3
|
+
# A fast, efficient Python library for generating country, province and state
|
|
4
|
+
# specific sets of holidays on the fly. It aims to make determining whether a
|
|
5
|
+
# specific date is a holiday as fast and flexible as possible.
|
|
6
|
+
#
|
|
7
|
+
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
|
|
8
|
+
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
|
|
9
|
+
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
|
|
10
|
+
# Website: https://github.com/vacanza/python-holidays
|
|
11
|
+
# License: MIT (see LICENSE file)
|
|
12
|
+
|
|
13
|
+
from gettext import gettext as tr
|
|
14
|
+
|
|
15
|
+
from holidays.constants import OPTIONAL, PUBLIC
|
|
16
|
+
from holidays.groups import ChristianHolidays, InternationalHolidays
|
|
17
|
+
from holidays.holiday_base import HolidayBase
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Greenland(HolidayBase, ChristianHolidays, InternationalHolidays):
|
|
21
|
+
"""
|
|
22
|
+
Greenlandic holidays.
|
|
23
|
+
|
|
24
|
+
References:
|
|
25
|
+
- https://en.wikipedia.org/wiki/Public_holidays_in_Greenland
|
|
26
|
+
- https://www.norden.org/en/info-norden/public-holidays-greenland
|
|
27
|
+
- https://www.timeanddate.com/holidays/greenland/
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
country = "GL"
|
|
31
|
+
default_language = "kl"
|
|
32
|
+
supported_categories = (OPTIONAL, PUBLIC)
|
|
33
|
+
supported_languages = ("da", "en_US", "kl")
|
|
34
|
+
|
|
35
|
+
def __init__(self, *args, **kwargs):
|
|
36
|
+
ChristianHolidays.__init__(self)
|
|
37
|
+
InternationalHolidays.__init__(self)
|
|
38
|
+
super().__init__(*args, **kwargs)
|
|
39
|
+
|
|
40
|
+
def _populate_public_holidays(self):
|
|
41
|
+
# New Year's Day.
|
|
42
|
+
self._add_new_years_day(tr("Ukioq nutaaq"))
|
|
43
|
+
|
|
44
|
+
# Maundy Thursday.
|
|
45
|
+
self._add_holy_thursday(tr("Sisamanngornermi illernartumi"))
|
|
46
|
+
|
|
47
|
+
# Good Friday.
|
|
48
|
+
self._add_good_friday(tr("Tallimanngorneq ajortorsiorneq"))
|
|
49
|
+
|
|
50
|
+
# Easter Sunday.
|
|
51
|
+
self._add_easter_sunday(tr("Poorskimi"))
|
|
52
|
+
|
|
53
|
+
# Easter Monday.
|
|
54
|
+
self._add_easter_monday(tr("Poorskimi ullut aappaat"))
|
|
55
|
+
|
|
56
|
+
# Great Day of Prayers.
|
|
57
|
+
self._add_holiday_26_days_past_easter(tr("Ulloq qinuffiusoq"))
|
|
58
|
+
|
|
59
|
+
# Ascension Day.
|
|
60
|
+
self._add_ascension_thursday(tr("Ulloq Kristusip qilaliarnera"))
|
|
61
|
+
|
|
62
|
+
# Whit Sunday.
|
|
63
|
+
self._add_whit_sunday(tr("Piinsip ullua"))
|
|
64
|
+
|
|
65
|
+
# Whit Monday.
|
|
66
|
+
self._add_whit_monday(tr("Piinsip ulluisa aappaanni"))
|
|
67
|
+
|
|
68
|
+
# Christmas Day.
|
|
69
|
+
self._add_christmas_day(tr("Juulli"))
|
|
70
|
+
|
|
71
|
+
# Second Day of Christmas.
|
|
72
|
+
self._add_christmas_day_two(tr("Juullip aappaa"))
|
|
73
|
+
|
|
74
|
+
def _populate_optional_holidays(self):
|
|
75
|
+
# Epiphany.
|
|
76
|
+
self._add_epiphany_day(tr("Mitaarneq"))
|
|
77
|
+
|
|
78
|
+
# International Workers' Day.
|
|
79
|
+
self._add_labor_day(tr("Sulisartut ulluat"))
|
|
80
|
+
|
|
81
|
+
# National Day.
|
|
82
|
+
self._add_holiday_jun_21(tr("Ullortuneq"))
|
|
83
|
+
|
|
84
|
+
# Christmas Eve.
|
|
85
|
+
self._add_christmas_eve(tr("Juulliaqqami"))
|
|
86
|
+
|
|
87
|
+
# New Year's Eve.
|
|
88
|
+
self._add_new_years_eve(tr("Ukiortaami"))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class GL(Greenland):
|
|
92
|
+
pass
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class GRL(Greenland):
|
|
96
|
+
pass
|