Skip to content

Commit 7608166

Browse files
authored
Merge pull request vacanza#1814 from vacanza/dev
v0.50
2 parents 89868cf + d18fad9 commit 7608166

155 files changed

Lines changed: 19551 additions & 1076 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- rst
2020

2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.4.4
22+
rev: v0.4.7
2323
hooks:
2424
- id: ruff
2525
- id: ruff-format

‎AUTHORS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Alejandro Antunes
99
Alexander Schulze
1010
Alexandre Carvalho
1111
Anders Wenhaug
12+
Andrei Klimenko
1213
Andres Marrugo
1314
Anthony Rose
1415
Anton Daitche
@@ -52,6 +53,7 @@ Heikki Orsila
5253
Henrik Sozzi
5354
Hugh McNamara
5455
Hugo van Kemenade
56+
Isabelle COWAN-BERGMAN
5557
Jacky Han
5658
Jacob Punter
5759
Jaemin Kim
@@ -124,6 +126,7 @@ Simon Gurcke
124126
Sugato Ray
125127
Sylvain Pasche
126128
Sylvia van Os
129+
Søren Klintrup
127130
Takeshi Osoekawa
128131
Tasnim Nishat Islam
129132
Tewodros Meshesha

‎CHANGES‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
Version 0.50
2+
============
3+
4+
Released June 3, 2024
5+
6+
- Refactor some holidays with uncommon rules (#1807 by @KJhellico)
7+
- Add Greenland holidays (#1811 by @Klintrup, @arkid15r)
8+
- Fix docs: update Italy docstring (#1808 by @arkid15r)
9+
- Update Italy holidays (#1805 by @KJhellico)
10+
- Add 2024 Russian Substituted Holidays (#1799 by @PPsyrius)
11+
- Add Georgian government holiday for May 17, 2024 (#1802 by @PPsyrius, @arkid15r)
12+
- Add v1 future incompatibility warning (#1801 by @arkid15r)
13+
- Migrate Japan holidays to ObservedHolidayBase (#1810 by @KJhellico)
14+
- Synchronize entity dynamic imports (#1794 by @Izzette)
15+
116
Version 0.49
217
============
318

‎README.rst‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Available Countries
146146
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
147147
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
148148

149-
We currently support 147 country codes. The standard way to refer to a country
149+
We currently support 148 country codes. The standard way to refer to a country
150150
is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and
151151
for a subdivision its `ISO 3166-2 code`_. Some countries have common or foreign
152152
names or abbreviations as aliases for their subdivisions. These are defined in
@@ -439,7 +439,7 @@ All other default values are highlighted with bold:
439439
- GE
440440
-
441441
- en_US, **ka**, uk
442-
-
442+
- GOVERNMENT
443443
* - Germany
444444
- DE
445445
- States: BB, BE, BW, BY, BYP, HB, HE, HH, MV, NI, NW, RP, SH, SL, SN, ST, TH
@@ -455,6 +455,11 @@ All other default values are highlighted with bold:
455455
-
456456
- **el**, en_US, uk
457457
- HALF_DAY
458+
* - Greenland
459+
- GL
460+
-
461+
- da, en_US, **kl**
462+
- OPTIONAL
458463
* - Guam
459464
- GU
460465
- Can also be loaded as country US, subdivision GU

‎holidays/__init__.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@
1212

1313
# flake8: noqa: F403
1414

15+
import warnings
16+
1517
from holidays.constants import *
18+
from holidays.deprecation import (
19+
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE,
20+
FutureIncompatibilityWarning,
21+
)
1622
from holidays.holiday_base import *
1723
from holidays.registry import EntityLoader
1824
from holidays.utils import *
1925

20-
__version__ = "0.49"
26+
__version__ = "0.50"
2127

2228

2329
EntityLoader.load("countries", globals())
2430
EntityLoader.load("financial", globals())
31+
32+
warnings.warn(
33+
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE.format(version=__version__),
34+
FutureIncompatibilityWarning,
35+
)

‎holidays/countries/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
from .germany import Germany, DE, DEU
6868
from .ghana import Ghana, GH, GHA
6969
from .greece import Greece, GR, GRC
70+
from .greenland import Greenland, GL, GRL
7071
from .guam import Guam, GU, GUM, HolidaysGU
7172
from .guatemala import Guatemala, GT, GUA
7273
from .honduras import Honduras, HN, HND

‎holidays/countries/botswana.py‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212

1313
from holidays.calendars.gregorian import JUL
1414
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
15-
from holidays.observed_holiday_base import ObservedHolidayBase, SUN_TO_NEXT_MON, SUN_TO_NEXT_TUE
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+
)
1621

1722

1823
class Botswana(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
@@ -41,16 +46,19 @@ def _populate_public_holidays(self):
4146
self._add_observed(self._add_new_years_day("New Year's Day"), rule=SUN_TO_NEXT_TUE)
4247
self._add_observed(self._add_new_years_day_two("New Year's Day Holiday"))
4348

44-
# Easter and easter related calculations
4549
self._add_good_friday("Good Friday")
50+
4651
self._add_holy_saturday("Holy Saturday")
52+
4753
self._add_easter_monday("Easter Monday")
48-
self._add_ascension_thursday("Ascension Day")
4954

50-
may_1 = self._add_labor_day("Labour Day")
51-
self._add_observed(may_1)
52-
if self.observed and self._year >= 2016 and self._is_saturday(may_1):
53-
self._add_labor_day_three("Labour Day Holiday")
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")
5462

5563
self._add_observed(self._add_holiday_jul_1("Sir Seretse Khama Day"))
5664

@@ -63,8 +71,10 @@ def _populate_public_holidays(self):
6371
self._add_observed(self._add_christmas_day("Christmas Day"), rule=SUN_TO_NEXT_TUE)
6472
self._add_observed(dec_26 := self._add_christmas_day_two("Boxing Day"))
6573

66-
if self.observed and self._year >= 2016 and self._is_saturday(dec_26):
67-
self._add_holiday_dec_28("Boxing Day Holiday")
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+
)
6878

6979

7080
class BW(Botswana):

‎holidays/countries/chile.py‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
1818
from holidays.observed_holiday_base import (
1919
ObservedHolidayBase,
20+
MON_ONLY,
21+
MON_FRI_ONLY,
2022
TUE_TO_PREV_FRI,
2123
WED_TO_NEXT_FRI,
24+
FRI_ONLY,
2225
WORKDAY_TO_NEAREST_MON,
2326
)
2427

@@ -84,9 +87,9 @@ def _populate_public_holidays(self):
8487
return None
8588

8689
# New Year's Day.
87-
jan_1 = self._add_new_years_day(tr("Año Nuevo"))
88-
if self._year >= 2017 and self._is_sunday(jan_1):
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)
9093

9194
# Good Friday.
9295
self._add_good_friday(tr("Viernes Santo"))
@@ -141,21 +144,21 @@ def _populate_public_holidays(self):
141144
tr("Día de la Unidad Nacional")
142145
)
143146

144-
if self._year >= 2017 and self._is_saturday(SEP, 18):
145-
# National Holiday.
146-
self._add_holiday_sep_17(tr("Fiestas Patrias"))
147-
148-
if self._year >= 2007 and self._is_tuesday(SEP, 18):
149-
self._add_holiday_sep_17(tr("Fiestas Patrias"))
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+
)
150153

151154
# Independence Day.
152155
self._add_holiday_sep_18(tr("Día de la Independencia"))
153156

154157
# Army Day.
155158
self._add_holiday_sep_19(tr("Día de las Glorias del Ejército"))
156159

157-
if self._year >= 2008 and self._is_thursday(SEP, 19):
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)
159162

160163
if 1932 <= self._year <= 1944:
161164
self._add_holiday_sep_20(tr("Fiestas Patrias"))

‎holidays/countries/georgia.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
from gettext import gettext as tr
1414

15+
from holidays.calendars.gregorian import MAY
1516
from holidays.calendars.julian import JULIAN_CALENDAR
16-
from holidays.groups import ChristianHolidays, InternationalHolidays
17+
from holidays.constants import GOVERNMENT, PUBLIC
18+
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
1719
from holidays.holiday_base import HolidayBase
1820

1921

@@ -27,12 +29,14 @@ class Georgia(HolidayBase, ChristianHolidays, InternationalHolidays):
2729
"""
2830

2931
country = "GE"
32+
supported_categories = (GOVERNMENT, PUBLIC)
3033
default_language = "ka"
3134
supported_languages = ("en_US", "ka", "uk")
3235

3336
def __init__(self, *args, **kwargs):
3437
ChristianHolidays.__init__(self, JULIAN_CALENDAR)
3538
InternationalHolidays.__init__(self)
39+
StaticHolidays.__init__(self, GeorgiaStaticHolidays)
3640
super().__init__(*args, **kwargs)
3741

3842
def _populate_public_holidays(self):
@@ -96,3 +100,15 @@ class GE(Georgia):
96100

97101
class GEO(Georgia):
98102
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+
}

‎holidays/countries/greenland.py‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)