Skip to content

Commit

Permalink
Merge pull request #2105 from vacanza/dev
Browse files Browse the repository at this point in the history
v0.60
  • Loading branch information
arkid15r authored Nov 4, 2024
2 parents 3182537 + 89fecea commit 56dd60b
Show file tree
Hide file tree
Showing 333 changed files with 5,406 additions and 3,296 deletions.
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ Your PR description goes here.
-->

- [ ] I've followed the [contributing guidelines][contributing-guidelines]
- [ ] I've run `make pre-commit`, it didn't generate any changes
- [ ] I've run `make test`, all tests passed locally
- [ ] I've successfully run `make check`, all checks and tests are green

<!--
Thanks again for your contribution!
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ repos:
- rst

- repo: https://github.com/asottile/pyupgrade
rev: v3.18.0
rev: v3.19.0
hooks:
- id: pyupgrade
args:
- --py39-plus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.7.2
hooks:
- id: ruff
- id: ruff-format
Expand Down Expand Up @@ -54,7 +54,7 @@ repos:
exclude: ^(docs)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.12.1
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
26 changes: 26 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
Version 0.60
============

Released November 4, 2024

- Refactor Australia tests (#2088 by @KJhellico)
- Refactor Cambodia and Laos test cases (#2086 by @PPsyrius)
- Refactor Canada tests (#2084 by @KJhellico)
- Refactor United States tests (#2087 by @KJhellico)
- Refactor v1 incompatibility warning (#2100 by @arkid15r)
- Update the Philippines holidays: add `en_PH`, `en_US`, `fil`, `th` localization (#2093 by @PPsyrius, @arkid15r)
- Fix `make l10n` removing loc comment for Asarnha Bucha (#2091 by @PPsyrius)
- Fixed Thai Calendar test case coverage (#2090 by @PPsyrius)
- Improve .po files "Language-Team" header consistency (#2098 by @arkid15r)
- Update Albania holidays, add l10n support (#2104 by @KJhellico)
- Update Australia holidays: remove `Adelaide Cup Day` holiday pre-1973 for South Australia (#2082 by @PPsyrius)
- Update CONTRIBUTING.rst (#2085 by @arkid15r)
- Update Germany holidays: add East German Uprising Day 2028 in Berlin (#2092 by @PPsyrius)
- Update Indonesia holidays: `th` localization, more refractor (#2097 by @PPsyrius)
- Update Indonesia holidays: add 2024 Local Election, exact historic dates from 1963 onwards (#2102 by @PPsyrius)
- Update Spain holidays in 2025 (#2080 by @KJhellico)
- Update Thailand holidays in 2025 (#2081 by @PPsyrius)
- Update Timor-Leste holidays (#2078 by @KJhellico)
- Update United States holidays: Alaska state holidays correction (#2083 by @PPsyrius)
- Simplify PR template (#2099 by @arkid15r)

Version 0.59
============

Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ Basics

When contributing with fixes and new features, please start forking/branching
from the `dev branch`_ to work on the latest code and reduce merging issues.
If you add/change holiday official dates or names you must include references to
If you add/change holiday official dates or names your code must include references to
all sources (government sites, archived web pages, wiki pages, etc) you've used
while working on this PR. Contributed PRs_ are required to include valid test
while working on this PR. That could be done either as a ``References`` section update or
as a comment on the relevant part of the code. Contributed PRs_ are required to include valid test
coverage in order to be merged. Please don't hesitate to ask for help if you
need one with the tests.

Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ All other default values are highlighted with bold:
* - Albania
- AL
-
-
- en_US, **sq**, uk
-
* - Algeria
- DZ
Expand Down Expand Up @@ -513,7 +513,7 @@ All other default values are highlighted with bold:
* - Indonesia
- ID
-
- en_US, **id**, uk
- en_US, **id**, th, uk
- GOVERNMENT
* - Iran
- IR
Expand Down Expand Up @@ -748,8 +748,8 @@ All other default values are highlighted with bold:
* - Philippines
- PH
-
-
-
- **en_PH**, en_US, fil, th
- WORKDAY
* - Poland
- PL
-
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ How to release a new version of Holidays
- send "Holidays 'v<version>' has been released!" (or similar) message
to Vacanza Team Slack #release channel
- pull the recent changes from ``main`` branch into ``dev``
- bump the Holidays version at ``holidays/__init__.py`` file
- bump the Holidays version at ``holidays/version.py`` file
- create a commit with 'Initialize v<version>' message, e.g.
'Initialize v0.40' and push it to ``dev`` branch (this may require
running ``make package`` to pass the tests locally)
Expand Down
18 changes: 3 additions & 15 deletions holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,14 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

# flake8: noqa: F403

import warnings
# ruff: noqa: F403

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

__version__ = "0.59"

from holidays.version import __version__ # noqa: F401

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

warnings.warn(
FUTURE_INCOMPATIBILITY_WARNING_TEMPLATE.format(version=__version__),
FutureIncompatibilityWarning,
)
108 changes: 81 additions & 27 deletions holidays/countries/albania.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from holidays.calendars.gregorian import JAN, MAR
from gettext import gettext as tr

from holidays.calendars import _CustomIslamicHolidays
from holidays.calendars.gregorian import JAN, MAR, APR, MAY, JUN, JUL, AUG
from holidays.calendars.julian import JULIAN_CALENDAR
from holidays.groups import (
ChristianHolidays,
Expand All @@ -26,67 +29,89 @@ class Albania(
):
"""
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_Albania
- https://en.wikipedia.org/wiki/Public_holidays_in_Albania
- `Law No. 7651 <http://kqk.gov.al/sites/default/files/publikime/ligj_7651_-_per_festat_zyrtare_e_ditet_perkujtimore.pdf>`_
- `Holidays for 2018–2024 <https://www.bankofalbania.org/Shtypi/Kalendari_i_festave_zyrtare_2024/>`_
"""

country = "AL"
observed_label = "%s (observed)"
default_language = "sq"
# %s (estimated).
estimated_label = tr("%s (e vlerësuar)")
# %s (observed).
observed_label = tr("%s (ditë pushimi e shtyrë)")
# %s (observed, estimated).
observed_estimated_label = tr("%s (ditë pushimi e shtyrë, e vlerësuar)")
supported_languages = ("en_US", "sq", "uk")

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(self)
IslamicHolidays.__init__(self, AlbaniaIslamicHolidays)
StaticHolidays.__init__(self, AlbaniaStaticHolidays)
kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_WORKDAY)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Law No. 7651 from 21.12.1992.
if self._year <= 1992:
return None

dts_observed = set()

# New Year's Day.
name = "New Year's Day"
name = tr("Festat e Vitit të Ri")
dts_observed.add(self._add_new_years_day(name))
dts_observed.add(self._add_new_years_day_two(name))

# Summer Day.
if self._year >= 2004:
dts_observed.add(self._add_holiday_mar_14("Summer Day"))
# Summer Day.
dts_observed.add(self._add_holiday_mar_14(tr("Dita e Verës")))

# Nevruz.
if self._year >= 1996:
dts_observed.add(self._add_holiday_mar_22("Nevruz"))
# Nowruz Day.
dts_observed.add(self._add_holiday_mar_22(tr("Dita e Nevruzit")))

# Catholic Easter Sunday.
dts_observed.add(self._add_easter_sunday(tr("E diela e Pashkëve Katolike")))

# Easter.
dts_observed.add(self._add_easter_sunday("Catholic Easter"))
dts_observed.add(self._add_easter_sunday("Orthodox Easter", JULIAN_CALENDAR))
dts_observed.add(
# Orthodox Easter Sunday.
self._add_easter_sunday(tr("E diela e Pashkëve Ortodokse"), JULIAN_CALENDAR)
)

# May Day.
dts_observed.add(self._add_labor_day("May Day"))
# International Workers' Day.
dts_observed.add(self._add_labor_day(tr("Dita Ndërkombëtare e Punëtorëve")))

# Mother Teresa Day.
if 2004 <= self._year <= 2017:
dts_observed.add(self._add_holiday_oct_19("Mother Teresa Beatification Day"))
# Mother Teresa Beatification Day.
dts_observed.add(self._add_holiday_oct_19(tr("Dita e Lumturimit të Shenjt Terezës")))
elif self._year >= 2018:
dts_observed.add(self._add_holiday_sep_5("Mother Teresa Canonization Day"))
# Mother Teresa Canonization Day.
dts_observed.add(self._add_holiday_sep_5(tr("Dita e Shenjtërimit të Shenjt Terezës")))

# Independence Day.
dts_observed.add(self._add_holiday_nov_28("Independence Day"))
if self._year >= 2024:
# Alphabet Day.
dts_observed.add(self._add_holiday_nov_22(tr("Dita e Alfabetit")))

# Flag and Independence Day.
dts_observed.add(self._add_holiday_nov_28(tr("Dita Flamurit dhe e Pavarësisë")))

# Liberation Day.
dts_observed.add(self._add_holiday_nov_29("Liberation Day"))
dts_observed.add(self._add_holiday_nov_29(tr("Dita e Çlirimit")))

# National Youth Day.
if self._year >= 2009:
dts_observed.add(self._add_holiday_dec_8("National Youth Day"))
# National Youth Day.
dts_observed.add(self._add_holiday_dec_8(tr("Dita Kombëtare e Rinisë")))

# Christmas Day.
dts_observed.add(self._add_christmas_day("Christmas Day"))
dts_observed.add(self._add_christmas_day(tr("Krishtlindjet")))

# Eid al-Fitr.
dts_observed.update(self._add_eid_al_fitr_day("Eid al-Fitr"))
dts_observed.update(self._add_eid_al_fitr_day(tr("Dita e Bajramit të Madh")))

# Eid al-Adha.
dts_observed.update(self._add_eid_al_adha_day("Eid al-Adha"))
dts_observed.update(self._add_eid_al_adha_day(tr("Dita e Kurban Bajramit")))

if self.observed:
self._populate_observed(dts_observed)
Expand All @@ -100,11 +125,40 @@ class ALB(Albania):
pass


class AlbaniaIslamicHolidays(_CustomIslamicHolidays):
EID_AL_ADHA_DATES = {
2018: (AUG, 21),
2019: (AUG, 11),
2020: (JUL, 31),
2021: (JUL, 20),
2022: (JUL, 9),
2023: (JUN, 28),
2024: (JUN, 16),
2025: (JUN, 6),
}

EID_AL_FITR_DATES = {
2018: (JUN, 15),
2019: (JUN, 4),
2020: (MAY, 24),
2021: (MAY, 13),
2022: (MAY, 2),
2023: (APR, 21),
2024: (APR, 10),
2025: (MAR, 30),
}


class AlbaniaStaticHolidays:
# Public Holiday.
public_holiday = tr("Ditë pushimi")

special_public_holidays = {
2022: (MAR, 21, "Public Holiday"),
2020: (JAN, 3, public_holiday),
2022: (MAR, 21, public_holiday),
2024: (MAR, 15, public_holiday),
}

special_public_holidays_observed = {
2007: (JAN, 3, "Eid al-Adha"),
2007: (JAN, 3, tr("Dita e Kurban Bajramit")),
}
3 changes: 2 additions & 1 deletion holidays/countries/australia.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ def _populate_subdiv_sa_public_holidays(self):
self._add_holiday_jan_26(name)

# Adelaide Cup Day.
# First observed as Public Holidays in 1973: https://racingsa.com.au/blog/2020/03/06/2380/a-little-adelaide-cup-history
# 2006-2023: changed each year by SA Government Proclamation from the 3rd Monday in May
# to the 2nd Monday in March.
# from 2024: changed to the 2nd Monday in March officially.
Expand All @@ -609,7 +610,7 @@ def _populate_subdiv_sa_public_holidays(self):
name = tr("Adelaide Cup Day")
if self._year >= 2006:
self._add_holiday_2nd_mon_of_mar(name)
else:
elif self._year >= 1973:
self._add_holiday_3rd_mon_of_may(name)

# Easter Saturday.
Expand Down
12 changes: 5 additions & 7 deletions holidays/countries/cambodia.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,9 @@ def _populate_public_holidays(self):
# Pchum Ben Day
pchum_ben = tr("ពិធីបុណ្យភ្ផុំបិណ្ឌ")
pchum_ben_date = self._add_pchum_ben(pchum_ben)
if pchum_ben_date:
self._add_holiday(pchum_ben, _timedelta(pchum_ben_date, -1))
if self._year >= 2017:
self._add_holiday(pchum_ben, _timedelta(pchum_ben_date, +1))
self._add_holiday(pchum_ben, _timedelta(pchum_ben_date, -1))
if self._year >= 2017:
self._add_holiday(pchum_ben, _timedelta(pchum_ben_date, +1))

# ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក
# Status: In-Use.
Expand All @@ -276,9 +275,8 @@ def _populate_public_holidays(self):
# Water Festival
bon_om_touk = tr("ព្រះរាជពិធីបុណ្យអុំទូក បណ្តែតប្រទីប និងសំពះព្រះខែអកអំបុក")
bon_om_touk_date = self._add_loy_krathong(bon_om_touk)
if bon_om_touk_date:
self._add_holiday(bon_om_touk, _timedelta(bon_om_touk_date, -1))
self._add_holiday(bon_om_touk, _timedelta(bon_om_touk_date, +1))
self._add_holiday(bon_om_touk, _timedelta(bon_om_touk_date, -1))
self._add_holiday(bon_om_touk, _timedelta(bon_om_touk_date, +1))


class KH(Cambodia):
Expand Down
11 changes: 10 additions & 1 deletion holidays/countries/germany.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from gettext import gettext as tr

from holidays.calendars.gregorian import MAY, OCT
from holidays.calendars.gregorian import MAY, JUN, OCT
from holidays.constants import CATHOLIC, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.holiday_base import HolidayBase
Expand Down Expand Up @@ -304,6 +304,13 @@ class DEU(Germany):


class GermanyStaticHolidays:
"""
References:
- https://www.stuttgarter-zeitung.de/inhalt.reformationstag-2017-einmalig-bundesweiter-feiertag.b7e189b3-a33d-41a3-a0f4-141cd13df54e.html
- https://www.bbc.com/news/world-europe-52574748
- https://gesetze.berlin.de/bsbe/document/jlr-FeiertGBEV8P1
"""

special_public_holidays = {
2017: (OCT, 31, tr("Reformationstag")),
}
Expand All @@ -329,4 +336,6 @@ class GermanyStaticHolidays:
"und der Beendigung des Zweiten Weltkriegs in Europa"
),
),
# 75th anniversary of the East German uprising of 1953.
2028: (JUN, 17, tr("75. Jahrestag des Aufstandes vom 17. Juni 1953")),
}
Loading

0 comments on commit 56dd60b

Please sign in to comment.