Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-holidays for openSUSE:Factory checked in at 2022-10-11 18:03:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-holidays (Old) and /work/SRC/openSUSE:Factory/.python-holidays.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-holidays" Tue Oct 11 18:03:33 2022 rev:10 rq:1009794 version:0.16 Changes: -------- --- /work/SRC/openSUSE:Factory/python-holidays/python-holidays.changes 2022-09-29 18:15:00.555449163 +0200 +++ /work/SRC/openSUSE:Factory/.python-holidays.new.2275/python-holidays.changes 2022-10-11 18:05:58.210125579 +0200 @@ -1,0 +2,6 @@ +Tue Oct 11 09:51:34 UTC 2022 - pgaj...@suse.com + +- really update to version 0.16 +- does not require python-six + +------------------------------------------------------------------- Old: ---- holidays-0.15.tar.gz New: ---- holidays-0.16.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-holidays.spec ++++++ --- /var/tmp/diff_new_pack.aSjiEk/_old 2022-10-11 18:05:58.598126206 +0200 +++ /var/tmp/diff_new_pack.aSjiEk/_new 2022-10-11 18:05:58.602126213 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-holidays -Version: 0.15 +Version: 0.16 Release: 0 Summary: Python library for generating holidays on the fly License: MIT @@ -32,7 +32,6 @@ #BuildRequires: %%{python_module lag_baomer} BuildRequires: %{python_module python-dateutil} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six} BuildRequires: %{python_module testsuite} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -41,7 +40,6 @@ Requires: python-korean-lunar-calendar #Requires: python-lag_baomer Requires: python-python-dateutil -Requires: python-six BuildArch: noarch %python_subpackages ++++++ holidays-0.15.tar.gz -> holidays-0.16.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/CHANGES new/holidays-0.16/CHANGES --- old/holidays-0.15/CHANGES 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/CHANGES 2022-09-16 12:58:16.000000000 +0200 @@ -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 ============ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/PKG-INFO new/holidays-0.16/PKG-INFO --- old/holidays-0.15/PKG-INFO 2022-08-21 09:42:32.458479200 +0200 +++ new/holidays-0.16/PKG-INFO 2022-09-16 12:58:26.101575600 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: holidays -Version: 0.15 +Version: 0.16 Summary: Generate and work with holidays in Python Home-page: https://github.com/dr-prodigy/python-holidays Author: dr-prodigy (formerly ryanss) @@ -14,10 +14,6 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Office/Business :: Scheduling @@ -99,6 +95,10 @@ # 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" @@ -170,6 +170,9 @@ * - Belgium - BE - None + * - Bolivia + - BO + - Departments: B, C, H, L, N, O, P, S, T * - Botswana - BW - None @@ -311,6 +314,9 @@ * - Mexico - MX - None + * - Moldova + - MD + - None * - Morocco - MA - None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/README.rst new/holidays-0.16/README.rst --- old/holidays-0.15/README.rst 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/README.rst 2022-09-16 12:58:16.000000000 +0200 @@ -70,6 +70,10 @@ # 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" @@ -141,6 +145,9 @@ * - Belgium - BE - None + * - Bolivia + - BO + - Departments: B, C, H, L, N, O, P, S, T * - Botswana - BW - None @@ -282,6 +289,9 @@ * - Mexico - MX - None + * - Moldova + - MD + - None * - Morocco - MA - None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/__init__.py new/holidays-0.16/holidays/__init__.py --- old/holidays-0.15/holidays/__init__.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/__init__.py 2022-09-16 12:58:16.000000000 +0200 @@ -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" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/__init__.py new/holidays-0.16/holidays/countries/__init__.py --- old/holidays-0.15/holidays/countries/__init__.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/countries/__init__.py 2022-09-16 12:58:16.000000000 +0200 @@ -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 @@ -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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/australia.py new/holidays-0.16/holidays/countries/australia.py --- old/holidays-0.15/holidays/countries/australia.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/countries/australia.py 2022-09-16 12:58:16.000000000 +0200 @@ -116,12 +116,11 @@ 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" @@ -205,12 +204,15 @@ 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" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/bolivia.py new/holidays-0.16/holidays/countries/bolivia.py --- old/holidays-0.15/holidays/countries/bolivia.py 1970-01-01 01:00:00.000000000 +0100 +++ new/holidays-0.16/holidays/countries/bolivia.py 2022-09-16 12:58:16.000000000 +0200 @@ -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 <maurizio.mon...@gmail.com> (c) 2017-2022 +# ryanss <ryanss...@icloud.com> (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) +# Copyright: Kateryna Golovanova <k...@kgthreads.com>, 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/canada.py new/holidays-0.16/holidays/countries/canada.py --- old/holidays-0.15/holidays/countries/canada.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/countries/canada.py 2022-09-16 12:58:16.000000000 +0200 @@ -220,6 +220,15 @@ 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[ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/cuba.py new/holidays-0.16/holidays/countries/cuba.py --- old/holidays-0.15/holidays/countries/cuba.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/countries/cuba.py 2022-09-16 12:58:16.000000000 +0200 @@ -32,7 +32,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/moldova.py new/holidays-0.16/holidays/countries/moldova.py --- old/holidays-0.15/holidays/countries/moldova.py 1970-01-01 01:00:00.000000000 +0100 +++ new/holidays-0.16/holidays/countries/moldova.py 2022-09-16 12:58:16.000000000 +0200 @@ -0,0 +1,73 @@ +# 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 <maurizio.mon...@gmail.com> (c) 2017-2022 +# ryanss <ryanss...@icloud.com> (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from datetime import date + +from dateutil.easter import easter, EASTER_ORTHODOX +from dateutil.relativedelta import relativedelta as rd + +from holidays.constants import JAN, MAR, MAY, JUN, AUG, OCT, DEC +from holidays.holiday_base import HolidayBase + + +class Moldova(HolidayBase): + # https://en.wikipedia.org/wiki/Public_holidays_in_Moldova + + country = "MD" + + def __init__(self, **kwargs): + HolidayBase.__init__(self, **kwargs) + + def _populate(self, year): + + eday = easter(year, method=EASTER_ORTHODOX) + + # New Year + self[date(year, JAN, 1)] = "Anul Nou" + + # Orthodox Christmas + for day in [7, 8]: + self[date(year, JAN, day)] = "Cr??ciunul" + + # International Women's Day + self[date(year, MAR, 8)] = "Ziua International?? a Femeii" + + # Orthodox Easter + for day_after_easter in [-2, 0, 1]: + self[eday + rd(days=day_after_easter)] = "Pa??tele" + + # Pa??tele Blajinilor + self[eday + rd(days=9)] = "Pa??tele Blajinilor" + + # Labour Day + self[date(year, MAY, 1)] = "Ziua International?? a Muncii" + + # Ziua Victoriei + self[date(year, MAY, 9)] = "Ziua Victoriei" + + # International Children's Day + self[date(year, JUN, 1)] = "Ziua Copilului" + + # Ziua Independen??ei + self[date(year, AUG, 27)] = "Ziua Independen??ei" + + # Limba noastr?? + self[date(year, AUG, 31)] = "Limba noastr??" + + # Ziua National?? a Vinului + self[date(year, OCT, 8)] = "Ziua National?? a Vinului" + + # Cr??ciunul + self[date(year, DEC, 25)] = "Cr??ciunul" + + +class MD(Moldova): + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/new_zealand.py new/holidays-0.16/holidays/countries/new_zealand.py --- old/holidays-0.15/holidays/countries/new_zealand.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/countries/new_zealand.py 2022-09-16 12:58:16.000000000 +0200 @@ -114,7 +114,7 @@ self[apr25 + rd(weekday=MO)] = name + " (Observed)" # Sovereign's Birthday - if year >= 1952: + if 1952 <= year <= 2022: name = "Queen's Birthday" elif year > 1901: name = "King's Birthday" @@ -197,6 +197,10 @@ elif year == 2052: self[date(year, JUN, 21)] = name + # Queen Elizabeth II Memorial Day + if year == 2022: + self[date(year, SEP, 26)] = "Queen Elizabeth II Memorial Day" + # Labour Day name = "Labour Day" if year >= 1910: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/countries/united_kingdom.py new/holidays-0.16/holidays/countries/united_kingdom.py --- old/holidays-0.15/holidays/countries/united_kingdom.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/countries/united_kingdom.py 2022-09-16 12:58:16.000000000 +0200 @@ -15,7 +15,7 @@ from dateutil.easter import easter from dateutil.relativedelta import relativedelta as rd, MO, FR -from holidays.constants import JAN, MAR, APR, MAY, JUN, JUL, AUG, NOV, DEC +from holidays.constants import JAN, MAR, APR, MAY, JUN, JUL, AUG, SEP, NOV, DEC from holidays.constants import MON, TUE, WED, THU, FRI, SAT, SUN, WEEKEND from holidays.holiday_base import HolidayBase @@ -181,6 +181,7 @@ self[date(year, JUN, 5)] = "Diamond Jubilee of Elizabeth II" elif year == 2022: self[date(year, JUN, 3)] = "Platinum Jubilee of Elizabeth II" + self[date(year, SEP, 19)] = "State Funeral of Queen Elizabeth II" def _additional_holidays(self, year: int) -> None: # Method used to handle Isle of Man (replaced by class IsleOfMan) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/financial/european_central_bank.py new/holidays-0.16/holidays/financial/european_central_bank.py --- old/holidays-0.15/holidays/financial/european_central_bank.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/financial/european_central_bank.py 2022-09-16 12:58:16.000000000 +0200 @@ -22,7 +22,7 @@ # https://en.wikipedia.org/wiki/TARGET2 # http://www.ecb.europa.eu/press/pr/date/2000/html/pr001214_4.en.html - country = "ECB" + market = "ECB" def __init__(self, **kwargs): HolidayBase.__init__(self, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/financial/ny_stock_exchange.py new/holidays-0.16/holidays/financial/ny_stock_exchange.py --- old/holidays-0.15/holidays/financial/ny_stock_exchange.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/financial/ny_stock_exchange.py 2022-09-16 12:58:16.000000000 +0200 @@ -12,59 +12,49 @@ from datetime import date, timedelta from dateutil.easter import easter -from dateutil.relativedelta import ( - relativedelta as rd, - MO, - TU, - TH, - FR, -) - +from dateutil.relativedelta import FR, MO, TH, TU +from dateutil.relativedelta import relativedelta as rd from holidays.constants import ( - JAN, + APR, + AUG, + DEC, FEB, + JAN, + JUL, + JUN, MAR, - APR, MAY, - JUN, - JUL, - AUG, - SEP, - OCT, NOV, - DEC, + OCT, + SEP, ) - from holidays.holiday_base import HolidayBase class NewYorkStockExchange(HolidayBase): + # Official regulations: + # https://www.nyse.com/publicdocs/nyse/regulation/nyse/NYSE_Rules.pdf # https://www.nyse.com/markets/hours-calendars - # historical data: + # Historical data: # s3.amazonaws.com/armstrongeconomics-wp/2013/07/NYSE-Closings.pdf - # also available for 1901- at: - # nyseholidays.blogspot.com/2012/11/nyse-holidays-from-<year1>-<year2>.html - # where year1 ends in 01, year2 ends in 00 (e.g. 1901-1910) - country = "NYSE" + market = "NYSE" def __init__(self, **kwargs): HolidayBase.__init__(self, **kwargs) - def _get_observed(self, d, always_post=False): + def _get_observed(self, d): wdnum = d.isoweekday() - if always_post and wdnum == 6: # treat sat as sun - wdnum = 7 if wdnum == 6: return d + rd(weekday=FR(-1)) if wdnum == 7: return d + rd(weekday=MO(+1)) return d - def _set_observed_date(self, date, name, always_post=False): - date_obs = self._get_observed(date, always_post=always_post) - if date_obs == date: - self[date] = name + def _set_observed_date(self, holiday_date, name): + date_obs = self._get_observed(holiday_date) + if date_obs == holiday_date: + self[holiday_date] = name else: self[date_obs] = name + " (Observed)" @@ -72,9 +62,17 @@ ############################################################## # REGULAR HOLIDAYS ############################################################## + # NYD - nyd = date(year, JAN, 1) - self._set_observed_date(nyd, "New Year's Day", always_post=True) + # This year's New Year Day. + self._set_observed_date(date(year, JAN, 1), "New Year's Day") + + # https://www.nyse.com/publicdocs/nyse/regulation/nyse/NYSE_Rules.pdf + # As per Rule 7.2.: check if next year's NYD falls on Saturday and + # needs to be observed on Friday (Dec 31 of previous year). + dec_31 = date(year, DEC, 31) + if dec_31.isoweekday() == 5: + self._set_observed_date(dec_31 + rd(days=+1), "New Year's Day") # MLK - observed 1998 - 3rd Monday of Jan if year >= 1998: @@ -83,7 +81,7 @@ ] = "Martin Luther King Jr. Day" # LINCOLN BIRTHDAY: observed 1896 - 1953 and 1968, Feb 12 (observed) - if (year >= 1896 and year <= 1953) or year == 1968: + if (1896 <= year <= 1953) or year == 1968: lincoln = date(year, FEB, 12) self._set_observed_date(lincoln, "Lincoln's Birthday") @@ -103,14 +101,14 @@ # MEM DAY (May 30) - closed every year since 1873 # last Mon in May since 1971 - if year >= 1873 and year < 1971: + if 1873 <= year < 1971: memday = date(year, MAY, 30) self._set_observed_date(memday, "Memorial Day") else: self[date(year, MAY, 31) + rd(weekday=MO(-1))] = "Memorial Day" # FLAG DAY: June 14th 1916 - 1953 - if year >= 1916 and year <= 1953: + if 1916 <= year <= 1953: flagday = date(year, JUN, 14) self._set_observed_date(flagday, "Flag Day") @@ -130,7 +128,7 @@ self[date(year, SEP, 1) + rd(weekday=MO(1))] = "Labor Day" # COLUMBUS DAY/INDIGENOUS PPL DAY: Oct 12 - closed 1909-1953 - if year >= 1909 and year <= 1953: + if 1909 <= year <= 1953: colday = date(year, OCT, 12) self._set_observed_date(colday, "Columbus Day") @@ -142,7 +140,7 @@ self[date(year, NOV, 1) + rd(weekday=TU(1))] = "Election Day" # VETERAN'S DAY: Nov 11 - closed 1918, 1921, 1934-1953 - if year in [1918, 1921] or (year >= 1934 and year <= 1953): + if year in [1918, 1921] or (1934 <= year <= 1953): vetday = date(year, NOV, 11) self._set_observed_date(vetday, "Veteran's Day") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/holiday_base.py new/holidays-0.16/holidays/holiday_base.py --- old/holidays-0.15/holidays/holiday_base.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/holiday_base.py 2022-09-16 12:58:16.000000000 +0200 @@ -168,6 +168,8 @@ country: str """The country's ISO 3166-1 alpha-2 code.""" + market: str + """The market's ISO 3166-1 alpha-2 code.""" subdivisions: List[str] = [] """The subdivisions supported for this country (see documentation).""" years: Set[int] @@ -234,10 +236,16 @@ and subdiv not in self.subdivisions + self._deprecated_subdivisions ): - raise NotImplementedError( - f"Country {self.country} does not have subdivision " - f"'{subdiv}'" - ) + if hasattr(self, "market"): + raise NotImplementedError( + f"Market {self.market} does not have subdivision " + f"'{subdiv}'" + ) + else: + raise NotImplementedError( + f"Country {self.country} does not have subdivision " + f"'{subdiv}'" + ) if isinstance(years, int): self.years = {years} else: @@ -556,11 +564,20 @@ return super().__reduce__() def __repr__(self) -> str: + _repr = "" if len(self) == 0: - _repr = f"holidays.country_holidays({self.country!r}" - if self.subdiv: - _repr += f", subdiv={self.subdiv!r}" - _repr += ")" + if hasattr(self, "market"): + _repr = f"holidays.financial_holidays({self.market!r}" + if self.subdiv: + _repr += f", subdiv={self.subdiv!r}" + _repr += ")" + if hasattr(self, "country"): + if _repr: + _repr += " + " + _repr += f"holidays.country_holidays({self.country!r}" + if self.subdiv: + _repr += f", subdiv={self.subdiv!r}" + _repr += ")" return _repr return super().__repr__() @@ -582,6 +599,8 @@ country: Union[str, List[str]] # type: ignore[assignment] """Countries included in the addition.""" + market: Union[str, List[str]] # type: ignore[assignment] + """Markets included in the addition.""" subdiv: Optional[Union[str, List[str]]] # type: ignore[assignment] """Subdivisions included in the addition.""" holidays: List[HolidayBase] @@ -643,10 +662,12 @@ # country=["IT", "US"] and subdiv=["CA", "MS", "MI"], which could very # well be California and Messina and Milano, or Catania, Mississippi # and Milano, or ... you get the picture. - for attr in ("country", "subdiv"): + # Same goes when countries and markets are being mixed (working, yet + # still nonsensical) + for attr in ("country", "market", "subdiv"): if ( - getattr(h1, attr) - and getattr(h2, attr) + getattr(h1, attr, None) + and getattr(h2, attr, None) and getattr(h1, attr) != getattr(h2, attr) ): a1 = ( @@ -661,10 +682,13 @@ ) kwargs[attr] = a1 + a2 else: - kwargs[attr] = getattr(h1, attr, None) or getattr( - h2, attr, None - ) - self.country = kwargs.pop("country") + arg = getattr(h1, attr, None) or getattr(h2, attr, None) + if arg: + kwargs[attr] = arg + if kwargs.__contains__("market"): + self.market = kwargs.pop("market") + if kwargs.__contains__("country"): + self.country = kwargs.pop("country") HolidayBase.__init__(self, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays/utils.py new/holidays-0.16/holidays/utils.py --- old/holidays-0.15/holidays/utils.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/holidays/utils.py 2022-09-16 12:58:16.000000000 +0200 @@ -188,6 +188,65 @@ return country_holiday +def financial_holidays( + market: str, + subdiv: Optional[str] = None, + years: Optional[Union[int, Iterable[int]]] = None, + expand: bool = True, + observed: bool = True, +) -> HolidayBase: + """ + Returns a new dictionary-like :py:class:`HolidayBase` object for the public + holidays of the financial market matching **market** and other keyword + arguments. + + :param market: + An ISO 3166-1 Alpha-2 market code. + + :param subdiv: + Currently not implemented for markets (see documentation). + + :param years: + The year(s) to pre-calculate public holidays for at instantiation. + + :param expand: + Whether the entire year is calculated when one date from that year + is requested. + + :param observed: + Whether to include the dates of when public holiday are observed + (e.g. a holiday falling on a Sunday being observed the following + Monday). False may not work for all countries. + + :return: + A :py:class:`HolidayBase` object matching the **market**. + + Example usage: + + >>> from holidays import financial_holidays + >>> nyse_holidays = financial_holidays('NYSE') + + See :py:func:`country_holidays` documentation for further details and + examples. + """ + try: + financial_classes = inspect.getmembers( + holidays.financial, inspect.isclass + ) + financial_class = next( + obj for name, obj in financial_classes if name == market + ) + financial_holiday: HolidayBase = financial_class( + years=years, + subdiv=subdiv, + expand=expand, + observed=observed, + ) + except StopIteration: + raise NotImplementedError(f"Financial market {market} not available") + return financial_holiday + + def CountryHoliday( country: str, subdiv: Optional[str] = None, @@ -238,7 +297,7 @@ the value is a list of supported subdivision codes. """ return { - obj.country: obj.subdivisions + obj.market: obj.subdivisions for name, obj in inspect.getmembers( holidays.financial, inspect.isclass ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays.egg-info/PKG-INFO new/holidays-0.16/holidays.egg-info/PKG-INFO --- old/holidays-0.15/holidays.egg-info/PKG-INFO 2022-08-21 09:42:32.000000000 +0200 +++ new/holidays-0.16/holidays.egg-info/PKG-INFO 2022-09-16 12:58:26.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: holidays -Version: 0.15 +Version: 0.16 Summary: Generate and work with holidays in Python Home-page: https://github.com/dr-prodigy/python-holidays Author: dr-prodigy (formerly ryanss) @@ -14,10 +14,6 @@ Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.7 -Classifier: Programming Language :: Python :: 3.8 -Classifier: Programming Language :: Python :: 3.9 -Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Office/Business :: Scheduling @@ -99,6 +95,10 @@ # 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" @@ -170,6 +170,9 @@ * - Belgium - BE - None + * - Bolivia + - BO + - Departments: B, C, H, L, N, O, P, S, T * - Botswana - BW - None @@ -311,6 +314,9 @@ * - Mexico - MX - None + * - Moldova + - MD + - None * - Morocco - MA - None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/holidays.egg-info/SOURCES.txt new/holidays-0.16/holidays.egg-info/SOURCES.txt --- old/holidays-0.15/holidays.egg-info/SOURCES.txt 2022-08-21 09:42:32.000000000 +0200 +++ new/holidays-0.16/holidays.egg-info/SOURCES.txt 2022-09-16 12:58:26.000000000 +0200 @@ -26,6 +26,7 @@ holidays/countries/bangladesh.py holidays/countries/belarus.py holidays/countries/belgium.py +holidays/countries/bolivia.py holidays/countries/botswana.py holidays/countries/brazil.py holidays/countries/bulgaria.py @@ -73,6 +74,7 @@ holidays/countries/malaysia.py holidays/countries/malta.py holidays/countries/mexico.py +holidays/countries/moldova.py holidays/countries/morocco.py holidays/countries/mozambique.py holidays/countries/namibia.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/setup.cfg new/holidays-0.16/setup.cfg --- old/holidays-0.15/setup.cfg 2022-08-21 09:42:32.458479200 +0200 +++ new/holidays-0.16/setup.cfg 2022-09-16 12:58:26.101575600 +0200 @@ -18,10 +18,6 @@ Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Office/Business :: Scheduling @@ -44,7 +40,7 @@ holidays = py.typed [bumpversion] -current_version = 0.15 +current_version = 0.16 [flake8] extend-ignore = E203,F401,W503,W504 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/holidays-0.15/test/test_holiday_base.py new/holidays-0.16/test/test_holiday_base.py --- old/holidays-0.15/test/test_holiday_base.py 2022-08-21 09:42:23.000000000 +0200 +++ new/holidays-0.16/test/test_holiday_base.py 2022-09-16 12:58:16.000000000 +0200 @@ -560,9 +560,6 @@ NotImplementedError, lambda: holidays.country_holidays("XXXX") ) self.assertRaises( - NotImplementedError, lambda: holidays.country_holidays("XXXX") - ) - self.assertRaises( NotImplementedError, lambda: holidays.country_holidays("US", subdiv="XXXX"), ) @@ -571,6 +568,31 @@ ) +class TestFinancialHolidays(unittest.TestCase): + def setUp(self): + self.holidays = holidays.financial_holidays("NYSE") + + def test_market(self): + self.assertEqual(self.holidays.market, "NYSE") + + def test_market_single_year(self): + h = holidays.financial_holidays("NYSE", years=2021) + self.assertEqual(h.years, {2021}) + + def test_market_years(self): + h = holidays.financial_holidays("NYSE", years=[2015, 2016]) + self.assertEqual(h.years, {2015, 2016}) + + def test_exceptions(self): + self.assertRaises( + NotImplementedError, lambda: holidays.financial_holidays("XXXX") + ) + self.assertRaises( + NotImplementedError, + lambda: holidays.financial_holidays("NYSE", subdiv="XXXX"), + ) + + class TestAllInSameYear(unittest.TestCase): """Test that only holidays in the year(s) requested are returned."""