Skip to content

Commit

Permalink
Merge pull request #1734 from vacanza/dev
Browse files Browse the repository at this point in the history
v0.45
  • Loading branch information
arkid15r committed Mar 18, 2024
2 parents 1653bec + b91f00a commit b560805
Show file tree
Hide file tree
Showing 30 changed files with 3,096 additions and 52 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5.0.0
with:
python-version: '3.11'

python-version: '3.12'
- name: Run pre-commit
uses: pre-commit/action@v3.0.1

Expand Down Expand Up @@ -89,7 +88,7 @@ jobs:
with:
cache: pip
cache-dependency-path: requirements/runtime.txt
python-version: '3.11'
python-version: '3.12'

- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:

- uses: actions/setup-python@v5.0.0
with:
python-version: '3.11'
python-version: '3.12'

- uses: browniebroke/pre-commit-autoupdate-action@v1.0.0

- uses: peter-evans/create-pull-request@v6.0.1
- uses: peter-evans/create-pull-request@v6.0.2
with:
base: dev
body: Update pre-commit hooks to their latest versions.
Expand Down
33 changes: 18 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,43 @@ repos:
- rst

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.3.3
hooks:
- id: ruff
- id: ruff-format

- repo: https://github.com/myint/rstcheck
rev: v6.2.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: rstcheck
additional_dependencies:
- rstcheck
- sphinx
- id: isort
exclude: ^(docs)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: [types-all]
additional_dependencies:
- types-docutils
- types-polib
- types-python-dateutil
args:
- --ignore-missing-imports
- --implicit-optional
- --show-error-codes

- repo: https://github.com/myint/rstcheck
rev: v6.2.0
hooks:
- id: rstcheck
additional_dependencies:
- rstcheck
- sphinx

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
exclude: ^(docs)

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: '1.3.1'
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: '3.11'
python: '3.12'

python:
install:
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Hugh McNamara
Hugo van Kemenade
Jacky Han
Jacob Punter
Jaemin Kim
Jahir Fiquitiva
Jakob M. Kjær
Jan Pipek
Expand Down
14 changes: 14 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Version 0.45
============

Released March 18, 2024

- Add Python 3.12 support (#1721 by @arkid15r)
- Add Kuwait holidays (#1707 by @arkid15r)
- Add Seychelles holidays (#1728 by @PPsyrius)
- Fix SonarCloud security hotspots (#1718 by @arkid15r)
- Fix SonarCloud security hotspots (attempt #2) (#1720 by @arkid15r)
- Fix SonarCloud security hotspots (attempt #3) (#1723 by @arkid15r)
- Update Mexico holidays (#1722 by @KJhellico)
- Update pre-commit config (#1732 by @KJhellico)

Version 0.44
============

Expand Down
12 changes: 11 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Available Countries
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

We currently support 143 country codes. The standard way to refer to a country
We currently support 145 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 countries have common or foreign
names or abbreviations as aliases for their subdivisions. These are defined in
Expand Down Expand Up @@ -541,6 +541,11 @@ All other default values are highlighted with bold:
-
-
-
* - Kuwait
- KW
-
- **ar**, en_US
-
* - Kyrgyzstan
- KG
-
Expand Down Expand Up @@ -746,6 +751,11 @@ All other default values are highlighted with bold:
-
- en_US, **sr**
-
* - Seychelles
- SC
-
- **en_SC**, en_US
-
* - Singapore
- SG
-
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.44"
__version__ = "0.45"


EntityLoader.load("countries", globals())
Expand Down
2 changes: 2 additions & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
from .jersey import Jersey, JE, JEY
from .kazakhstan import Kazakhstan, KZ, KAZ
from .kenya import Kenya, KE, KEN
from .kuwait import Kuwait, KW, KWT
from .kyrgyzstan import Kyrgyzstan, KG, KGZ
from .laos import Laos, LA, LAO
from .latvia import Latvia, LV, LVA
Expand Down Expand Up @@ -125,6 +126,7 @@
from .san_marino import SanMarino, SM, SMR
from .saudi_arabia import SaudiArabia, SA, SAU
from .serbia import Serbia, RS, SRB
from .seychelles import Seychelles, SC, SYC
from .singapore import Singapore, SG, SGP
from .slovakia import Slovakia, SK, SVK
from .slovenia import Slovenia, SI, SVN
Expand Down
77 changes: 77 additions & 0 deletions holidays/countries/kuwait.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from gettext import gettext as tr

from holidays.groups import InternationalHolidays, IslamicHolidays
from holidays.holiday_base import HolidayBase


class Kuwait(HolidayBase, InternationalHolidays, IslamicHolidays):
"""
References:
- https://en.wikipedia.org/wiki/2024_in_Kuwait
- https://www.officeholidays.com/countries/kuwait
- https://www.timeanddate.com/holidays/kuwait/2024
"""

country = "KW"
default_language = "ar"
# %s (estimated).
estimated_label = tr("(تقدير) %s")
supported_languages = ("ar", "en_US")

def __init__(self, *args, **kwargs):
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادية"))

# National Day.
self._add_holiday_feb_25(tr("اليوم الوطني"))

# Liberation Day.
self._add_holiday_feb_26(tr("يوم التحرير"))

# Islamic New Year.
self._add_islamic_new_year_day(tr("رأس السنة الهجرية"))

# Prophet's Birthday.
self._add_mawlid_day(tr("عيد المولد النبوي"))

# Isra and Miraj.
self._add_isra_and_miraj_day(tr("ليلة المعراج"))

# Eid al-Fitr.
self._add_eid_al_fitr_day(tr("عيد الفطر"))
# Eid al-Fitr Holiday.
self._add_eid_al_fitr_day_two(tr("عطلة عيد الفطر"))
self._add_eid_al_fitr_day_three(tr("عطلة عيد الفطر"))

# Arafat Day.
self._add_arafah_day(tr("يوم عرفة"))

# Eid al-Adha.
self._add_eid_al_adha_day(tr("عيد الأضحى"))
# Eid al-Adha Holiday.
self._add_eid_al_adha_day_two(tr("عطلة عيد الأضحى"))
self._add_eid_al_adha_day_three(tr("عطلة عيد الأضحى"))


class KW(Kuwait):
pass


class KWT(Kuwait):
pass
15 changes: 10 additions & 5 deletions holidays/countries/mexico.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
class Mexico(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_Mexico
- https://es.wikipedia.org/wiki/Anexo:D%C3%ADas_festivos_en_M%C3%A9xico
- https://www.gob.mx/cms/uploads/attachment/file/156203/1044_Ley_Federal_del_Trabajo.pdf
- http://www.diputados.gob.mx/LeyesBiblio/ref/lft/LFT_orig_01abr70_ima.pdf
- https://en.wikipedia.org/wiki/Public_holidays_in_Mexico
- https://es.wikipedia.org/wiki/Anexo:D%C3%ADas_festivos_en_M%C3%A9xico
- https://www.gob.mx/cms/uploads/attachment/file/156203/1044_Ley_Federal_del_Trabajo.pdf
- http://www.diputados.gob.mx/LeyesBiblio/ref/lft/LFT_orig_01abr70_ima.pdf
- https://www.gob.mx/profedet/es/articulos/sabes-cuales-son-los-dias-de-descanso-obligatorio-para-este-2024 # noqa: E501
"""

country = "MX"
Expand Down Expand Up @@ -72,7 +73,11 @@ def _populate_public_holidays(self):

if self._year >= 1970 and (self._year - 1970) % 6 == 0:
# Change of Federal Government.
self._add_holiday_dec_1(tr("Transmisión del Poder Ejecutivo Federal"))
name = tr("Transmisión del Poder Ejecutivo Federal")
if self._year >= 2024:
self._add_holiday_oct_1(name)
else:
self._add_holiday_dec_1(name)

# Christmas Day.
self._add_christmas_day(tr("Navidad"))
Expand Down

0 comments on commit b560805

Please sign in to comment.