diff --git a/holidays/countries/germany.py b/holidays/countries/germany.py index b05735704..f960889ea 100644 --- a/holidays/countries/germany.py +++ b/holidays/countries/germany.py @@ -11,11 +11,12 @@ from gettext import gettext as tr -from holidays.groups import ChristianHolidays, InternationalHolidays +from holidays.calendars.gregorian import MAY, OCT +from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays from holidays.holiday_base import HolidayBase -class Germany(HolidayBase, ChristianHolidays, InternationalHolidays): +class Germany(HolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays): """Official holidays for Germany in its current form. This class doesn't return any holidays before 1990-10-03. @@ -76,6 +77,7 @@ class Germany(HolidayBase, ChristianHolidays, InternationalHolidays): def __init__(self, *args, **kwargs) -> None: ChristianHolidays.__init__(self) InternationalHolidays.__init__(self) + StaticHolidays.__init__(self, GermanyStaticHolidays) super().__init__(*args, **kwargs) def _populate_public_holidays(self): @@ -104,10 +106,6 @@ def _populate_public_holidays(self): # German Unity Day. self._add_holiday_oct_3(tr("Tag der Deutschen Einheit")) - if self._year == 2017: - # Reformation Day. - self._add_holiday_oct_31(tr("Reformationstag")) - if self._year <= 1994: # Repentance and Prayer Day. self._add_holiday_1st_wed_before_nov_22(tr("Buß- und Bettag")) @@ -129,8 +127,8 @@ def _populate_subdiv_bb_public_holidays(self): # Whit Sunday. self._add_whit_sunday(tr("Pfingstsonntag")) - if self._year != 2017: - self._add_holiday_oct_31(tr("Reformationstag")) + # Reformation Day. + self._add_holiday_oct_31(tr("Reformationstag")) def _populate_subdiv_be_public_holidays(self): if self._year <= 1989: @@ -140,16 +138,6 @@ def _populate_subdiv_be_public_holidays(self): # International Women's Day. self._add_womens_day(tr("Internationaler Frauentag")) - if self._year == 2020: - self._add_holiday_may_8( - # 75th anniversary of the liberation from Nazism and - # the end of the Second World War in Europe. - tr( - "75. Jahrestag der Befreiung vom Nationalsozialismus " - "und der Beendigung des Zweiten Weltkriegs in Europa" - ), - ) - def _populate_subdiv_bw_public_holidays(self): if self._year <= 1989: return None @@ -215,8 +203,7 @@ def _populate_subdiv_mv_public_holidays(self): if self._year >= 2023: self._add_womens_day(tr("Internationaler Frauentag")) - if self._year != 2017: - self._add_holiday_oct_31(tr("Reformationstag")) + self._add_holiday_oct_31(tr("Reformationstag")) def _populate_subdiv_ni_public_holidays(self): if self._year <= 1989: @@ -264,8 +251,7 @@ def _populate_subdiv_sn_public_holidays(self): if self._year <= 1989: return None - if self._year != 2017: - self._add_holiday_oct_31(tr("Reformationstag")) + self._add_holiday_oct_31(tr("Reformationstag")) if self._year >= 1995: # last wednesday before year-11-23 @@ -278,8 +264,7 @@ def _populate_subdiv_st_public_holidays(self): if self._year >= 1991: self._add_epiphany_day(tr("Heilige Drei Könige")) - if self._year != 2017: - self._add_holiday_oct_31(tr("Reformationstag")) + self._add_holiday_oct_31(tr("Reformationstag")) def _populate_subdiv_th_public_holidays(self): if self._year <= 1989: @@ -289,8 +274,7 @@ def _populate_subdiv_th_public_holidays(self): # World Children's Day. self._add_holiday_sep_20(tr("Weltkindertag")) - if self._year != 2017: - self._add_holiday_oct_31(tr("Reformationstag")) + self._add_holiday_oct_31(tr("Reformationstag")) class DE(Germany): @@ -299,3 +283,22 @@ class DE(Germany): class DEU(Germany): pass + + +class GermanyStaticHolidays: + special_public_holidays = { + 2017: (OCT, 31, tr("Reformationstag")), + } + + special_be_public_holidays = { + 2020: ( + MAY, + 8, + # 75th anniversary of the liberation from Nazism and + # the end of the Second World War in Europe. + tr( + "75. Jahrestag der Befreiung vom Nationalsozialismus " + "und der Beendigung des Zweiten Weltkriegs in Europa" + ), + ), + }