-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
d3dc700
commit 390f59c
Showing
26 changed files
with
796 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.