Skip to content

Commit

Permalink
v.0.16 (#716)
Browse files Browse the repository at this point in the history
* add honduras tests

* add honduras tests

* Add tests for many edge cases

* Add tests for many edge cases

* remove duplicate function

* v.0.15 beta init

* Typechecking (#661)

* typechecking HolidayBase, holidays.utils, miscellaneous typechecking
note: coverage to be extended to other parts of the project code

* Update Ukraine holidays.

  - Add Day of Ukrainian Statehood holiday.
  - Edit Victory Day name.
  - Fix formatting.
  - Update tests for Ukraine holidays.
  - Switch to <= and >= for consistency.
  - Rename Orthodox Easter.

* CHANGES sync

* Add Day after Thanksgiving to US - PA holidays (#675)

* CHANGES sync

* CHANGES sync, pre-commit reviews

* test_ukraine pre-commit fix

* Bump actions/setup-python from 3.1.0 to 4.1.0 (#682)

* Bump pre-commit/action from 2.0.3 to 3.0.0 (#672)

* removed py36 from toml target-version array

* Add Cuba (#678)

authored-by: bthompson <[email protected]>

* CHANGES sync

* Make Colombian holidays preserve historical observation (#676)

Authored-by: bthompson <[email protected]>

* Make Venezuela holidays preserve historical observation (#677)

Authored-by: bthompson <[email protected]>

* CHANGES sync

* black fixes

* removed outdated deprecation warnings

* Drop support for PortugalExt

* Ensure Canada Christmas observed falls after 25 and not before - new version #579

* CHANGES sync

* README sync (support for Cuba)

* Drop support for UK subdivisions as countries (England, Scotland..) (dr-p)
Drop support for IsleOfMan as UK subdivision (dr-p)

* Added support for Python 3.11, improved README badges

* Fixed CD/CI setup.cfg typo

* Added py3.11 to toml config

* Removed py3.11 from setup.cfg due to failing pre-commit checks

* Bump pypa/gh-action-pypi-publish from 1.5.0 to 1.5.1 #686

* Doc example fix (#685)

* added pentecost monday for province of bolzano

source: https://it.wikipedia.org/wiki/Pentecoste

* Whitsun Monday - province of Bolzano - IT (#689)

* Bump actions/setup-python to 4.2.0 (#688)

* v.0.15

* v.0.16 beta init

* Add UK Holiday for Queen Elizabeth II Funeral (#702)

* Add Moldova (#695)

* Add Bolivian holidays (#698)

* CHANGES sync

* Fix NYSE New Year observance for Saturdays. (#696)

* CHANGES sync

* Financial market support review, new method financial_holidays(..) #694

* Add Australia National Day of Mourning and confirmed Grand Final Day date (#699)

* CHANGES sync

* Add queen's funeral holidays for canada (#710)

* CHANGES sync

* New Zealand updates for Queen Elizabeth II mourning + King Charles III (#708, #709)

* Australia - new king updates

* Fix typo in comment for Cuba (#712)

* CHANGES sync - v.0.16 release date, dedication

Co-authored-by: Akos <[email protected]>
Co-authored-by: Akos Furton <[email protected]>
Co-authored-by: Maurizio Montel <[email protected]>
Co-authored-by: David Hotham <[email protected]>
Co-authored-by: Kate <[email protected]>
Co-authored-by: Ark <[email protected]>
Co-authored-by: Bailey Thompson <[email protected]>
Co-authored-by: g-gg <[email protected]>
Co-authored-by: Jacob Punter <[email protected]>
Co-authored-by: Nikita <[email protected]>
Co-authored-by: Ryan McCrory <[email protected]>
  • Loading branch information
12 people authored Sep 16, 2022
1 parent d3dc700 commit 390f59c
Show file tree
Hide file tree
Showing 26 changed files with 796 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
args: [--fix=lf]

- repo: https://github.com/python/black
rev: 22.6.0
rev: 22.8.0
hooks:
- id: black
language_version: python3
Expand Down Expand Up @@ -47,6 +47,6 @@ repos:
# args: [--ignore-directives=automodule]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.2
rev: v2.0.0
hooks:
- id: setup-cfg-fmt
20 changes: 20 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
Version 0.16
============

Released September 16, 2022

This release is dedicated to Queen Elizabeth II (21 April 1926 – 8 September 2022),
who lived her long life as a monarch through 2 centuries, in both happy and difficult moments,
with grace, dignity and an always inspiring strong sense of duty and warm heart.
Goodbye "Lilibet", you have symbolically been a queen, a mother and a grandmother
to a lot of us, and will be dearly missed.

- Financial market support review, new method financial_holidays(..) #694 (dr-p)
- Support for Moldova #695 (Thedand)
- Support for Bolivia #679, #698 (kasya)
- UK updates #702 (JPunter, violuke)
- Australia updates #699 (Ryan-McCrory, dr-p)
- Canada updates #710 (bkthomps)
- New Zealand updates #708, #709 (dr-p, markhoneth)
- NYSE updates #693, #696 (kasya)

Version 0.15
============

Expand Down
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ Quick Start
# the below is the same, but takes a string:
us_holidays = holidays.country_holidays('US') # this is a dict
nyse_holidays = holidays.NYSE() # this is a dict
# the below is the same, but takes a string:
nyse_holidays = holidays.financial_holidays('NYSE') # this is a dict
date(2015, 1, 1) in us_holidays # True
date(2015, 1, 2) in us_holidays # False
us_holidays.get('2014-01-01') # "New Year's Day"
Expand Down Expand Up @@ -141,6 +145,9 @@ following countries and their subdivisions are available:
* - Belgium
- BE
- None
* - Bolivia
- BO
- Departments: B, C, H, L, N, O, P, S, T
* - Botswana
- BW
- None
Expand Down Expand Up @@ -282,6 +289,9 @@ following countries and their subdivisions are available:
* - Mexico
- MX
- None
* - Moldova
- MD
- None
* - Morocco
- MA
- None
Expand Down
5 changes: 3 additions & 2 deletions docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ It is more efficient to create the object only once:
>>> date(2014, 1, 2) in us_holidays
False
You can use the :py:func:`country_holidays` function to create the object using
a string with the country code:
You can use the :py:func:`country_holidays` or :py:func:`financial_holidays`
functions to create the object using a string with the country code:

.. code-block:: python
>>> us_holidays = holidays.country_holidays('US')
>>> nyse_holidays = holidays.financial_holidays('NYSE')
Let's print out the holidays in 2014 specific to California, USA:

Expand Down
3 changes: 2 additions & 1 deletion holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
from holidays.utils import (
CountryHoliday,
country_holidays,
financial_holidays,
list_supported_countries,
list_supported_financial,
)

__version__ = "0.15"
__version__ = "0.16"
2 changes: 2 additions & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .bangladesh import Bangladesh, BD, BGD
from .belarus import Belarus, BY, BLR
from .belgium import Belgium, BE, BEL
from .bolivia import Bolivia, BO, BOL
from .botswana import Botswana, BW, BWA
from .brazil import Brazil, BR, BRA
from .bulgaria import Bulgaria, BG, BLG
Expand Down Expand Up @@ -65,6 +66,7 @@
from .malaysia import Malaysia, MY, MYS
from .malta import Malta, MT, MLT
from .mexico import Mexico, MX, MEX
from .moldova import Moldova, MD
from .morocco import Morocco, MA, MOR
from .mozambique import Mozambique, MZ, MOZ
from .namibia import Namibia, NA, NAM
Expand Down
12 changes: 7 additions & 5 deletions holidays/countries/australia.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ def _populate(self, year):
self[date(year, JUN, 1) + rd(weekday=MO(+1))] = name

# Sovereign's Birthday
if year >= 1952:
if 1952 <= year <= 2022:
name = "Queen's Birthday"
elif year > 1901:
name = "King's Birthday"
if year >= 1936:
name = "Queen's Birthday"
if self.subdiv == "QLD":
if year == 2012:
self[date(year, JUN, 11)] = "Queen's Diamond Jubilee"
Expand Down Expand Up @@ -205,12 +204,15 @@ def _populate(self, year):
if year >= 2018:
self[date(year, 5, 27) + rd(weekday=MO)] = name

# National Day of Mourning for Queen Elizabeth II
name = "National Day of Mourning for Queen Elizabeth II"
if year == 2022:
self[date(year, SEP, 22)] = name

if self.subdiv == "VIC":
# Grand Final Day
if year == 2022:
# Current planned grand final date.
# Could change at the dicression of the AFL
self[date(2022, 9, 23)] = "Grand Final Day"
self[date(2022, SEP, 23)] = "Grand Final Day"
elif year == 2020:
# Rescheduled due to COVID-19
self[date(year, OCT, 23)] = "Grand Final Day"
Expand Down
162 changes: 162 additions & 0 deletions holidays/countries/bolivia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# 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 <[email protected]> (c) 2017-2022
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)
# Copyright: Kateryna Golovanova <[email protected]>, 2022

from datetime import date

from dateutil.easter import easter
from dateutil.relativedelta import FR
from dateutil.relativedelta import relativedelta as rd
from holidays.constants import (
APR,
AUG,
DEC,
JAN,
JUL,
JUN,
MAY,
NOV,
OCT,
SEP,
SUN,
)
from holidays.holiday_base import HolidayBase


class Bolivia(HolidayBase):
"""
Bolivia holidays.
See https://en.wikipedia.org/wiki/Public_holidays_in_Bolivia for details.
"""

country = "BO"
subdivisions = [
"B",
"C",
"H",
"L",
"N",
"O",
"P",
"S",
"T",
]

def _populate(self, year):
# New Year's Day.
name = "Año Nuevo"
if year >= 1825:
self[date(year, JAN, 1)] = name

if self.observed and date(year, JAN, 1).weekday() == SUN:
self[date(year, JAN, 1) + rd(days=+1)] = f"{name} (Observed)"

# Plurinational State Foundation Day.
if year >= 2010:
self[
date(year, JAN, 22)
] = "Nacimiento del Estado Plurinacional de Bolivia"

# Good Friday.
self[easter(year) + rd(weekday=FR(-1))] = "Viernes Santo"

# La Tablada.
if self.subdiv == "T":
self[date(year, APR, 15)] = "La Tablada"

# Carnival in Oruro.
if self.subdiv == "O":
self[easter(year) + rd(days=-51)] = "Carnaval de Oruro"

# Carnival Monday (Observed on Tuesday).
name = "Feriado por Carnaval"
self[easter(year) + rd(days=-48)] = name
self[easter(year) + rd(days=-47)] = f"{name} (Observed)"

# Labor Day.
name = "Dia del trabajo"
self[date(year, MAY, 1)] = name

if self.observed and date(year, MAY, 1).weekday() == SUN:
self[date(year, MAY, 1) + rd(days=+1)] = f"{name} (Observed)"

# Chuquisaca Day.
if self.subdiv == "H":
self[date(year, MAY, 25)] = "Día del departamento de Chuquisaca"

# Corpus Christi.
self[easter(year) + rd(days=+60)] = "Corpus Christi"

# Andean New Year.
name = "Año Nuevo Andino"
if year >= 2010:
self[date(year, JUN, 21)] = name

if self.observed and date(year, JUN, 21).weekday() == SUN:
self[date(year, JUN, 21) + rd(days=+1)] = f"{name} (Observed)"

# La Paz Day.
if self.subdiv == "L":
self[date(year, JUL, 16)] = "Día del departamento de La Paz"

# Agrarian Reform Day.
if year >= 1937:
self[date(year, AUG, 2)] = "Día de la Revolución Agraria"

# Independence Day.
name = "Dia de la Patria"
if year >= 1825:
self[date(year, AUG, 6)] = name

if self.observed and date(year, AUG, 6).weekday() > 5:
self[date(year, AUG, 6) + rd(days=+1)] = f"{name} (Observed)"

# Cochabamba Day.
if self.subdiv == "C":
self[date(year, SEP, 14)] = "Día del departamento de Cochabamba"

# Santa Cruz Day.
if self.subdiv == "S":
self[date(year, SEP, 24)] = "Día del departamento de Santa Cruz"

# Pando Day.
if self.subdiv == "N":
self[date(year, OCT, 11)] = "Dia del departamento de Pando"

# All Soul's Day.
name = "Todos Santos"
self[date(year, NOV, 2)] = name

if self.observed and date(year, NOV, 2).weekday() == SUN:
self[date(year, NOV, 2) + rd(days=+1)] = f"{name} (Observed)"

# Potosí Day.
if self.subdiv == "P":
self[date(year, NOV, 10)] = "Dia del departamento de Potosí"

# Beni Day.
if self.subdiv == "B":
self[date(year, NOV, 18)] = "Dia del departamento de Beni"

# Christmas Day.
name = "Navidad"
self[date(year, DEC, 25)] = name

if self.observed and date(year, DEC, 25).weekday() == SUN:
self[date(year, DEC, 25) + rd(days=+1)] = f"{name} (Observed)"


class BO(Bolivia):
pass


class BOL(Bolivia):
pass
9 changes: 9 additions & 0 deletions holidays/countries/canada.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ def _populate(self, year):
if year >= 1894:
self[date(year, SEP, 1) + rd(weekday=MO)] = "Labour Day"

# Funeral of Queen Elizabeth II
# https://www.narcity.com/provinces-territories-will-have-a-day-off-monday-mourn-queen
# TODO: the territories holiday status (NT, NU, YT) is still tentative
queen_funeral_observers = ("BC", "NB", "NL", "NS", "PE", "YT")
if self.subdiv in queen_funeral_observers and year == 2022:
self[
date(year, SEP, 19)
] = "Funeral of Her Majesty the Queen Elizabeth II"

# National Day for Truth and Reconciliation
if self.subdiv in ("MB", "NS") and year >= 2021:
self[
Expand Down
2 changes: 1 addition & 1 deletion holidays/countries/cuba.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _populate(self, year):
2007 (NOV 19): https://bit.ly/3oFbhaZ
2013 (DEC 20): https://bit.ly/3zoO3vC
Note: for holidays that can be moved to a Monday if they fall on a
Monday, between 1984 and 2013, the State Committee of Work and
Sunday, between 1984 and 2013, the State Committee of Work and
Social Security would determine if they would be moved to the
Monday, or if they would stay on the Sunday, presumably depending
on quotas. After 2013, they always move to Monday. I could not
Expand Down
Loading

0 comments on commit 390f59c

Please sign in to comment.