[Python-modules-commits] [python-holidays] 01/11: Import python-holidays_0.9.3.orig.tar.gz
Ondrej Novy
onovy at debian.org
Sun Feb 4 11:15:55 UTC 2018
This is an automated email from the git hooks/post-receive script.
onovy pushed a commit to branch master
in repository python-holidays.
commit bfb339a6dc81bdc81ac0eb3d054b31233f1362e7
Author: Ondřej Nový <onovy at debian.org>
Date: Sun Feb 4 11:48:17 2018 +0100
Import python-holidays_0.9.3.orig.tar.gz
---
LICENSE | 1 +
PKG-INFO | 50 +--
README.rst | 35 +-
holidays.egg-info/PKG-INFO | 50 +--
holidays.egg-info/requires.txt | 1 +
holidays.py | 755 +++++++++++++++++++++++++++++++++++++++--
setup.cfg | 1 -
setup.py | 19 +-
tests.py | 692 ++++++++++++++++++++++++++++++++++---
9 files changed, 1474 insertions(+), 130 deletions(-)
diff --git a/LICENSE b/LICENSE
index 91d144c..90027b1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,5 @@
Copyright (c) 2014-2017 <ryanssdev at icloud.com>
+Copyright (c) 2018 <maurizio.montel at gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/PKG-INFO b/PKG-INFO
index 5b0bea6..fa98625 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,12 @@
Metadata-Version: 1.1
Name: holidays
-Version: 0.8.1
+Version: 0.9.3
Summary: Generate and work with holidays in Python
-Home-page: https://github.com/ryanss/python-holidays
-Author: ryanss
-Author-email: ryanssdev at icloud.com
+Home-page: https://github.com/dr-prodigy/python-holidays
+Author: dr-prodigy
+Author-email: maurizio.montel at gmail.com
License: MIT
+Description-Content-Type: UNKNOWN
Description: ===============
python-holidays
===============
@@ -14,17 +15,17 @@ Description: ===============
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.
- .. image:: http://img.shields.io/travis/ryanss/python-holidays.svg
- :target: https://travis-ci.org/ryanss/python-holidays
+ .. image:: http://img.shields.io/travis/dr-prodigy/python-holidays.svg
+ :target: https://travis-ci.org/dr-prodigy/python-holidays
- .. image:: http://img.shields.io/coveralls/ryanss/python-holidays.svg
- :target: https://coveralls.io/r/ryanss/python-holidays
+ .. image:: http://img.shields.io/coveralls/dr-prodigy/python-holidays.svg
+ :target: https://coveralls.io/r/dr-prodigy/python-holidays
.. image:: http://img.shields.io/pypi/v/holidays.svg
:target: https://pypi.python.org/pypi/holidays
.. image:: http://img.shields.io/pypi/l/holidays.svg
- :target: https://github.com/ryanss/python-holidays/blob/master/LICENSE
+ :target: https://github.com/dr-prodigy/python-holidays/blob/master/LICENSE
Example Usage
@@ -93,6 +94,7 @@ Description: ===============
=================== ======== =============================================================
Australia AU prov = **ACT** (default), NSW, NT, QLD, SA, TAS, VIC, WA
Austria AT prov = B, K, N, O, S, ST, T, V, **W** (default)
+ Belgium BE None
Canada CA prov = AB, BC, MB, NB, NL, NS, NT, NU, **ON** (default),
PE, QC, SK, YU
Colombia CO None
@@ -100,21 +102,33 @@ Description: ===============
Denmark DK None
England None
EuropeanCentralBank ECB,TAR Trans-European Automated Real-time Gross Settlement (TARGET2)
+ Finland FI None
+ France FRA **Métropole** (default), Alsace-Moselle, Guadeloupe, Guyane,
+ Martinique, Mayotte, Nouvelle-Calédonie, La Réunion,
+ Polynésie Française, Saint-Barthélémy, Saint-Martin,
+ Wallis-et-Futuna
Germany DE BW, BY, BE, BB, HB, HH, HE, MV, NI, NW, RP, SL, SN, ST,
SH, TH
- Ireland None
+ Ireland IE
Isle of Man None
+ Italy IT prov = MI, RM
+ Japan JP None
Mexico MX None
Netherlands NL None
NewZealand NZ prov = NTL, AUK, TKI, HKB, WGN, MBH, NSN, CAN, STC, WTL,
OTA, STL, CIT
Northern Ireland None
Norway NO None
+ Polish PL None
Portugal PT None
PortugalExt PTE *Portugal plus extended days most people have off*
Scotland None
+ Slovenia SI None
+ Slovakia SK None
+ South Africa ZA None
Spain ES prov = AND, ARG, AST, CAN, CAM, CAL, CAT, CVA, EXT, GAL,
IBA, ICA, MAD, MUR, NAV, PVA, RIO
+ Sweden SE None
UnitedKingdom UK None
UnitedStates US state = AL, AK, AS, AZ, AR, CA, CO, CT, DE, DC, FL, GA,
GU, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MH, MA, MI,
@@ -212,7 +226,7 @@ Description: ===============
# Let's print out the holidays in 2014 specific to California, USA
>>> for date, name in sorted(holidays.US(state='CA', years=2014).items()):
- >>> print date, name
+ >>> print(date, name)
2014-01-01 New Year's Day
2014-01-20 Martin Luther King, Jr. Day
2014-02-15 Susan B. Anthony Day
@@ -371,7 +385,7 @@ Description: ===============
.. code-block:: bash
- $ pip install --upgrade https://github.com/ryanss/python-holidays/tarball/master
+ $ pip install --upgrade https://github.com/dr-prodigy/python-holidays/tarball/master
Running Tests
@@ -397,8 +411,8 @@ Description: ===============
Contributions
-------------
- .. _issues: https://github.com/ryanss/python-holidays/issues
- .. __: https://github.com/ryanss/python-holidays/pulls
+ .. _issues: https://github.com/dr-prodigy/python-holidays/issues
+ .. __: https://github.com/dr-prodigy/python-holidays/pulls
Issues_ and `Pull Requests`__ are always welcome.
@@ -406,7 +420,7 @@ Description: ===============
License
-------
- .. __: https://github.com/ryanss/python-holidays/raw/master/LICENSE
+ .. __: https://github.com/dr-prodigy/python-holidays/raw/master/LICENSE
Code and documentation are available according to the MIT License
(see LICENSE__).
@@ -418,14 +432,12 @@ Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business :: Scheduling
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/README.rst b/README.rst
index 1573b7a..31038b9 100644
--- a/README.rst
+++ b/README.rst
@@ -6,17 +6,17 @@ 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.
-.. image:: http://img.shields.io/travis/ryanss/python-holidays.svg
- :target: https://travis-ci.org/ryanss/python-holidays
+.. image:: http://img.shields.io/travis/dr-prodigy/python-holidays.svg
+ :target: https://travis-ci.org/dr-prodigy/python-holidays
-.. image:: http://img.shields.io/coveralls/ryanss/python-holidays.svg
- :target: https://coveralls.io/r/ryanss/python-holidays
+.. image:: http://img.shields.io/coveralls/dr-prodigy/python-holidays.svg
+ :target: https://coveralls.io/r/dr-prodigy/python-holidays
.. image:: http://img.shields.io/pypi/v/holidays.svg
:target: https://pypi.python.org/pypi/holidays
.. image:: http://img.shields.io/pypi/l/holidays.svg
- :target: https://github.com/ryanss/python-holidays/blob/master/LICENSE
+ :target: https://github.com/dr-prodigy/python-holidays/blob/master/LICENSE
Example Usage
@@ -85,6 +85,7 @@ Country Abbr Provinces/States Available
=================== ======== =============================================================
Australia AU prov = **ACT** (default), NSW, NT, QLD, SA, TAS, VIC, WA
Austria AT prov = B, K, N, O, S, ST, T, V, **W** (default)
+Belgium BE None
Canada CA prov = AB, BC, MB, NB, NL, NS, NT, NU, **ON** (default),
PE, QC, SK, YU
Colombia CO None
@@ -92,21 +93,33 @@ Czech CZ None
Denmark DK None
England None
EuropeanCentralBank ECB,TAR Trans-European Automated Real-time Gross Settlement (TARGET2)
+Finland FI None
+France FRA **Métropole** (default), Alsace-Moselle, Guadeloupe, Guyane,
+ Martinique, Mayotte, Nouvelle-Calédonie, La Réunion,
+ Polynésie Française, Saint-Barthélémy, Saint-Martin,
+ Wallis-et-Futuna
Germany DE BW, BY, BE, BB, HB, HH, HE, MV, NI, NW, RP, SL, SN, ST,
SH, TH
-Ireland None
+Ireland IE
Isle of Man None
+Italy IT prov = MI, RM
+Japan JP None
Mexico MX None
Netherlands NL None
NewZealand NZ prov = NTL, AUK, TKI, HKB, WGN, MBH, NSN, CAN, STC, WTL,
OTA, STL, CIT
Northern Ireland None
Norway NO None
+Polish PL None
Portugal PT None
PortugalExt PTE *Portugal plus extended days most people have off*
Scotland None
+Slovenia SI None
+Slovakia SK None
+South Africa ZA None
Spain ES prov = AND, ARG, AST, CAN, CAM, CAL, CAT, CVA, EXT, GAL,
IBA, ICA, MAD, MUR, NAV, PVA, RIO
+Sweden SE None
UnitedKingdom UK None
UnitedStates US state = AL, AK, AS, AZ, AR, CA, CO, CT, DE, DC, FL, GA,
GU, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MH, MA, MI,
@@ -204,7 +217,7 @@ More Examples
# Let's print out the holidays in 2014 specific to California, USA
>>> for date, name in sorted(holidays.US(state='CA', years=2014).items()):
- >>> print date, name
+ >>> print(date, name)
2014-01-01 New Year's Day
2014-01-20 Martin Luther King, Jr. Day
2014-02-15 Susan B. Anthony Day
@@ -363,7 +376,7 @@ The latest development version can be installed directly from GitHub:
.. code-block:: bash
- $ pip install --upgrade https://github.com/ryanss/python-holidays/tarball/master
+ $ pip install --upgrade https://github.com/dr-prodigy/python-holidays/tarball/master
Running Tests
@@ -389,8 +402,8 @@ Coverage
Contributions
-------------
-.. _issues: https://github.com/ryanss/python-holidays/issues
-.. __: https://github.com/ryanss/python-holidays/pulls
+.. _issues: https://github.com/dr-prodigy/python-holidays/issues
+.. __: https://github.com/dr-prodigy/python-holidays/pulls
Issues_ and `Pull Requests`__ are always welcome.
@@ -398,7 +411,7 @@ Issues_ and `Pull Requests`__ are always welcome.
License
-------
-.. __: https://github.com/ryanss/python-holidays/raw/master/LICENSE
+.. __: https://github.com/dr-prodigy/python-holidays/raw/master/LICENSE
Code and documentation are available according to the MIT License
(see LICENSE__).
diff --git a/holidays.egg-info/PKG-INFO b/holidays.egg-info/PKG-INFO
index 5b0bea6..fa98625 100644
--- a/holidays.egg-info/PKG-INFO
+++ b/holidays.egg-info/PKG-INFO
@@ -1,11 +1,12 @@
Metadata-Version: 1.1
Name: holidays
-Version: 0.8.1
+Version: 0.9.3
Summary: Generate and work with holidays in Python
-Home-page: https://github.com/ryanss/python-holidays
-Author: ryanss
-Author-email: ryanssdev at icloud.com
+Home-page: https://github.com/dr-prodigy/python-holidays
+Author: dr-prodigy
+Author-email: maurizio.montel at gmail.com
License: MIT
+Description-Content-Type: UNKNOWN
Description: ===============
python-holidays
===============
@@ -14,17 +15,17 @@ Description: ===============
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.
- .. image:: http://img.shields.io/travis/ryanss/python-holidays.svg
- :target: https://travis-ci.org/ryanss/python-holidays
+ .. image:: http://img.shields.io/travis/dr-prodigy/python-holidays.svg
+ :target: https://travis-ci.org/dr-prodigy/python-holidays
- .. image:: http://img.shields.io/coveralls/ryanss/python-holidays.svg
- :target: https://coveralls.io/r/ryanss/python-holidays
+ .. image:: http://img.shields.io/coveralls/dr-prodigy/python-holidays.svg
+ :target: https://coveralls.io/r/dr-prodigy/python-holidays
.. image:: http://img.shields.io/pypi/v/holidays.svg
:target: https://pypi.python.org/pypi/holidays
.. image:: http://img.shields.io/pypi/l/holidays.svg
- :target: https://github.com/ryanss/python-holidays/blob/master/LICENSE
+ :target: https://github.com/dr-prodigy/python-holidays/blob/master/LICENSE
Example Usage
@@ -93,6 +94,7 @@ Description: ===============
=================== ======== =============================================================
Australia AU prov = **ACT** (default), NSW, NT, QLD, SA, TAS, VIC, WA
Austria AT prov = B, K, N, O, S, ST, T, V, **W** (default)
+ Belgium BE None
Canada CA prov = AB, BC, MB, NB, NL, NS, NT, NU, **ON** (default),
PE, QC, SK, YU
Colombia CO None
@@ -100,21 +102,33 @@ Description: ===============
Denmark DK None
England None
EuropeanCentralBank ECB,TAR Trans-European Automated Real-time Gross Settlement (TARGET2)
+ Finland FI None
+ France FRA **Métropole** (default), Alsace-Moselle, Guadeloupe, Guyane,
+ Martinique, Mayotte, Nouvelle-Calédonie, La Réunion,
+ Polynésie Française, Saint-Barthélémy, Saint-Martin,
+ Wallis-et-Futuna
Germany DE BW, BY, BE, BB, HB, HH, HE, MV, NI, NW, RP, SL, SN, ST,
SH, TH
- Ireland None
+ Ireland IE
Isle of Man None
+ Italy IT prov = MI, RM
+ Japan JP None
Mexico MX None
Netherlands NL None
NewZealand NZ prov = NTL, AUK, TKI, HKB, WGN, MBH, NSN, CAN, STC, WTL,
OTA, STL, CIT
Northern Ireland None
Norway NO None
+ Polish PL None
Portugal PT None
PortugalExt PTE *Portugal plus extended days most people have off*
Scotland None
+ Slovenia SI None
+ Slovakia SK None
+ South Africa ZA None
Spain ES prov = AND, ARG, AST, CAN, CAM, CAL, CAT, CVA, EXT, GAL,
IBA, ICA, MAD, MUR, NAV, PVA, RIO
+ Sweden SE None
UnitedKingdom UK None
UnitedStates US state = AL, AK, AS, AZ, AR, CA, CO, CT, DE, DC, FL, GA,
GU, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MH, MA, MI,
@@ -212,7 +226,7 @@ Description: ===============
# Let's print out the holidays in 2014 specific to California, USA
>>> for date, name in sorted(holidays.US(state='CA', years=2014).items()):
- >>> print date, name
+ >>> print(date, name)
2014-01-01 New Year's Day
2014-01-20 Martin Luther King, Jr. Day
2014-02-15 Susan B. Anthony Day
@@ -371,7 +385,7 @@ Description: ===============
.. code-block:: bash
- $ pip install --upgrade https://github.com/ryanss/python-holidays/tarball/master
+ $ pip install --upgrade https://github.com/dr-prodigy/python-holidays/tarball/master
Running Tests
@@ -397,8 +411,8 @@ Description: ===============
Contributions
-------------
- .. _issues: https://github.com/ryanss/python-holidays/issues
- .. __: https://github.com/ryanss/python-holidays/pulls
+ .. _issues: https://github.com/dr-prodigy/python-holidays/issues
+ .. __: https://github.com/dr-prodigy/python-holidays/pulls
Issues_ and `Pull Requests`__ are always welcome.
@@ -406,7 +420,7 @@ Description: ===============
License
-------
- .. __: https://github.com/ryanss/python-holidays/raw/master/LICENSE
+ .. __: https://github.com/dr-prodigy/python-holidays/raw/master/LICENSE
Code and documentation are available according to the MIT License
(see LICENSE__).
@@ -418,14 +432,12 @@ Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
-Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business :: Scheduling
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/holidays.egg-info/requires.txt b/holidays.egg-info/requires.txt
index 0f08daa..d87e947 100644
--- a/holidays.egg-info/requires.txt
+++ b/holidays.egg-info/requires.txt
@@ -1 +1,2 @@
python-dateutil
+six
diff --git a/holidays.py b/holidays.py
index ecb463a..8ba4133 100644
--- a/holidays.py
+++ b/holidays.py
@@ -6,8 +6,9 @@
# 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.
#
-# Author: ryanss <ryanssdev at icloud.com>
-# Website: https://github.com/ryanss/python-holidays
+# Author: ryanss <ryanssdev at icloud.com> (c) 2014-2017
+# dr-prodigy <maurizio.montel at gmail.com> (c) 2018
+# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)
from datetime import date, datetime
@@ -17,7 +18,7 @@ from dateutil.relativedelta import relativedelta as rd
from dateutil.relativedelta import MO, TU, WE, TH, FR, SA, SU
import six
-__version__ = '0.8.1'
+__version__ = '0.9.3'
MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY = range(7)
@@ -68,7 +69,7 @@ class HolidayBase(dict):
elif isinstance(key, six.string_types):
try:
key = parse(key).date()
- except:
+ except (ValueError, OverflowError):
raise ValueError("Cannot parse date from string '%s'" % key)
else:
raise TypeError("Cannot convert type '%s' to date." % type(key))
@@ -119,10 +120,10 @@ class HolidayBase(dict):
return dict.pop(self, self.__keytransform__(key), default)
def __eq__(self, other):
- return (dict.__eq__(self, other) and self.__dict__ == other.__dict__)
+ return dict.__eq__(self, other) and self.__dict__ == other.__dict__
def __ne__(self, other):
- return (dict.__ne__(self, other) or self.__dict__ != other.__dict__)
+ return dict.__ne__(self, other) or self.__dict__ != other.__dict__
def __add__(self, other):
if isinstance(other, int) and other == 0:
@@ -276,11 +277,11 @@ class Canada(HolidayBase):
else:
self[dt1] = "St. George's Day"
- # Victoria Day / National Patriotes Day (QC)
+ # Victoria Day / National Patriots' Day (QC)
if self.prov not in ('NB', 'NS', 'PE', 'NL', 'QC') and year >= 1953:
self[date(year, 5, 24) + rd(weekday=MO(-1))] = "Victoria Day"
elif self.prov == 'QC' and year >= 1953:
- name = "National Patriotes Day"
+ name = "National Patriots' Day"
self[date(year, 5, 24) + rd(weekday=MO(-1))] = name
# National Aboriginal Day
@@ -693,7 +694,7 @@ class UnitedStates(HolidayBase):
# Lincoln's Birthday
name = "Lincoln's Birthday"
if (self.state in ('CT', 'IL', 'IA', 'NJ', 'NY') and year >= 1971) \
- or (self.state == 'CA' and year >= 1971 and year <= 2009):
+ or (self.state == 'CA' and 1971 <= year <= 2009):
self[date(year, 2, 12)] = name
if self.observed and date(year, 2, 12).weekday() == 5:
self[date(year, 2, 11)] = name + " (Observed)"
@@ -1394,11 +1395,13 @@ class Australia(HolidayBase):
name = "Queen's Birthday"
if self.prov == 'QLD':
if year == 2012:
- self[date(year, 10, 1)] = name
self[date(year, 6, 11)] = "Queen's Diamond Jubilee"
- else:
+ if year < 2016 and year != 2012:
dt = date(year, 6, 1) + rd(weekday=MO(+2))
self[dt] = name
+ else:
+ dt = date(year, 10, 1) + rd(weekday=MO)
+ self[dt] = name
elif self.prov == 'WA':
# by proclamation ?!?!
self[date(year, 10, 1) + rd(weekday=MO(-1))] = name
@@ -1477,6 +1480,14 @@ class Australia(HolidayBase):
name = "Melbourne Cup"
self[date(year, 11, 1) + rd(weekday=TU)] = name
+ # The Royal Queensland Show (Ekka)
+ # The Show starts on the first Friday of August - providing this is
+ # not prior to the 5th - in which case it will begin on the second
+ # Friday. The Wednesday during the show is a public holiday.
+ if self.prov == 'QLD':
+ name = "The Royal Queensland Show"
+ self[date(year, 8, 5) + rd(weekday=FR) + rd(weekday=WE)] = name
+
# Christmas Day
name = "Christmas Day"
dec25 = date(year, 12, 25)
@@ -1500,7 +1511,7 @@ class AU(Australia):
class Germany(HolidayBase):
- """Official holidays for Germany in it's current form.
+ """Official holidays for Germany in its current form.
This class doesn't return any holidays before 1990-10-03.
@@ -1518,7 +1529,7 @@ class Germany(HolidayBase):
are some weired edge cases:
- "Mariä Himmelfahrt" is only a holiday in Bavaria (BY) if your
- municipality is mothly catholic which in term depends on census data.
+ municipality is mostly catholic which in term depends on census data.
Since we don't have this data but most municipalities in Bavaria
*are* mostly catholic, we count that as holiday for whole Bavaria.
- There is an "Augsburger Friedensfest" which only exists in the town
@@ -1584,6 +1595,11 @@ class Germany(HolidayBase):
if self.prov in ('BB', 'MV', 'SN', 'ST', 'TH'):
self[date(year, 10, 31)] = 'Reformationstag'
+ # in 2017 all states got the Reformationstag (500th anniversary of
+ # Luther's thesis)
+ if year == 2017:
+ self[date(year, 10, 31)] = 'Reformationstag'
+
if self.prov in ('BW', 'BY', 'NW', 'RP', 'SL'):
self[date(year, 11, 1)] = 'Allerheiligen'
@@ -1776,7 +1792,7 @@ class UnitedKingdom(HolidayBase):
# October Bank Holiday (last Monday in October)
if self.country == 'Ireland':
name = "October Bank Holiday"
- self[date(year, 8, 31) + rd(weekday=MO(-1))] = name
+ self[date(year, 10, 31) + rd(weekday=MO(-1))] = name
# St. Andrew's Day
if self.country in ('UK', 'Scotland'):
@@ -1863,6 +1879,10 @@ class Ireland(UnitedKingdom):
HolidayBase.__init__(self, **kwargs)
+class IE(Ireland):
+ pass
+
+
class Spain(HolidayBase):
PROVINCES = ['AND', 'ARG', 'AST', 'CAN', 'CAM', 'CAL', 'CAT', 'CVA',
'EXT', 'GAL', 'IBA', 'ICA', 'MAD', 'MUR', 'NAV', 'PVA', 'RIO']
@@ -1874,7 +1894,7 @@ class Spain(HolidayBase):
def _populate(self, year):
self[date(year, 1, 1)] = "Año nuevo"
- self[date(year, 1, 6)] = "Epifanía del Senyor"
+ self[date(year, 1, 6)] = "Epifanía del Señor"
if self.prov and self.prov in ['CVA', 'MUR', 'MAD', 'NAV', 'PVA']:
self[date(year, 3, 19)] = "San José"
if self.prov and self.prov != 'CAT':
@@ -1885,7 +1905,8 @@ class Spain(HolidayBase):
self[date(year, 5, 1)] = "Día del Trabajador"
if self.prov and self.prov in ['CAT', 'GAL']:
self[date(year, 6, 24)] = "San Juan"
- self[date(year, 8, 15)] = "Assunción de la Virgen"
+ self[date(year, 8, 15)] = "Asunción de la Virgen"
+ self[date(year, 10, 12)] = "Día de la Hispanidad"
self[date(year, 11, 1)] = "Todos los Santos"
self[date(year, 12, 6)] = "Día de la constitución Española"
self[date(year, 12, 8)] = "La Inmaculada Concepción"
@@ -1973,7 +1994,8 @@ class Czech(HolidayBase):
"Nový rok"
e = easter(year)
- self[e - rd(days=2)] = "Velký pátek"
+ if year <= 1951 or year >= 2016:
+ self[e - rd(days=2)] = "Velký pátek"
self[e + rd(days=1)] = "Velikonoční pondělí"
if year >= 1951:
@@ -2005,6 +2027,91 @@ class CZ(Czech):
pass
+class Slovak(HolidayBase):
+ # https://sk.wikipedia.org/wiki/Sviatok
+ # https://www.slov-lex.sk/pravne-predpisy/SK/ZZ/1993/241/20160101
+
+ def __init__(self, **kwargs):
+ self.country = 'SK'
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ self[date(year, 1, 1)] = "Deň vzniku Slovenskej republiky" \
+
+ self[date(year, 1, 6)] = "Zjavenie Pána (Traja králi a vianočný" \
+ "sviatok pravoslávnych kresťanov)"
+
+ e = easter(year)
+ self[e - rd(days=2)] = "Veľký piatok"
+ self[e + rd(days=1)] = "Veľkonočný pondelok"
+
+ self[date(year, 5, 1)] = "Sviatok práce"
+
+ if year >= 1997:
+ self[date(year, 5, 8)] = "Deň víťazstva nad fašizmom"
+
+ self[date(year, 7, 5)] = "Sviatok svätého Cyrila a svätého Metoda"
+
+ self[date(year, 8, 29)] = "Výročie Slovenského národného povstania"
+
+ self[date(year, 9, 1)] = "Deň Ústavy Slovenskej republiky"
+
+ self[date(year, 9, 15)] = "Sedembolestná Panna Mária"
+
+ self[date(year, 11, 1)] = "Sviatok Všetkých svätých"
+
+ if year >= 2001:
+ self[date(year, 11, 17)] = "Deň boja za slobodu a demokraciu"
+
+ self[date(year, 12, 24)] = "Štedrý deň"
+
+ self[date(year, 12, 25)] = "Prvý sviatok vianočný"
+
+ self[date(year, 12, 26)] = "Druhý sviatok vianočný"
+
+
+class SK(Slovak):
+ pass
+
+
+class Polish(HolidayBase):
+ # https://pl.wikipedia.org/wiki/Dni_wolne_od_pracy_w_Polsce
+
+ def __init__(self, **kwargs):
+ self.country = 'PL'
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ self[date(year, 1, 1)] = 'Nowy Rok'
+ if year >= 2011:
+ self[date(year, 1, 6)] = 'Święto Trzech Króli'
+
+ e = easter(year)
+ self[e] = 'Niedziela Wielkanocna'
+ self[e + rd(days=1)] = 'Poniedziałek Wielkanocny'
+
+ if year >= 1950:
+ self[date(year, 5, 1)] = 'Święto Państwowe'
+ if year >= 1919:
+ self[date(year, 5, 3)] = 'Święto Narodowe Trzeciego Maja'
+
+ self[e + rd(days=49)] = 'Zielone Świątki'
+ self[e + rd(days=60)] = 'Dzień Bożego Ciała'
+
+ self[date(year, 8, 15)] = 'Wniebowzięcie Najświętszej Marii Panny'
+
+ self[date(year, 11, 1)] = 'Uroczystość Wszystkich świętych'
+ if (1937 <= year <= 1945) or year >= 1989:
+ self[date(year, 11, 11)] = 'Narodowe Święto Niepodległości'
+
+ self[date(year, 12, 25)] = 'Boże Narodzenie (pierwszy dzień)'
+ self[date(year, 12, 26)] = 'Boże Narodzenie (drugi dzień)'
+
+
+class PL(Polish):
+ pass
+
+
class Portugal(HolidayBase):
# https://en.wikipedia.org/wiki/Public_holidays_in_Portugal
@@ -2017,8 +2124,8 @@ class Portugal(HolidayBase):
e = easter(year)
- # carnival is no longer a holyday, but some companies let workers off.
- # @todo recollect the years in which it was a public holyday
+ # carnival is no longer a holiday, but some companies let workers off.
+ # @todo recollect the years in which it was a public holiday
# self[e - rd(days=47)] = "Carnaval"
self[e - rd(days=2)] = "Sexta-feira Santa"
self[e] = "Páscoa"
@@ -2048,7 +2155,7 @@ class PortugalExt(Portugal):
- Carnival
- the day before and after xmas
- the day before the new year
- - Lisbon's city holyday
+ - Lisbon's city holiday
"""
def _populate(self, year):
super(PortugalExt, self)._populate(year)
@@ -2073,7 +2180,7 @@ class Netherlands(HolidayBase):
SUNDAY = 6
def __init__(self, **kwargs):
- # http://www.iamsterdam.com/en/visiting/plan-your-trip/practical-info/public-holidays
+ # http://www.iamsterdam.com/en/plan-your-trip/practical-info/public-holidays
self.country = "NL"
HolidayBase.__init__(self, **kwargs)
@@ -2105,7 +2212,7 @@ class Netherlands(HolidayBase):
self[date(year, 12, 26)] = "Tweede Kerstdag"
# Liberation day
- if year >= 1947 and year <= 2000:
+ if year >= 1945 and year % 5 == 0:
self[date(year, 5, 5)] = "Bevrijdingsdag"
# Kingsday
@@ -2117,7 +2224,7 @@ class Netherlands(HolidayBase):
self[kings_day] = "Koningsdag"
# Queen's day
- if year >= 1891 and year <= 2013:
+ if 1891 <= year <= 2013:
queens_day = date(year, 4, 30)
if year <= 1948:
queens_day = date(year, 8, 31)
@@ -2224,3 +2331,605 @@ class Norway(HolidayBase):
class NO(Norway):
pass
+
+
+class Italy(HolidayBase):
+ PROVINCES = ['MI', 'RM']
+
+ def __init__(self, **kwargs):
+ self.country = 'IT'
+ self.prov = kwargs.pop('prov', kwargs.pop('state', ''))
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ self[date(year, 1, 1)] = "Capodanno"
+ self[date(year, 1, 6)] = "Epifania del Signore"
+ self[easter(year)] = "Pasqua di Resurrezione"
+ self[easter(year) + rd(weekday=MO)] = "Lunedì dell'Angelo"
+ if year >= 1946:
+ self[date(year, 4, 25)] = "Festa della Liberazione"
+ self[date(year, 5, 1)] = "Festa dei Lavoratori"
+ if year >= 1948:
+ self[date(year, 6, 2)] = "Festa della Repubblica"
+ self[date(year, 8, 15)] = "Assunzione della Vergine"
+ self[date(year, 11, 1)] = "Tutti i Santi"
+ self[date(year, 12, 8)] = "Immacolata Concezione"
+ self[date(year, 12, 25)] = "Natale"
+ self[date(year, 12, 26)] = "Santo Stefano"
+ # Provinces festive day
+ # TODO: add all provinces' saints
+ if self.prov:
+ if self.prov == 'MI':
+ self[date(year, 12, 7)] = "Sant'Ambrogio"
+ if self.prov == 'RM':
+ self[date(year, 6, 29)] = "Santi Pietro e Paolo"
+
+
+class IT(Italy):
+ pass
+
+
+class Sweden(HolidayBase):
+ """
+ Swedish holidays.
+ Note that holidays falling on a sunday are "lost",
+ it will not be moved to another day to make up for the collision.
+ In Sweden, ALL sundays are considered a holiday
+ (https://sv.wikipedia.org/wiki/Helgdagar_i_Sverige).
+ Initialize this class with include_sundays=False
+ to not include sundays as a holiday.
+ Primary sources:
+ https://sv.wikipedia.org/wiki/Helgdagar_i_Sverige and
+ http://www.riksdagen.se/sv/dokument-lagar/dokument/svensk-forfattningssamling/lag-1989253-om-allmanna-helgdagar_sfs-1989-253
+ """
+
+ def __init__(self, include_sundays=True, **kwargs):
+ """
+ :param include_sundays: Whether to consider sundays as a holiday
+ (which they are in Sweden)
+ :param kwargs:
+ """
+ self.country = "SE"
+ self.include_sundays = include_sundays
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ # Add all the sundays of the year before adding the "real" holidays
+ if self.include_sundays:
+ first_day_of_year = date(year, 1, 1)
+ first_sunday_of_year = first_day_of_year\
+ + rd(days=SUNDAY - first_day_of_year.weekday())
+ cur_date = first_sunday_of_year
+
+ while cur_date < date(year + 1, 1, 1):
+ assert cur_date.weekday() == SUNDAY
+
+ self[cur_date] = "Söndag"
+ cur_date += rd(days=7)
+
+ # ========= Static holidays =========
+ self[date(year, 1, 1)] = "Nyårsdagen"
+
+ self[date(year, 1, 6)] = "Trettondedag jul"
+
+ # Source: https://sv.wikipedia.org/wiki/F%C3%B6rsta_maj
+ if year >= 1939:
+ self[date(year, 5, 1)] = "Första maj"
+
+ # Source: https://sv.wikipedia.org/wiki/Sveriges_nationaldag
+ if year >= 2005:
+ self[date(year, 6, 6)] = "Sveriges nationaldag"
+
+ self[date(year, 12, 24)] = "Julafton"
+ self[date(year, 12, 25)] = "Juldagen"
+ self[date(year, 12, 26)] = "Annandag jul"
+ self[date(year, 12, 31)] = "Nyårsafton"
+
+ # ========= Moving holidays =========
+ e = easter(year)
+ maundy_thursday = e - rd(days=3)
+ good_friday = e - rd(days=2)
+ easter_saturday = e - rd(days=1)
+ resurrection_sunday = e
+ easter_monday = e + rd(days=1)
+ ascension_thursday = e + rd(days=39)
+ pentecost = e + rd(days=49)
+ pentecost_day_two = e + rd(days=50)
+
+ assert maundy_thursday.weekday() == THURSDAY
+ assert good_friday.weekday() == FRIDAY
+ assert easter_saturday.weekday() == SATURDAY
+ assert resurrection_sunday.weekday() == SUNDAY
+ assert easter_monday.weekday() == MONDAY
+ assert ascension_thursday.weekday() == THURSDAY
+ assert pentecost.weekday() == SUNDAY
+ assert pentecost_day_two.weekday() == MONDAY
+
+ self[good_friday] = "Långfredagen"
+ self[resurrection_sunday] = "Påskdagen"
+ self[easter_monday] = "Annandag påsk"
+ self[ascension_thursday] = "Kristi himmelsfärdsdag"
+ self[pentecost] = "Pingstdagen"
+ if year <= 2004:
+ self[pentecost_day_two] = "Annandag pingst"
+
+ # Midsummer evening. Friday between June 19th and June 25th
+ self[date(year, 6, 19) + rd(weekday=FR)] = "Midsommarafton"
+
+ # Midsummer day. Saturday between June 20th and June 26th
+ if year >= 1953:
+ self[date(year, 6, 20) + rd(weekday=SA)] = "Midsommardagen"
+ else:
+ self[date(year, 6, 24)] = "Midsommardagen"
+ # All saints day. Friday between October 31th and November 6th
+ self[date(year, 10, 31) + rd(weekday=SA)] = "Alla helgons dag"
+
+ if year <= 1953:
+ self[date(year, 3, 25)] = "Jungfru Marie bebådelsedag"
+
+
+class SE(Sweden):
+ pass
+
+
+class Japan(HolidayBase):
+ # https://en.wikipedia.org/wiki/Public_holidays_in_Japan
+
+ def __init__(self, **kwargs):
+ self.country = 'JP'
+ HolidayBase.__init__(self, **kwargs)
+
+ def _populate(self, year):
+ if year < 1949 or year > 2050:
+ raise NotImplementedError
+
+ # New Year's Day
+ self[date(year, 1, 1)] = "元日"
+
+ # Coming of Age Day
+ if year <= 1999:
+ self[date(year, 1, 15)] = "成人の日"
+ else:
+ self[date(year, 1, 1) + rd(weekday=MO(+2))] = "成人の日"
+
+ # Foundation Day
+ self[date(year, 2, 11)] = "建国記念の日"
+
+ # Vernal Equinox Day
+ self[self._vernal_equinox_day(year)] = "春分の日"
+
+ # The former Emperor's Birthday, Greenery Day or Showa Day
+ if year <= 1988:
+ self[date(year, 4, 29)] = "天皇誕生日"
+ elif year <= 2006:
+ self[date(year, 4, 29)] = "みどりの日"
+ else:
+ self[date(year, 4, 29)] = "昭和の日"
+
+ # Constitution Memorial Day
+ self[date(year, 5, 3)] = "憲法記念日"
+
+ # Greenery Day
+ if year >= 2007:
+ self[date(year, 5, 4)] = "みどりの日"
+
+ # Children's Day
+ self[date(year, 5, 5)] = "こどもの日"
+
+ # Marine Day
+ if year >= 1996 and year <= 2002:
+ self[date(year, 7, 20)] = "海の日"
+ elif year >= 2003:
+ self[date(year, 7, 1) + rd(weekday=MO(+3))] = "海の日"
+
+ # Mountain Day
+ if year >= 2016:
+ self[date(year, 8, 11)] = "山の日"
+
+ # Respect for the Aged Day
+ if year >= 1966 and year <= 2002:
+ self[date(year, 9, 15)] = "敬老の日"
+ elif year >= 2003:
+ self[date(year, 9, 1) + rd(weekday=MO(+3))] = "敬老の日"
+
+ # Autumnal Equinox Day
+ self[self._autumnal_equinox_day(year)] = "秋分の日"
+
+ # Health and Sports Day
+ if year >= 1966 and year <= 1999:
+ self[date(year, 10, 10)] = "体育の日"
+ elif year >= 2000:
+ self[date(year, 10, 1) + rd(weekday=MO(+2))] = "体育の日"
+
+ # Culture Day
+ self[date(year, 11, 3)] = "文化の日"
+
+ # Labour Thanksgiving Day
+ self[date(year, 11, 23)] = "勤労感謝の日"
+
+ # The Emperor's Birthday
+ if year >= 1989:
+ self[date(year, 12, 23)] = "天皇誕生日"
+
+ # A weekday between national holidays becomes a holiday too (国民の休日)
+ self._add_national_holidays(year)
+
+ # Substitute holidays
+ self._add_substitute_holidays(year)
+
+ def _vernal_equinox_day(self, year):
+ day = 20
+ if year % 4 == 0:
+ if year <= 1956:
+ day = 21
+ elif year >= 2092:
+ day = 19
+ elif year % 4 == 1:
+ if year <= 1989:
+ day = 21
+ elif year % 4 == 2:
+ if year <= 2022:
+ day = 21
+ elif year % 4 == 3:
+ if year <= 2055:
+ day = 21
+ return date(year, 3, day)
+
+ def _autumnal_equinox_day(self, year):
+ day = 22
+ if year % 4 == 0:
+ if year <= 2008:
+ day = 23
+ elif year % 4 == 1:
+ if year <= 2041:
... 1269 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-holidays.git
More information about the Python-modules-commits
mailing list