Skip to content

Commit

Permalink
Merge pull request #1814 from vacanza/dev
Browse files Browse the repository at this point in the history
v0.50
  • Loading branch information
arkid15r committed Jun 3, 2024
2 parents 89868cf + d18fad9 commit 7608166
Show file tree
Hide file tree
Showing 155 changed files with 19,551 additions and 1,076 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- rst

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
rev: v0.4.7
hooks:
- id: ruff
- id: ruff-format
Expand Down
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Alejandro Antunes
Alexander Schulze
Alexandre Carvalho
Anders Wenhaug
Andrei Klimenko
Andres Marrugo
Anthony Rose
Anton Daitche
Expand Down Expand Up @@ -52,6 +53,7 @@ Heikki Orsila
Henrik Sozzi
Hugh McNamara
Hugo van Kemenade
Isabelle COWAN-BERGMAN
Jacky Han
Jacob Punter
Jaemin Kim
Expand Down Expand Up @@ -124,6 +126,7 @@ Simon Gurcke
Sugato Ray
Sylvain Pasche
Sylvia van Os
Søren Klintrup
Takeshi Osoekawa
Tasnim Nishat Islam
Tewodros Meshesha
Expand Down
15 changes: 15 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Version 0.50
============

Released June 3, 2024

- Refactor some holidays with uncommon rules (#1807 by @KJhellico)
- Add Greenland holidays (#1811 by @Klintrup, @arkid15r)
- Fix docs: update Italy docstring (#1808 by @arkid15r)
- Update Italy holidays (#1805 by @KJhellico)
- Add 2024 Russian Substituted Holidays (#1799 by @PPsyrius)
- Add Georgian government holiday for May 17, 2024 (#1802 by @PPsyrius, @arkid15r)
- Add v1 future incompatibility warning (#1801 by @arkid15r)
- Migrate Japan holidays to ObservedHolidayBase (#1810 by @KJhellico)
- Synchronize entity dynamic imports (#1794 by @Izzette)

Version 0.49
============

Expand Down
9 changes: 7 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Available Countries
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

We currently support 147 country codes. The standard way to refer to a country
We currently support 148 country codes. The standard way to refer to a country
is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and
for a subdivision its `ISO 3166-2 code`_. Some countries have common or foreign
names or abbreviations as aliases for their subdivisions. These are defined in
Expand Down Expand Up @@ -439,7 +439,7 @@ All other default values are highlighted with bold:
- GE
-
- en_US, **ka**, uk
-
- GOVERNMENT
* - Germany
- DE
- States: BB, BE, BW, BY, BYP, HB, HE, HH, MV, NI, NW, RP, SH, SL, SN, ST, TH
Expand All @@ -455,6 +455,11 @@ All other default values are highlighted with bold:
-
- **el**, en_US, uk
- HALF_DAY
* - Greenland
- GL
-
- da, en_US, **kl**
- OPTIONAL
* - Guam
- GU
- Can also be loaded as country US, subdivision GU
Expand Down
13 changes: 12 additions & 1 deletion holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@

# flake8: noqa: F403

import warnings

from holidays.constants import *
from holidays.deprecation import (
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE,
FutureIncompatibilityWarning,
)
from holidays.holiday_base import *
from holidays.registry import EntityLoader
from holidays.utils import *

__version__ = "0.49"
__version__ = "0.50"


EntityLoader.load("countries", globals())
EntityLoader.load("financial", globals())

warnings.warn(
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE.format(version=__version__),
FutureIncompatibilityWarning,
)
1 change: 1 addition & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from .germany import Germany, DE, DEU
from .ghana import Ghana, GH, GHA
from .greece import Greece, GR, GRC
from .greenland import Greenland, GL, GRL
from .guam import Guam, GU, GUM, HolidaysGU
from .guatemala import Guatemala, GT, GUA
from .honduras import Honduras, HN, HND
Expand Down
28 changes: 19 additions & 9 deletions holidays/countries/botswana.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@

from holidays.calendars.gregorian import JUL
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import ObservedHolidayBase, SUN_TO_NEXT_MON, SUN_TO_NEXT_TUE
from holidays.observed_holiday_base import (
ObservedHolidayBase,
SAT_TO_NEXT_MON,
SUN_TO_NEXT_MON,
SUN_TO_NEXT_TUE,
)


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

# Easter and easter related calculations
self._add_good_friday("Good Friday")

self._add_holy_saturday("Holy Saturday")

self._add_easter_monday("Easter Monday")
self._add_ascension_thursday("Ascension Day")

may_1 = self._add_labor_day("Labour Day")
self._add_observed(may_1)
if self.observed and self._year >= 2016 and self._is_saturday(may_1):
self._add_labor_day_three("Labour Day Holiday")
self._add_observed(may_1 := self._add_labor_day("Labour Day"))
if self._year >= 2016:
self._add_observed(
may_1, name="Labour Day Holiday", rule=SAT_TO_NEXT_MON, show_observed_label=False
)

self._add_ascension_thursday("Ascension Day")

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

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

if self.observed and self._year >= 2016 and self._is_saturday(dec_26):
self._add_holiday_dec_28("Boxing Day Holiday")
if self._year >= 2016:
self._add_observed(
dec_26, name="Boxing Day Holiday", rule=SAT_TO_NEXT_MON, show_observed_label=False
)


class BW(Botswana):
Expand Down
25 changes: 14 additions & 11 deletions holidays/countries/chile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
MON_ONLY,
MON_FRI_ONLY,
TUE_TO_PREV_FRI,
WED_TO_NEXT_FRI,
FRI_ONLY,
WORKDAY_TO_NEAREST_MON,
)

Expand Down Expand Up @@ -84,9 +87,9 @@ def _populate_public_holidays(self):
return None

# New Year's Day.
jan_1 = self._add_new_years_day(tr("Año Nuevo"))
if self._year >= 2017 and self._is_sunday(jan_1):
self._add_new_years_day_two(tr("Feriado nacional"))
self._add_new_years_day(tr("Año Nuevo"))
if self._year >= 2017:
self._add_observed(self._add_new_years_day_two(tr("Feriado nacional")), rule=MON_ONLY)

# Good Friday.
self._add_good_friday(tr("Viernes Santo"))
Expand Down Expand Up @@ -141,21 +144,21 @@ def _populate_public_holidays(self):
tr("Día de la Unidad Nacional")
)

if self._year >= 2017 and self._is_saturday(SEP, 18):
# National Holiday.
self._add_holiday_sep_17(tr("Fiestas Patrias"))

if self._year >= 2007 and self._is_tuesday(SEP, 18):
self._add_holiday_sep_17(tr("Fiestas Patrias"))
if self._year >= 2007:
self._add_observed(
# National Holiday.
self._add_holiday_sep_17(tr("Fiestas Patrias")),
rule=MON_FRI_ONLY if self._year >= 2017 else MON_ONLY,
)

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

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

if self._year >= 2008 and self._is_thursday(SEP, 19):
self._add_holiday_sep_20(tr("Fiestas Patrias"))
if self._year >= 2008:
self._add_observed(self._add_holiday_sep_20(tr("Fiestas Patrias")), rule=FRI_ONLY)

if 1932 <= self._year <= 1944:
self._add_holiday_sep_20(tr("Fiestas Patrias"))
Expand Down
18 changes: 17 additions & 1 deletion holidays/countries/georgia.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

from gettext import gettext as tr

from holidays.calendars.gregorian import MAY
from holidays.calendars.julian import JULIAN_CALENDAR
from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.constants import GOVERNMENT, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.holiday_base import HolidayBase


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

country = "GE"
supported_categories = (GOVERNMENT, PUBLIC)
default_language = "ka"
supported_languages = ("en_US", "ka", "uk")

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self, JULIAN_CALENDAR)
InternationalHolidays.__init__(self)
StaticHolidays.__init__(self, GeorgiaStaticHolidays)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
Expand Down Expand Up @@ -96,3 +100,15 @@ class GE(Georgia):

class GEO(Georgia):
pass


class GeorgiaStaticHolidays:
"""
References:
- https://www.matsne.gov.ge/ka/document/view/6173967
"""

special_government_holidays = {
# Day of Family Sanctity and Respect for Parents.
2024: (MAY, 17, tr("ოჯახის სიწმინდისა და მშობლების პატივისცემის დღე")),
}
96 changes: 96 additions & 0 deletions holidays/countries/greenland.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see AUTHORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)

from gettext import gettext as tr

from holidays.constants import OPTIONAL, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.holiday_base import HolidayBase


class Greenland(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
Greenlandic holidays.
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_Greenland
- https://www.norden.org/en/info-norden/public-holidays-greenland
- https://www.timeanddate.com/holidays/greenland/
"""

country = "GL"
default_language = "kl"
supported_categories = (OPTIONAL, PUBLIC)
supported_languages = ("da", "en_US", "kl")

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# New Year's Day.
self._add_new_years_day(tr("Ukioq nutaaq"))

# Maundy Thursday.
self._add_holy_thursday(tr("Sisamanngornermi illernartumi"))

# Good Friday.
self._add_good_friday(tr("Tallimanngorneq ajortorsiorneq"))

# Easter Sunday.
self._add_easter_sunday(tr("Poorskimi"))

# Easter Monday.
self._add_easter_monday(tr("Poorskimi ullut aappaat"))

# Great Day of Prayers.
self._add_holiday_26_days_past_easter(tr("Ulloq qinuffiusoq"))

# Ascension Day.
self._add_ascension_thursday(tr("Ulloq Kristusip qilaliarnera"))

# Whit Sunday.
self._add_whit_sunday(tr("Piinsip ullua"))

# Whit Monday.
self._add_whit_monday(tr("Piinsip ulluisa aappaanni"))

# Christmas Day.
self._add_christmas_day(tr("Juulli"))

# Second Day of Christmas.
self._add_christmas_day_two(tr("Juullip aappaa"))

def _populate_optional_holidays(self):
# Epiphany.
self._add_epiphany_day(tr("Mitaarneq"))

# International Workers' Day.
self._add_labor_day(tr("Sulisartut ulluat"))

# National Day.
self._add_holiday_jun_21(tr("Ullortuneq"))

# Christmas Eve.
self._add_christmas_eve(tr("Juulliaqqami"))

# New Year's Eve.
self._add_new_years_eve(tr("Ukiortaami"))


class GL(Greenland):
pass


class GRL(Greenland):
pass
11 changes: 3 additions & 8 deletions holidays/countries/isle_of_man.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)

from datetime import date

from holidays.calendars.gregorian import JUL
from holidays.countries.united_kingdom import UnitedKingdom, UnitedKingdomStaticHolidays
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import ObservedHolidayBase, SAT_SUN_TO_NEXT_MON
Expand Down Expand Up @@ -50,11 +47,9 @@ def _populate_public_holidays(self) -> None:

# Tynwald Day
# Move to the next Monday if falls on a weekend.
dt = date(self._year, JUL, 5)
self._add_holiday(
"Tynwald Day",
self._get_observed_date(dt, SAT_SUN_TO_NEXT_MON) if self._year >= 1992 else dt,
)
jul_5 = self._add_holiday_jul_5("Tynwald Day")
if self._year >= 1992:
self._move_holiday(jul_5, show_observed_label=False)


class IM(IsleOfMan):
Expand Down
Loading

0 comments on commit 7608166

Please sign in to comment.