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.63 #2175

Merged
merged 18 commits into from
Dec 16, 2024
Merged

v0.63 #2175

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
8 changes: 8 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ on:
tags:
- 'v*'
workflow_dispatch:
workflow_run:
workflows: ["Update pre-commit hooks"]
branches:
- update-pre-commit-hooks
types:
- completed


env:
FORCE_COLOR: 1
Expand All @@ -36,6 +43,7 @@ jobs:
with:
check-latest: true
python-version: '3.12'

- name: Run pre-commit
uses: pre-commit/action@v3.0.1

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- --py39-plus

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.8.3
hooks:
- id: ruff
- id: ruff-format
Expand Down
13 changes: 13 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Version 0.63
============

Released December 16, 2024

- Update CI/CD trigger section (#2170 by @arkid15r)
- Update KZ holidays: add 2025 special holidays (#2167 by @qaziqarta)
- Update Thailand holidays: extend support year down to 1914 (#2166 by @PPsyrius)
- Add French subdivision aliases (#2162 by @bors-ltd)
- Align financial markets MIC codes with ISO 10383 (#2158 by @KJhellico)
- Enforce 100% test coverage (#2173 by @arkid15r)
- Inline single-use variables, update .py files formatting (#2161 by @KJhellico)

Version 0.62
============

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ from the `dev branch`_ to work on the latest code and reduce merging issues.
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. 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
as a comment on the relevant part of the code. Contributed PRs_ are required to include 100% test
coverage in order to be merged. Please don't hesitate to ask for help if you
need one with the tests.

Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ All other default values are highlighted with bold:
- UNOFFICIAL
* - France
- FR
- DOM/TOM: BL, GES, GP, GY, MF, MQ, NC, PF, RE, WF, YT
- DOM/TOM: BL (Saint-Barthélemy), GES (Alsace, Champagne-Ardenne, Lorraine), GP (Guadeloupe), GY (Guyane), MF (Saint-Martin), MQ (Martinique), NC (Nouvelle-Calédonie), PF (Polynésie Française), RE (La Réunion), WF (Wallis-et-Futuna), YT (Mayotte)
- en_US, **fr**, uk
-
* - Gabon
Expand Down Expand Up @@ -980,8 +980,12 @@ following financial markets are available:
- Code
- Info
- Supported Languages
* - Brasil, Bolsa, Balcão
- BVMF
- Brazil Stock Exchange and Over-the-Counter Market holidays (same as ANBIMA holidays)
- en_US, **pt_BR**, uk
* - European Central Bank
- ECB
- XECB
- Trans-European Automated Real-time Gross Settlement (TARGET2)
-
* - ICE Futures Europe
Expand All @@ -992,10 +996,6 @@ following financial markets are available:
- XNYS
- NYSE market holidays (used by all other US-exchanges, including NASDAQ, etc.)
-
* - Brasil, Bolsa, Balcão
- BVMF
- Brazil Stock Exchange and Over-the-Counter Market holidays (same as ANBIMA holidays)
- en_US, **pt_BR**, uk


Contributions
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

| Version | Supported |
| ------- | ------------------ |
| 0.62 | :white_check_mark: |
| < 0.62 | :x: |
| 0.63 | :white_check_mark: |
| < 0.63 | :x: |

## Reporting a Vulnerability

Expand Down
34 changes: 25 additions & 9 deletions holidays/calendars/thai.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

class _ThaiLunisolar:
"""
** Thai Lunar Calendar Holidays only work from 1941 (B.E. 2484) onwards
** Thai Lunar Calendar Holidays only work from 1913 (B.E. 2456/2455) onwards
until 2157 (B.E. 2700) as we only have Thai year-type data for
cross-checking until then.

Expand Down Expand Up @@ -100,9 +100,15 @@ class _ThaiLunisolar:
2010-05-28
"""

# Athikawan (Extra-Day Year) list goes from 1941-2157 C.E.
# Athikawan (Extra-Day Year) list goes from 1914-2157 C.E.
# Copied off from 1757-2157 (B.E. 2300-2700) Thai Lunar Calendar
ATHIKAWAN_YEARS_GREGORIAN = {
1914,
1917,
1925,
1929,
1933,
1936,
1945,
1949,
1952,
Expand Down Expand Up @@ -147,10 +153,20 @@ class _ThaiLunisolar:
2153,
}

# Athikamat (Extra-Month Year) list goes from 1941-2157 C.E.:
# Athikamat (Extra-Month Year) list goes from 1914-2157 C.E.:
# Copied off from 1757-2157 (B.E. 2300-2700) Thai Lunar Calendar
# Approx formula as follows: (common_era-78)-0.45222)%2.7118886 < 1
ATHIKAMAT_YEARS_GREGORIAN = {
1915,
1918,
1920,
1923,
1926,
1928,
1931,
1934,
1937,
1939,
1942,
1944,
1947,
Expand Down Expand Up @@ -234,12 +250,12 @@ class _ThaiLunisolar:
}

# While Buddhist Holy Days have been observed since the 1900s
# Due to the calendar changes in 1941 (B.E. 2484) and that
# our array only goes up to B.E. 2700; We'll thus only populate
# the data for 1941-2157 (B.E. 2484-2700).
# Thailand's Public Holiday Act wasn't codified until 1914 (B.E. 2457)
# and that our array only goes up to B.E. 2700; We'll thus only populate
# the data for 1914-2157 (B.E. 2457-2700).
# Sources: หนังสือเวียนกรมการปกครอง กระทรวงมหาดไทย มท 0310.1/ว4 5 ก.พ. 2539
START_DATE = date(1940, 11, 30)
START_YEAR = 1941
START_DATE = date(1913, 11, 28)
START_YEAR = 1914
END_YEAR = 2157

def __init__(self, calendar=THAI_CALENDAR) -> None:
Expand Down Expand Up @@ -270,7 +286,7 @@ def _get_start_date(self, year: int) -> Optional[date]:
Calculate the start date of that particular Thai Lunar Calendar Year.
This usually falls in November or December of the previous Gregorian
year in question. Should the year be outside of working scope
(1941-2157: B.E 2484-2700), this will returns None instead.
(1914-2157: B.E 2457-2700), this will returns None instead.

:param year:
The Gregorian year.
Expand Down
47 changes: 22 additions & 25 deletions holidays/countries/angola.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _add_observed(self, dt: date, **kwargs) -> tuple[bool, Optional[date]]:

def _populate_public_holidays(self):
# New Year's Day.
name = self.tr("Dia do Ano Novo")
name = tr("Dia do Ano Novo")
dt = self._add_new_years_day(name)
if self._year <= 2011 or self._year >= 2018:
self._add_observed(dt)
Expand All @@ -84,14 +84,15 @@ def _populate_public_holidays(self):
self._add_holiday_jan_4(tr("Dia dos Mártires da Repressão Colonial"))
)

name = (
# Beginning of the Armed Struggle for National Liberation Day.
tr("Dia do Início da Luta Armada de Libertação Nacional")
if self._year >= 2012
# Beginning of the Armed Struggle Day.
else tr("Dia do Início da Luta Armada")
self._add_observed(
self._add_holiday_feb_4(
# Beginning of the Armed Struggle for National Liberation Day.
tr("Dia do Início da Luta Armada de Libertação Nacional")
if self._year >= 2012
# Beginning of the Armed Struggle Day.
else tr("Dia do Início da Luta Armada")
)
)
self._add_observed(self._add_holiday_feb_4(name))

# Law #16/96.
if self._year >= 1997:
Expand All @@ -103,17 +104,13 @@ def _populate_public_holidays(self):

# Law #11/18.
if self._year >= 2019:
self._add_observed(
# Southern Africa Liberation Day.
self._add_holiday_mar_23(tr("Dia da Libertação da África Austral"))
)
# Southern Africa Liberation Day.
self._add_observed(self._add_holiday_mar_23(tr("Dia da Libertação da África Austral")))

# Law #7/03.
if self._year >= 2003:
self._add_observed(
# Peace and National Reconciliation Day.
self._add_holiday_apr_4(tr("Dia da Paz e Reconciliação Nacional"))
)
# Peace and National Reconciliation Day.
self._add_observed(self._add_holiday_apr_4(tr("Dia da Paz e Reconciliação Nacional")))

# Law #16/96.
if self._year >= 1997:
Expand Down Expand Up @@ -145,21 +142,22 @@ def _populate_public_holidays(self):
if self._year <= 2010 or self._year >= 2018:
self._add_observed(dt)

name = (
# National Independence Day.
tr("Dia da Independência Nacional")
if self._year >= 1996
# Independence Day.
else tr("Dia da Independência")
self._add_observed(
self._add_holiday_nov_11(
# National Independence Day.
tr("Dia da Independência Nacional")
if self._year >= 1996
# Independence Day.
else tr("Dia da Independência")
)
)
self._add_observed(self._add_holiday_nov_11(name))

# Decree # 7/92.
if self._year <= 1991:
# Date of Founding of MPLA - Labor Party.
self._add_holiday_dec_10(tr("Data da Fundacao do MPLA - Partido do Trabalho"))

name = (
dt = self._add_christmas_day(
# Christmas and Family Day.
tr("Dia de Natal e da Família")
if self._year >= 2011
Expand All @@ -169,7 +167,6 @@ def _populate_public_holidays(self):
else tr("Dia da Família") # Family Day.
)
)
dt = self._add_christmas_day(name)
if self._year <= 2010 or self._year >= 2018:
self._add_observed(dt)

Expand Down
5 changes: 2 additions & 3 deletions holidays/countries/argentina.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _populate_public_holidays(self):
if self._year >= 2016:
jun_17 = self._add_holiday_jun_17(
# Pass to the Immortality of General Don Martin Miguel de Guemes.
tr("Paso a la Inmortalidad del General Don Martín Miguel de Güemes"),
tr("Paso a la Inmortalidad del General Don Martín Miguel de Güemes")
)
# If Jun 17 is Friday, then it should move to Mon, Jun 20
# but Jun 20 is Gen. Belgrano holiday
Expand All @@ -232,14 +232,13 @@ def _populate_public_holidays(self):
# In 2010 the holiday became movable and its name was changed.

if self._year >= 1917:
name = (
oct_12 = self._add_columbus_day(
# Respect for Cultural Diversity Day.
tr("Día del Respeto a la Diversidad Cultural")
if self._year >= 2010
# Columbus Day.
else tr("Día de la Raza")
)
oct_12 = self._add_columbus_day(name)
if self._year >= 2010:
self._move_holiday(oct_12)

Expand Down
2 changes: 1 addition & 1 deletion holidays/countries/bolivia.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _populate_public_holidays(self):
self._add_good_friday(tr("Viernes Santo"))

# Labor Day.
self._add_observed(may_1 := self._add_labor_day(self.tr("Día del Trabajo")))
self._add_observed(may_1 := self._add_labor_day(tr("Día del Trabajo")))
# Supreme Decree #1210.
if 2012 <= self._year <= 2015:
self._add_observed(may_1, rule=TUE_TO_PREV_MON + THU_TO_NEXT_FRI)
Expand Down
2 changes: 1 addition & 1 deletion holidays/countries/bosnia_and_herzegovina.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def _populate_subdiv_srp_public_holidays(self):

self._add_holiday_nov_21(
# Dayton Agreement Day.
tr("Dan uspostave Opšteg okvirnog sporazuma za mir u Bosni i Hercegovini"),
tr("Dan uspostave Opšteg okvirnog sporazuma za mir u Bosni i Hercegovini")
)

# Catholic Christmas Eve.
Expand Down
13 changes: 6 additions & 7 deletions holidays/countries/cambodia.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _populate_public_holidays(self):
# NORODOM SIHAMONI, King of Cambodia
"ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម ព្រះករុណា ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី"
)
dt = self._add_holiday_may_14(king_sihamoni_bday)
self._add_holiday_may_14(king_sihamoni_bday)
if self._year <= 2019:
self._add_holiday_may_13(king_sihamoni_bday)
self._add_holiday_may_15(king_sihamoni_bday)
Expand Down Expand Up @@ -159,7 +159,7 @@ def _populate_public_holidays(self):
if self._year >= 1994:
self._add_holiday_jun_18(
# Birthday of Her Majesty the Queen-Mother NORODOM MONINEATH SIHANOUK of Cambodia
tr("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ"),
tr("ព្រះរាជពិធីបុណ្យចម្រើនព្រះជន្ម សម្តេចព្រះមហាក្សត្រី ព្រះវររាជមាតា នរោត្តម មុនិនាថ សីហនុ")
)

# ទិវាប្រកាសរដ្ឋធម្មនុញ្ញ
Expand All @@ -176,13 +176,12 @@ def _populate_public_holidays(self):

if self._year >= 2012:
self._add_holiday_oct_15(
# Mourning Day of the Late King-Father
# NORODOM SIHANOUK of Cambodia
# Mourning Day of the Late King-Father NORODOM SIHANOUK of Cambodia
tr(
"ទិវាប្រារព្ឋពិធីគោរពព្រះវិញ្ញាណក្ខន្ឋ ព្រះករុណា ព្រះបាទសម្តេចព្រះ នរោត្តម "
"សីហនុ ព្រះមហាវីរក្សត្រ ព្រះវររាជបិតាឯករាជ្យ បូរណភាពទឹកដី និងឯកភាពជាតិខ្មែរ "
"ព្រះបរមរតនកោដ្ឋ"
),
)
)

# ទិវារំលឹកសន្ធិសញ្ញាសន្តិភាពទីក្រុងប៉ារីស
Expand All @@ -207,7 +206,7 @@ def _populate_public_holidays(self):
"ព្រះរាជពិធីគ្រងព្រះបរមរាជសម្បត្តិ របស់ ព្រះករុណា "
"ព្រះបាទសម្តេចព្រះបរមនាថ នរោត្តម សីហមុនី "
"ព្រះមហាក្សត្រនៃព្រះរាជាណាចក្រកម្ពុជា"
),
)
)

# ពិធីបុណ្យឯករាជ្យជាតិ
Expand All @@ -226,7 +225,7 @@ def _populate_public_holidays(self):
self._add_holiday_dec_10(tr("ទិវាសិទ្ធិមនុស្សអន្តរជាតិ"))

# Cambodian Lunar Calendar Holidays
# See `_ThaiLunisolar` in holidays/utils.py for more details.
# See `_ThaiLunisolar` in holidays/calendars/thai.py for more details.
# Cambodian Lunar Calendar Holidays only work from 1941 to 2157.

# ពិធីបុណ្យមាឃបូជា
Expand Down
3 changes: 1 addition & 2 deletions holidays/countries/canada.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,13 @@ def _populate_subdiv_mb_public_holidays(self):

def _populate_subdiv_mb_optional_holidays(self):
if self._year >= 1900:
name = (
self._add_holiday_1st_mon_of_aug(
# Terry Fox Day.
tr("Terry Fox Day")
if self._year >= 2015
# Civic Holiday.
else tr("Civic Holiday")
)
self._add_holiday_1st_mon_of_aug(name)

if self._year >= 1931:
# Remembrance Day.
Expand Down
Loading
Loading