Skip to content

Commit

Permalink
Merge pull request #2070 from vacanza/dev
Browse files Browse the repository at this point in the history
v0.59
  • Loading branch information
arkid15r authored Oct 21, 2024
2 parents 1d14055 + cd6bbea commit 3182537
Show file tree
Hide file tree
Showing 76 changed files with 1,225 additions and 909 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ jobs:
- ubuntu-latest
- windows-latest
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
Expand Down
8 changes: 4 additions & 4 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.17.0
rev: v3.18.0
hooks:
- id: pyupgrade
args:
- --py38-plus
- --py39-plus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.0
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.11.2
rev: v1.12.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
16 changes: 16 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
Version 0.59
============

Released October 21, 2024

- Update Vietnam holidays: add `th` localization (#2060 by @PPsyrius)
- Update Germany holidays: add Liberation from Nazi Regime Day 2025 in Berlin (#2052 by @hf-kklein, @PPsyrius)
- Update Johor (Malaysia) and United Arab Emirates `weekend` observance, cleanup others (#2048 by @PPsyrius)
- Update Vietnam holidays (#2049 by @KJhellico)
- Update `InternationalHolidays::_add_world_war_two_victory_day()` method (#2064 by @KJhellico)
- Update `holidays` package metadata (#2063 by @arkid15r)
- Update metadata Python versions (#2069 by @arkid15r)
- Add `EasternCalendarHolidays` to holidays groups (#2062 by @KJhellico)
- Drop Python 3.8 support (#2042 by @PPsyrius)
- Satisfy mypy requirements (#2053 by @arkid15r)

Version 0.58
============

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ All other default values are highlighted with bold:
* - Vietnam
- VN
-
- en_US, **vi**
- en_US, th, **vi**
-
* - Virgin Islands (U.S.)
- VI
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns: List[str] = []
exclude_patterns: list[str] = []

# Add any paths that contain templates here, relative to this directory.
#
Expand Down Expand Up @@ -144,7 +144,7 @@
#
# See https://sphinx-rtd-theme.readthedocs.io/en/latest/configuring.html
#
html_theme_options: Dict[str, Union[str, bool, int]] = {
html_theme_options: dict[str, Union[str, bool, int]] = {
# 'canonical_url': '',
# 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
# 'analytics_anonymize_ip': False
Expand Down
2 changes: 1 addition & 1 deletion holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from holidays.registry import EntityLoader
from holidays.utils import *

__version__ = "0.58"
__version__ = "0.59"


EntityLoader.load("countries", globals())
Expand Down
8 changes: 4 additions & 4 deletions holidays/calendars/buddhist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# License: MIT (see LICENSE file)

from datetime import date
from typing import Optional, Tuple
from typing import Optional

from holidays.calendars.custom import _CustomCalendar
from holidays.calendars.gregorian import MAY, JUN
Expand Down Expand Up @@ -425,16 +425,16 @@ class _BuddhistLunisolar:
2099: (MAY, 4),
}

def _get_holiday(self, holiday: str, year: int) -> Tuple[Optional[date], bool]:
def _get_holiday(self, holiday: str, year: int) -> tuple[Optional[date], bool]:
estimated_dates = getattr(self, f"{holiday}_DATES", {})
exact_dates = getattr(self, f"{holiday}_DATES_{_CustomCalendar.CUSTOM_ATTR_POSTFIX}", {})
dt = exact_dates.get(year, estimated_dates.get(year, ()))
return date(year, *dt) if dt else None, year not in exact_dates

def vesak_date(self, year: int) -> Tuple[Optional[date], bool]:
def vesak_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(VESAK, year)

def vesak_may_date(self, year: int) -> Tuple[Optional[date], bool]:
def vesak_may_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(VESAK_MAY, year)


Expand Down
16 changes: 8 additions & 8 deletions holidays/calendars/chinese.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# License: MIT (see LICENSE file)

from datetime import date
from typing import Optional, Tuple
from typing import Optional

from holidays.calendars.custom import _CustomCalendar
from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, SEP, OCT, NOV
Expand Down Expand Up @@ -1237,28 +1237,28 @@ class _ChineseLunisolar:
2099: (SEP, 29),
}

def _get_holiday(self, holiday: str, year: int) -> Tuple[Optional[date], bool]:
def _get_holiday(self, holiday: str, year: int) -> tuple[Optional[date], bool]:
estimated_dates = getattr(self, f"{holiday}_DATES", {})
exact_dates = getattr(self, f"{holiday}_DATES_{_CustomCalendar.CUSTOM_ATTR_POSTFIX}", {})
dt = exact_dates.get(year, estimated_dates.get(year, ()))
return date(year, *dt) if dt else None, year not in exact_dates

def buddha_birthday_date(self, year: int) -> Tuple[Optional[date], bool]:
def buddha_birthday_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(BUDDHA_BIRTHDAY, year)

def double_ninth_date(self, year: int) -> Tuple[Optional[date], bool]:
def double_ninth_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(DOUBLE_NINTH, year)

def dragon_boat_date(self, year: int) -> Tuple[Optional[date], bool]:
def dragon_boat_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(DRAGON_BOAT, year)

def hung_kings_date(self, year: int) -> Tuple[Optional[date], bool]:
def hung_kings_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(HUNG_KINGS, year)

def lunar_new_year_date(self, year: int) -> Tuple[Optional[date], bool]:
def lunar_new_year_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(LUNAR_NEW_YEAR, year)

def mid_autumn_date(self, year: int) -> Tuple[Optional[date], bool]:
def mid_autumn_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(MID_AUTUMN, year)


Expand Down
8 changes: 4 additions & 4 deletions holidays/calendars/hindu.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# License: MIT (see LICENSE file)

from datetime import date
from typing import Optional, Tuple
from typing import Optional

from holidays.calendars.custom import _CustomCalendar
from holidays.calendars.gregorian import JAN, FEB, MAR, OCT, NOV
Expand Down Expand Up @@ -425,16 +425,16 @@ class _HinduLunisolar:
2099: (JAN, 6),
}

def _get_holiday(self, holiday: str, year: int) -> Tuple[Optional[date], bool]:
def _get_holiday(self, holiday: str, year: int) -> tuple[Optional[date], bool]:
estimated_dates = getattr(self, f"{holiday}_DATES", {})
exact_dates = getattr(self, f"{holiday}_DATES_{_CustomCalendar.CUSTOM_ATTR_POSTFIX}", {})
dt = exact_dates.get(year, estimated_dates.get(year, ()))
return date(year, *dt) if dt else None, year not in exact_dates

def diwali_date(self, year: int) -> Tuple[Optional[date], bool]:
def diwali_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(DIWALI, year)

def thaipusam_date(self, year: int) -> Tuple[Optional[date], bool]:
def thaipusam_date(self, year: int) -> tuple[Optional[date], bool]:
return self._get_holiday(THAIPUSAM, year)


Expand Down
50 changes: 25 additions & 25 deletions holidays/calendars/islamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)

from collections.abc import Iterable
from datetime import date
from typing import Iterable, Tuple

from holidays.calendars.custom import _CustomCalendar
from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
Expand Down Expand Up @@ -3641,80 +3641,80 @@ class _IslamicLunar:
2076: (DEC, 5),
}

def _get_holiday(self, holiday: str, year: int) -> Iterable[Tuple[date, bool]]:
def _get_holiday(self, holiday: str, year: int) -> Iterable[tuple[date, bool]]:
estimated_dates = getattr(self, f"{holiday}_DATES", {})
exact_dates = getattr(self, f"{holiday}_DATES_{_CustomCalendar.CUSTOM_ATTR_POSTFIX}", {})
for year in (year - 1, year):
for dt in _normalize_tuple(exact_dates.get(year, estimated_dates.get(year, ()))):
yield date(year, *dt), year not in exact_dates

def ali_al_rida_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def ali_al_rida_death_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(ALI_AL_RIDA_DEATH, year)

def ali_birthday_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def ali_birthday_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(ALI_BIRTHDAY, year)

def ali_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def ali_death_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(ALI_DEATH, year)

def arbaeen_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def arbaeen_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(ARBAEEN, year)

def ashura_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def ashura_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(ASHURA, year)

def eid_al_adha_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def eid_al_adha_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(EID_AL_ADHA, year)

def eid_al_fitr_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def eid_al_fitr_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(EID_AL_FITR, year)

def eid_al_ghadir_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def eid_al_ghadir_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(EID_AL_GHADIR, year)

def fatima_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def fatima_death_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(FATIMA_DEATH, year)

def hari_hol_johor_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def hari_hol_johor_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(HARI_HOL_JOHOR, year)

def hasan_al_askari_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def hasan_al_askari_death_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(HASAN_AL_ASKARI_DEATH, year)

def hijri_new_year_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def hijri_new_year_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(HIJRI_NEW_YEAR, year)

def imam_mahdi_birthday_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def imam_mahdi_birthday_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(IMAM_MAHDI_BIRTHDAY, year)

def isra_and_miraj_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def isra_and_miraj_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(ISRA_AND_MIRAJ, year)

def maldives_embraced_islam_day_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def maldives_embraced_islam_day_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(MALDIVES_EMBRACED_ISLAM_DAY, year)

def mawlid_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def mawlid_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(MAWLID, year)

def nuzul_al_quran_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def nuzul_al_quran_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(NUZUL_AL_QURAN, year)

def prophet_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def prophet_death_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(PROPHET_DEATH, year)

def quamee_dhuvas_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def quamee_dhuvas_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(QUAMEE_DHUVAS, year)

def ramadan_beginning_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def ramadan_beginning_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(RAMADAN_BEGINNING, year)

def sadiq_birthday_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def sadiq_birthday_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(SADIQ_BIRTHDAY, year)

def sadiq_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def sadiq_death_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(SADIQ_DEATH, year)

def tasua_dates(self, year: int) -> Iterable[Tuple[date, bool]]:
def tasua_dates(self, year: int) -> Iterable[tuple[date, bool]]:
return self._get_holiday(TASUA, year)


Expand Down
4 changes: 2 additions & 2 deletions holidays/countries/angola.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from datetime import date
from gettext import gettext as tr
from typing import Optional, Tuple
from typing import Optional

from holidays.calendars.gregorian import AUG, SEP
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
Expand Down Expand Up @@ -59,7 +59,7 @@ def _is_observed(self, dt: date) -> bool:
# it rolls over to the following Monday.
return dt >= date(1996, SEP, 27)

def _add_observed(self, dt: date, **kwargs) -> Tuple[bool, Optional[date]]:
def _add_observed(self, dt: date, **kwargs) -> tuple[bool, Optional[date]]:
# As per Law # #11/18, from 2018/9/10, when public holiday falls on Tuesday or Thursday,
# the Monday or Friday is also a holiday.
kwargs.setdefault(
Expand Down
7 changes: 5 additions & 2 deletions holidays/countries/armenia.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ def _populate_public_holidays(self):
)

if self._year >= 1995:
# Victory and Peace Day.
self._add_world_war_two_victory_day(tr("Հաղթանակի և Խաղաղության տոն"))
self._add_world_war_two_victory_day(
# Victory and Peace Day.
tr("Հաղթանակի և Խաղաղության տոն"),
is_western=False,
)

# Republic Day.
self._add_holiday_may_28(tr("Հանրապետության օր"))
Expand Down
9 changes: 7 additions & 2 deletions holidays/countries/azerbaijan.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,13 @@ def _populate_public_holidays(self):
dts_observed.add(self._add_holiday_mar_23(name))
dts_observed.add(self._add_holiday_mar_24(name))

# Victory over Fascism Day.
dts_observed.add(self._add_world_war_two_victory_day(tr("Faşizm üzərində qələbə günü")))
dts_observed.add(
self._add_world_war_two_victory_day(
# Victory over Fascism Day.
tr("Faşizm üzərində qələbə günü"),
is_western=False,
)
)

if self._year >= 1992:
dts_observed.add(
Expand Down
2 changes: 1 addition & 1 deletion holidays/countries/belarus.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _populate_public_holidays(self):
self._add_labor_day(tr("Свята працы"))

# Victory Day.
self._add_world_war_two_victory_day(tr("Дзень Перамогі"))
self._add_world_war_two_victory_day(tr("Дзень Перамогі"), is_western=False)

# Independence Day.
self._add_holiday_jul_3(tr("Дзень Незалежнасці Рэспублікі Беларусь (Дзень Рэспублікі)"))
Expand Down
4 changes: 2 additions & 2 deletions holidays/countries/bosnia_and_herzegovina.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _populate_subdiv_bih_public_holidays(self):
self._add_labor_day_two(name)

# Victory Day.
self._add_world_war_two_victory_day(tr("Dan pobjede nad fašizmom"))
self._add_world_war_two_victory_day(tr("Dan pobjede nad fašizmom"), is_western=False)

# Statehood Day.
self._add_holiday_nov_25(tr("Dan državnosti"))
Expand Down Expand Up @@ -220,7 +220,7 @@ def _populate_subdiv_srp_public_holidays(self):
self._add_labor_day_two(name)

# Victory Day.
self._add_world_war_two_victory_day(tr("Dan pobjede nad fašizmom"))
self._add_world_war_two_victory_day(tr("Dan pobjede nad fašizmom"), is_western=False)

self._add_holiday_nov_21(
# Dayton Agreement Day.
Expand Down
Loading

0 comments on commit 3182537

Please sign in to comment.