Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.43 #1697

Merged
merged 10 commits into from
Feb 19, 2024
Merged

v0.43 #1697

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
python-version: '3.11'

- name: Run pre-commit
uses: pre-commit/[email protected].0
uses: pre-commit/[email protected].1

test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
Expand Down
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.2.0
rev: v0.2.2
hooks:
- id: ruff
- id: ruff-format
Expand Down
11 changes: 11 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
Version 0.43
============

Released February 19, 2024

- Introduce subdivisions aliases (#1662 by @sphh, @arkid15r)
- Update Ireland holidays (#1687 by @KJhellico)
- Update Portugal holidays: fix Carnival date (#1694 by @DgRosa)
- Update Taiwan holidays (#1688 by @KJhellico)
- Update Thailand holidays: add Bridge Public Holiday on Apr 12, 2024 (#1690 by @PPsyrius)

Version 0.42
============

Expand Down
13 changes: 8 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ Available Countries

We currently support 143 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 of the countries support more
than one language for holiday names output.
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
the (optional) ``subdivisions_aliases`` attribute.
Some of the countries support more than one language for holiday names output.
A default language is defined by ``default_language`` (optional) attribute
for each entity and is used as a fallback when neither user specified
language nor user locale language available. The default language code is
Expand All @@ -158,8 +160,9 @@ bank holidays, school holidays, additional (paid or non-paid) holidays, holidays
public employees, religious holidays (valid only for these religions followers). A list of all
categories supported by country is defined by ``supported_categories`` (optional) attribute.

The following is a list of supported countries, their subdivisions, available languages and
additional categories. All countries support **PUBLIC** holidays category by default.
The following is a list of supported countries, their subdivisions followed by their
aliases (if any) in brackets, available languages and additional holiday categories.
All countries support **PUBLIC** holidays category by default.
All other default values are highlighted with bold:


Expand Down Expand Up @@ -220,7 +223,7 @@ All other default values are highlighted with bold:
-
* - Austria
- AT
- States: 1, 2, 3, 4, 5, 6, 7, 8, **9**
- States: 1 (Burgenland, Bgld, B), 2 (Kärnten, Ktn, K), 3 (Niederösterreich, NÖ, N), 4 (Oberösterreich, OÖ, O), 5 (Salzburg, Sbg, S), 6 (Steiermark, Stmk, St), 7 (Tirol, T), 8 (Vorarlberg, Vbg, V), 9 (Wien, W)
- **de**, en_US, uk
- BANK
* - Azerbaijan
Expand Down
2 changes: 1 addition & 1 deletion holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from holidays.registry import EntityLoader
from holidays.utils import *

__version__ = "0.42"
__version__ = "0.43"


EntityLoader.load("countries", globals())
Expand Down
91 changes: 82 additions & 9 deletions holidays/countries/austria.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,48 @@ class Austria(HolidayBase, ChristianHolidays, InternationalHolidays):
default_language = "de"
supported_categories = (BANK, PUBLIC)
supported_languages = ("de", "en_US", "uk")
subdivisions = ("1", "2", "3", "4", "5", "6", "7", "8", "9")
subdivisions = (
"1", # Burgenland.
"2", # Kärnten.
"3", # Niederösterreich.
"4", # Oberösterreich.
"5", # Salzburg.
"6", # Steiermark.
"7", # Tirol.
"8", # Vorarlberg.
"9", # Wien.
)
subdivisions_aliases = {
"Burgenland": "1",
"Bgld": "1",
"B": "1",
"Kärnten": "2",
"Ktn": "2",
"K": "2",
"Niederösterreich": "3",
"NÖ": "3",
"N": "3",
"Oberösterreich": "4",
"OÖ": "4",
"O": "4",
"Salzburg": "5",
"Sbg": "5",
"S": "5",
"Steiermark": "6",
"Stmk": "6",
"St": "6",
"Tirol": "7",
"T": "7",
"Vorarlberg": "8",
"Vbg": "8",
"V": "8",
"Wien": "9",
"W": "9",
}

def __init__(self, *args, **kwargs) -> None:
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)

# Set the default subdivision.
if not kwargs.get("subdiv", kwargs.get("state")):
kwargs["subdiv"] = "9"

super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
Expand Down Expand Up @@ -58,11 +90,12 @@ def _populate_public_holidays(self):
# Assumption Day.
self._add_assumption_of_mary_day(tr("Mariä Himmelfahrt"))

# National Day.
national_day = tr("Nationalfeiertag")
if 1919 <= self._year <= 1934:
# National Day.
self._add_holiday_nov_12(tr("Nationalfeiertag"))
self._add_holiday_nov_12(national_day)
if self._year >= 1967:
self._add_holiday_oct_26(tr("Nationalfeiertag"))
self._add_holiday_oct_26(national_day)

# All Saints' Day.
self._add_all_saints_day(tr("Allerheiligen"))
Expand All @@ -86,6 +119,46 @@ def _populate_bank_holidays(self):
# New Year's Eve.
self._add_new_years_eve(tr("Silvester"))

def _populate_subdiv_1_bank_holidays(self):
# St. Martin's Day.
self._add_holiday_nov_11(tr("Hl. Martin"))

def _populate_subdiv_2_bank_holidays(self):
# St. Joseph's Day.
self._add_saint_josephs_day(tr("Hl. Josef"))

# 1920 Carinthian plebiscite.
self._add_holiday_oct_10(tr("Tag der Volksabstimmung"))

def _populate_subdiv_3_bank_holidays(self):
# St. Leopold's Day.
self._add_holiday_nov_15(tr("Hl. Leopold"))

def _populate_subdiv_4_bank_holidays(self):
if self._year >= 2004:
# St. Florian's Day.
self._add_holiday_may_4(tr("Hl. Florian"))

def _populate_subdiv_5_bank_holidays(self):
# St. Rupert's Day.
self._add_holiday_sep_24(tr("Hl. Rupert"))

def _populate_subdiv_6_bank_holidays(self):
# St. Joseph's Day.
self._add_saint_josephs_day(tr("Hl. Josef"))

def _populate_subdiv_7_bank_holidays(self):
# St. Joseph's Day.
self._add_saint_josephs_day(tr("Hl. Josef"))

def _populate_subdiv_8_bank_holidays(self):
# St. Joseph's Day.
self._add_saint_josephs_day(tr("Hl. Josef"))

def _populate_subdiv_9_bank_holidays(self):
# St. Leopold's Day.
self._add_holiday_nov_15(tr("Hl. Leopold"))


class AT(Austria):
pass
Expand Down
50 changes: 27 additions & 23 deletions holidays/countries/ireland.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,33 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.calendars.gregorian import FEB, MAR
from holidays.calendars.gregorian import FEB, MAR, SEP, DEC
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
SAT_SUN_TO_NEXT_MON,
SAT_SUN_TO_NEXT_MON_TUE,
)
from holidays.holiday_base import HolidayBase


class Ireland(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
class Ireland(HolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
"""
Official holidays in Ireland, as declared in the Citizen's Information
bulletin:
https://www.citizensinformation.ie/en/employment/employment_rights_and_conditions/leave_and_holidays/public_holidays_in_ireland.html
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_the_Republic_of_Ireland
- https://www.citizensinformation.ie/en/employment/employment_rights_and_conditions/leave_and_holidays/public_holidays_in_ireland.html # noqa: E501
"""

country = "IE"
observed_label = "%s (observed)"

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
StaticHolidays.__init__(self, IrelandStaticHolidays)
kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_MON)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1871:
return None

# New Year's Day.
self._add_new_years_day("New Year's Day")
if self._year >= 1975:
self._add_new_years_day("New Year's Day")

# St. Brigid's Day.
if self._year >= 2023:
Expand All @@ -48,35 +46,39 @@ def _populate_public_holidays(self):
self._add_holiday_1st_mon_from_feb_1(name)

# St. Patrick's Day.
self._add_observed(self._add_holiday_mar_17("St. Patrick's Day"))
if self._year >= 1903:
self._add_holiday_mar_17("St. Patrick's Day")

# Easter Monday.
self._add_easter_monday("Easter Monday")

# May Day.
if self._year >= 1978:
if self._year >= 1994:
name = "May Day"
if self._year == 1995:
self._add_holiday_may_8(name)
else:
self._add_holiday_1st_mon_of_may(name)

# June Bank holiday.
self._add_holiday_1st_mon_of_jun("June Bank Holiday")
if self._year >= 1973:
# June Bank Holiday.
self._add_holiday_1st_mon_of_jun("June Bank Holiday")
else:
# Whit Monday.
self._add_whit_monday("Whit Monday")

# Summer Bank holiday.
# August Bank Holiday.
self._add_holiday_1st_mon_of_aug("August Bank Holiday")

# October Bank Holiday.
self._add_holiday_last_mon_of_oct("October Bank Holiday")
if self._year >= 1977:
self._add_holiday_last_mon_of_oct("October Bank Holiday")

# Christmas Day.
self._add_observed(self._add_christmas_day("Christmas Day"))
self._add_christmas_day("Christmas Day")

# St. Stephen's Day.
self._add_observed(
self._add_christmas_day_two("St. Stephen's Day"), rule=SAT_SUN_TO_NEXT_MON_TUE
)
self._add_christmas_day_two("St. Stephen's Day")


class IE(Ireland):
Expand All @@ -89,5 +91,7 @@ class IRL(Ireland):

class IrelandStaticHolidays:
special_public_holidays = {
1999: (DEC, 31, "Millennium Celebrations"),
2011: (SEP, 14, "National Day of Mourning"),
2022: (MAR, 18, "Day of Remembrance and Recognition"),
}
2 changes: 1 addition & 1 deletion holidays/countries/portugal.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _populate_optional_holidays(self):
# - get Holidays that occur on Thursday and add Friday (+1 day)

# Carnival.
self._add_carnival_monday(tr("Carnaval"))
self._add_carnival_tuesday(tr("Carnaval"))

# St. Anthony's Day.
self._add_holiday_jun_13(tr("Dia de Santo António"))
Expand Down
Loading