Skip to content

Commit

Permalink
Merge pull request #1864 from vacanza/dev
Browse files Browse the repository at this point in the history
v0.53
  • Loading branch information
arkid15r authored Jul 15, 2024
2 parents e3ada27 + 7f34b8a commit 0b81a14
Show file tree
Hide file tree
Showing 28 changed files with 2,041 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .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.5.0
rev: v0.5.2
hooks:
- id: ruff
- id: ruff-format
Expand Down Expand Up @@ -54,7 +54,7 @@ repos:
- --show-error-codes

- repo: https://github.com/myint/rstcheck
rev: v6.2.0
rev: v6.2.4
hooks:
- id: rstcheck
additional_dependencies:
Expand Down
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 0.53
============

Released July 15, 2024

- Update Chile holidays: add bank holidays (#1857 by @KJhellico)
- Extend `HolidayBase::__setitem__` to handle names including '; ' (#1858 by @arkid15r)

Version 0.52
============

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ All other default values are highlighted with bold:
- CL
- Regions: AI, AN, AP, AR, AT, BI, CO, LI, LL, LR, MA, ML, NB, RM, TA, VS
- en_US, **es**, uk
-
- BANK
* - China
- CN
-
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.52"
__version__ = "0.53"


EntityLoader.load("countries", globals())
Expand Down
67 changes: 43 additions & 24 deletions holidays/countries/chile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from gettext import gettext as tr
from typing import Tuple

from holidays.calendars.gregorian import JUN, SEP
from holidays.calendars.gregorian import JUN, SEP, DEC
from holidays.constants import BANK, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
from holidays.observed_holiday_base import (
ObservedHolidayBase,
Expand All @@ -29,27 +30,32 @@
class Chile(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
"""
References:
- https://www.feriados.cl
- http://www.feriadoschilenos.cl/ (excellent history)
- https://es.wikipedia.org/wiki/Anexo:D%C3%ADas_feriados_en_Chile
- Law 2.977 (established official Chile holidays in its current form)
- Law 20.983 (Day after New Year's Day, if it's a Sunday)
- Law 19.668 (floating Monday holiday)
- Law 19.668 (Corpus Christi)
- Law 2.200, (Labour Day)
- Law 18.018 (Labour Day renamed)
- Law 16.840, Law 18.432 (Saint Peter and Saint Paul)
- Law 20.148 (Day of Virgin of Carmen)
- Law 18.026 (Day of National Liberation)
- Law 19.588, Law 19.793 (Day of National Unity)
- Law 20.983 (National Holiday Friday preceding Independence Day)
- Law 20.215 (National Holiday Monday preceding Independence Day)
- Law 20.215 (National Holiday Friday following Army Day)
- Decree-law 636, Law 8.223
- Law 3.810 (Columbus Day)
- Law 20.299 (National Day of the Evangelical and Protestant Churches)
- Law 20.663 (Región de Arica y Parinacota)
- Law 20.678 (Región de Ñuble)
- https://www.feriados.cl
- `Excellent history of Chile holidays <http://www.feriadoschilenos.cl>`_
- https://es.wikipedia.org/wiki/Anexo:D%C3%ADas_feriados_en_Chile
- Law 2.977 (established official Chile holidays in its current form)
- Law 20.983 (Day after New Year's Day, if it's a Sunday)
- Law 19.668 (floating Monday holiday)
- Law 19.668 (Corpus Christi)
- Law 2.200, (Labour Day)
- Law 18.018 (Labour Day renamed)
- Law 16.840, Law 18.432 (Saint Peter and Saint Paul)
- Law 20.148 (Day of Virgin of Carmen)
- Law 18.026 (Day of National Liberation)
- Law 19.588, Law 19.793 (Day of National Unity)
- Law 20.983 (National Holiday Friday preceding Independence Day)
- Law 20.215 (National Holiday Monday preceding Independence Day)
- Law 20.215 (National Holiday Friday following Army Day)
- Decree-law 636, Law 8.223
- Law 3.810 (Columbus Day)
- Law 20.299 (National Day of the Evangelical and Protestant Churches)
- Law 20.663 (Región de Arica y Parinacota)
- Law 20.678 (Región de Ñuble)
- `Law 19.656 (Dec 31, 1999 holiday) <https://www.bcn.cl/leychile/navegar?idNorma=149328&idVersion=1999-12-15>`_
- `Law 12.051 (bank holidays Jun 30 and Dec 31) <https://www.bcn.cl/leychile/navegar?idNorma=27013&idVersion=1956-07-12>`_
- `Decree-law 1.171 (eliminate Jun 30) <https://www.bcn.cl/leychile/navegar?idNorma=6507&idVersion=1975-09-05>`_
- `Law 19.528 (eliminate Dec 31) <https://www.bcn.cl/leychile/navegar?idNorma=76630&idVersion=1997-11-04>`_
- `Law 19.559 (restore Dec 31) <https://www.bcn.cl/leychile/navegar?idNorma=97758&idVersion=1998-04-16>`_
"""

country = "CL"
Expand All @@ -72,6 +78,7 @@ class Chile(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stati
"TA",
"VS",
)
supported_categories = (BANK, PUBLIC)
supported_languages = ("en_US", "es", "uk")

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -209,6 +216,15 @@ def _populate_subdiv_nb_public_holidays(self):
tr("Nacimiento del Prócer de la Independencia (Chillán y Chillán Viejo)")
)

def _populate_bank_holidays(self):
# Bank Holiday.
name = tr("Feriado bancario")
if 1957 <= self._year <= 1975:
self._add_holiday_jun_30(name)

if self._year >= 1956 and self._year != 1997:
self._add_holiday_dec_31(name)

@property
def _summer_solstice_date(self) -> Tuple[int, int]:
day = 20
Expand All @@ -228,7 +244,10 @@ class CHL(Chile):


class ChileStaticHolidays:
# National Holiday.
national_holiday = tr("Feriado nacional")

special_public_holidays = {
# National Holiday.
2022: (SEP, 16, tr("Feriado nacional")),
1999: (DEC, 31, national_holiday),
2022: (SEP, 16, national_holiday),
}
2 changes: 1 addition & 1 deletion holidays/holiday_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def __setitem__(self, key: DateLike, value: str) -> None:
# If there are multiple holidays on the same date
# order their names alphabetically.
holiday_names = set(self[key].split(HOLIDAY_NAME_DELIMITER))
holiday_names.add(value)
holiday_names.update(value.split(HOLIDAY_NAME_DELIMITER))
value = HOLIDAY_NAME_DELIMITER.join(sorted(holiday_names))

dict.__setitem__(self, self.__keytransform__(key), value)
Expand Down
10 changes: 7 additions & 3 deletions holidays/locale/en_US/LC_MESSAGES/CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.42\n"
"Project-Id-Version: Python Holidays 0.53\n"
"POT-Creation-Date: 2023-02-28 16:42+0200\n"
"PO-Revision-Date: 2024-01-23 20:59+0200\n"
"PO-Revision-Date: 2024-07-08 17:20+0300\n"
"Last-Translator: ~Jhellico <[email protected]>\n"
"Language-Team: Python Holidays localization team\n"
"Language: en_US\n"
Expand All @@ -25,7 +25,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#. National Holiday.
msgid "Feriado nacional"
Expand Down Expand Up @@ -130,3 +130,7 @@ msgstr "Assault and Capture of Cape Arica"
#. Nativity of Bernardo O'Higgins (Chillán and Chillán Viejo communes)
msgid "Nacimiento del Prócer de la Independencia (Chillán y Chillán Viejo)"
msgstr "Nativity of Bernardo O'Higgins (Chillán and Chillán Viejo communes)"

#. Bank Holiday.
msgid "Feriado bancario"
msgstr "Bank Holiday"
10 changes: 7 additions & 3 deletions holidays/locale/es/LC_MESSAGES/CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.21\n"
"Project-Id-Version: Python Holidays 0.53\n"
"POT-Creation-Date: 2023-02-28 16:42+0200\n"
"PO-Revision-Date: 2023-02-28 16:43+0200\n"
"PO-Revision-Date: 2024-07-08 17:19+0300\n"
"Last-Translator: ~Jhellico <[email protected]>\n"
"Language-Team: Python Holidays localization team\n"
"Language: es\n"
Expand All @@ -25,7 +25,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.2.2\n"
"X-Generator: Poedit 3.4.2\n"

#. National Holiday.
msgid "Feriado nacional"
Expand Down Expand Up @@ -130,3 +130,7 @@ msgstr ""
#. Nativity of Bernardo O'Higgins (Chillán and Chillán Viejo communes)
msgid "Nacimiento del Prócer de la Independencia (Chillán y Chillán Viejo)"
msgstr ""

#. Bank Holiday.
msgid "Feriado bancario"
msgstr ""
10 changes: 7 additions & 3 deletions holidays/locale/uk/LC_MESSAGES/CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.44\n"
"Project-Id-Version: Python Holidays 0.53\n"
"POT-Creation-Date: 2023-02-28 16:42+0200\n"
"PO-Revision-Date: 2024-03-01 15:02+0200\n"
"PO-Revision-Date: 2024-07-08 17:20+0300\n"
"Last-Translator: ~Jhellico <[email protected]>\n"
"Language-Team: Python Holidays localization team\n"
"Language: uk\n"
Expand All @@ -25,7 +25,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#. National Holiday.
msgid "Feriado nacional"
Expand Down Expand Up @@ -130,3 +130,7 @@ msgstr "Штурм і захоплення Морро-де-Аріка"
#. Nativity of Bernardo O'Higgins (Chillán and Chillán Viejo communes)
msgid "Nacimiento del Prócer de la Independencia (Chillán y Chillán Viejo)"
msgstr "Річниця Бернардо ОʼГіґґінса (свято комун Чіллан і Чіллан Вʼєхо)"

#. Bank Holiday.
msgid "Feriado bancario"
msgstr "Банківський вихідний"
Loading

0 comments on commit 0b81a14

Please sign in to comment.