Skip to content

Commit

Permalink
Formatted all files with black
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Oct 17, 2020
1 parent 6a251a8 commit e1d993f
Show file tree
Hide file tree
Showing 85 changed files with 1,827 additions and 1,431 deletions.
3 changes: 1 addition & 2 deletions holidays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# License: MIT (see LICENSE file)
from holidays.countries import *
from holidays.constants import MON, TUE, WED, THU, FRI, SAT, SUN, WEEKEND
from holidays.constants import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, \
NOV, DEC
from holidays.constants import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
from holidays.holiday_base import HolidayBase, createHolidaySum
from holidays.utils import list_supported_countries, CountryHoliday

Expand Down
3 changes: 1 addition & 2 deletions holidays/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
MON, TUE, WED, THU, FRI, SAT, SUN = range(7)
WEEKEND = (SAT, SUN)

JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, \
NOV, DEC = range(1, 13)
JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC = range(1, 13)
54 changes: 32 additions & 22 deletions holidays/countries/argentina.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from dateutil.relativedelta import relativedelta as rd, FR, TH

from holidays.constants import WEEKEND
from holidays.constants import JAN, MAR, APR, MAY, JUN, JUL, AUG, OCT, \
NOV, DEC
from holidays.constants import JAN, MAR, APR, MAY, JUN, JUL, AUG, OCT, NOV, DEC
from holidays.holiday_base import HolidayBase


Expand All @@ -29,7 +28,7 @@ class Argentina(HolidayBase):
# https://www.clarin.com/feriados/

def __init__(self, **kwargs):
self.country = 'AR'
self.country = "AR"
HolidayBase.__init__(self, **kwargs)

def _populate(self, year):
Expand All @@ -45,8 +44,10 @@ def _populate(self, year):
self[easter(year) - rd(days=47)] = name

# Memory's National Day for the Truth and Justice
name = "Día Nacional de la Memoria por la Verdad y la Justicia " \
"[Memory's National Day for the Truth and Justice]"
name = (
"Día Nacional de la Memoria por la Verdad y la Justicia "
"[Memory's National Day for the Truth and Justice]"
)

if not self.observed and date(year, MAR, 24).weekday() in WEEKEND:
pass
Expand All @@ -56,7 +57,7 @@ def _populate(self, year):
# Holy Week
name_thu = "Semana Santa (Jueves Santo) [Holy day (Holy Thursday)]"
name_fri = "Semana Santa (Viernes Santo) [Holy day (Holy Friday)]"
name_easter = 'Día de Pascuas [Easter Day]'
name_easter = "Día de Pascuas [Easter Day]"

self[easter(year) + rd(weekday=TH(-1))] = name_thu
self[easter(year) + rd(weekday=FR(-1))] = name_fri
Expand All @@ -70,10 +71,12 @@ def _populate(self, year):
if not self.observed and date(year, APR, 2).weekday() in WEEKEND:
pass
else:
self[date(year, APR, 2)] = "Día del Veterano y de los Caidos " \
"en la Guerra de Malvinas [Veterans" \
" Day and the Fallen in the" \
self[date(year, APR, 2)] = (
"Día del Veterano y de los Caidos "
"en la Guerra de Malvinas [Veterans"
" Day and the Fallen in the"
" Malvinas War]"
)

# Labor Day
name = "Día del Trabajo [Labour Day]"
Expand All @@ -90,18 +93,22 @@ def _populate(self, year):
self[date(year, MAY, 25)] = name

# Day Pass to the Immortality of General Martín Miguel de Güemes.
name = "Día Pase a la Inmortalidad " \
"del General Martín Miguel de Güemes [Day Pass " \
"to the Immortality of General Martín Miguel de Güemes]"
name = (
"Día Pase a la Inmortalidad "
"del General Martín Miguel de Güemes [Day Pass "
"to the Immortality of General Martín Miguel de Güemes]"
)
if not self.observed and date(year, JUN, 17).weekday() in WEEKEND:
pass
else:
self[date(year, JUN, 17)] = name

# Day Pass to the Immortality of General D. Manuel Belgrano.
name = "Día Pase a la Inmortalidad " \
"del General D. Manuel Belgrano [Day Pass " \
"to the Immortality of General D. Manuel Belgrano]"
name = (
"Día Pase a la Inmortalidad "
"del General D. Manuel Belgrano [Day Pass "
"to the Immortality of General D. Manuel Belgrano]"
)
if not self.observed and date(year, JUN, 20).weekday() in WEEKEND:
pass
else:
Expand All @@ -115,9 +122,11 @@ def _populate(self, year):
self[date(year, JUL, 9)] = name

# Day Pass to the Immortality of General D. José de San Martin
name = "Día Pase a la Inmortalidad " \
"del General D. José de San Martin [Day Pass " \
"to the Immortality of General D. José de San Martin]"
name = (
"Día Pase a la Inmortalidad "
"del General D. José de San Martin [Day Pass "
"to the Immortality of General D. José de San Martin]"
)
if not self.observed and date(year, AUG, 17).weekday() in WEEKEND:
pass
else:
Expand All @@ -129,9 +138,11 @@ def _populate(self, year):
elif year < 2010:
self[date(year, OCT, 12)] = "Día de la Raza [Columbus day]"
else:
self[date(year, OCT, 12)] = "Día del Respeto a la Diversidad" \
" Cultural [Respect for" \
self[date(year, OCT, 12)] = (
"Día del Respeto a la Diversidad"
" Cultural [Respect for"
" Cultural Diversity Day]"
)
# National Sovereignty Day
name = "Día Nacional de la Soberanía [National Sovereignty Day]"
if not self.observed and date(year, NOV, 20).weekday() in WEEKEND:
Expand All @@ -143,8 +154,7 @@ def _populate(self, year):
if not self.observed and date(year, DEC, 8).weekday() in WEEKEND:
pass
else:
self[date(year, DEC, 8)] = "La Inmaculada Concepción" \
" [Immaculate Conception]"
self[date(year, DEC, 8)] = "La Inmaculada Concepción" " [Immaculate Conception]"

# Christmas
self[date(year, DEC, 25)] = "Navidad [Christmas]"
Expand Down
21 changes: 14 additions & 7 deletions holidays/countries/aruba.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
from dateutil.easter import easter
from dateutil.relativedelta import relativedelta as rd, FR

from holidays.constants import JAN, MAR, APR, MAY, AUG, \
DEC
from holidays.constants import JAN, MAR, APR, MAY, AUG, DEC
from holidays.holiday_base import HolidayBase


Expand All @@ -26,7 +25,7 @@ class Aruba(HolidayBase):
# https://www.visitaruba.com/about-aruba/national-holidays-and-celebrations/

def __init__(self, **kwargs):
self.country = 'AW'
self.country = "AW"
HolidayBase.__init__(self, **kwargs)

def _populate(self, year):
Expand All @@ -37,18 +36,24 @@ def _populate(self, year):
self[date(year, JAN, 25)] = "Dia Di Betico [Betico Day]"

# Carnaval Monday
self[easter(year) + rd(days=-48)] = "Dialuna di Carnaval \
self[
easter(year) + rd(days=-48)
] = "Dialuna di Carnaval \
[Carnaval Monday]"

# Dia di Himno y Bandera
self[date(year, MAR, 18)] = "Dia di Himno y Bandera \
self[
date(year, MAR, 18)
] = "Dia di Himno y Bandera \
[National Anthem & Flag Day]"

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

# Easter Monday
self[easter(year) + rd(days=1)] = "Di Dos Dia di Pasco di Resureccion \
self[
easter(year) + rd(days=1)
] = "Di Dos Dia di Pasco di Resureccion \
[Easter Monday]"

# King's Day
Expand Down Expand Up @@ -83,7 +88,9 @@ def _populate(self, year):
self[date(year, DEC, 25)] = "Pasco di Nacemento [Christmas]"

# Second Christmas
self[date(year, DEC, 26)] = "Di Dos Dia di Pasco di \
self[
date(year, DEC, 26)
] = "Di Dos Dia di Pasco di \
Nacemento [Second Christmas]"


Expand Down
60 changes: 29 additions & 31 deletions holidays/countries/australia.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
from dateutil.easter import easter
from dateutil.relativedelta import relativedelta as rd, MO, SA, FR, WE, TU

from holidays.constants import JAN, MAR, APR, MAY, JUN, AUG, SEP, OCT, \
NOV, DEC
from holidays.constants import JAN, MAR, APR, MAY, JUN, AUG, SEP, OCT, NOV, DEC
from holidays.constants import SAT, SUN, WEEKEND
from holidays.holiday_base import HolidayBase


class Australia(HolidayBase):
PROVINCES = ['ACT', 'NSW', 'NT', 'QLD', 'SA', 'TAS', 'VIC', 'WA']
PROVINCES = ["ACT", "NSW", "NT", "QLD", "SA", "TAS", "VIC", "WA"]

def __init__(self, **kwargs):
self.country = 'AU'
self.prov = kwargs.pop('prov', None)
self.country = "AU"
self.prov = kwargs.pop("prov", None)
HolidayBase.__init__(self, **kwargs)

def _populate(self, year):
Expand All @@ -52,19 +51,19 @@ def _populate(self, year):
# Australia Day
jan26 = date(year, JAN, 26)
if year >= 1935:
if self.prov == 'NSW' and year < 1946:
if self.prov == "NSW" and year < 1946:
name = "Anniversary Day"
else:
name = "Australia Day"
self[jan26] = name
if self.observed and year >= 1946 and jan26.weekday() in WEEKEND:
self[jan26 + rd(weekday=MO)] = name + " (Observed)"
elif year >= 1888 and self.prov != 'SA':
elif year >= 1888 and self.prov != "SA":
name = "Anniversary Day"
self[jan26] = name

# Adelaide Cup
if self.prov == 'SA':
if self.prov == "SA":
name = "Adelaide Cup"
if year >= 2006:
# subject to proclamation ?!?!
Expand All @@ -75,7 +74,7 @@ def _populate(self, year):
# Canberra Day
# Info from https://www.timeanddate.com/holidays/australia/canberra-day
# and https://en.wikipedia.org/wiki/Canberra_Day
if self.prov == 'ACT' and year >= 1913:
if self.prov == "ACT" and year >= 1913:
name = "Canberra Day"
if year >= 1913 and year <= 1957:
self[date(year, MAR, 12)] = name
Expand All @@ -88,9 +87,9 @@ def _populate(self, year):

# Easter
self[easter(year) + rd(weekday=FR(-1))] = "Good Friday"
if self.prov in ('ACT', 'NSW', 'NT', 'QLD', 'SA', 'VIC'):
if self.prov in ("ACT", "NSW", "NT", "QLD", "SA", "VIC"):
self[easter(year) + rd(weekday=SA(-1))] = "Easter Saturday"
if self.prov in ('ACT', 'NSW', 'QLD', 'VIC'):
if self.prov in ("ACT", "NSW", "QLD", "VIC"):
self[easter(year)] = "Easter Sunday"
self[easter(year) + rd(weekday=MO)] = "Easter Monday"

Expand All @@ -100,14 +99,13 @@ def _populate(self, year):
apr25 = date(year, APR, 25)
self[apr25] = name
if self.observed:
if apr25.weekday() == SAT and self.prov in ('WA', 'NT'):
if apr25.weekday() == SAT and self.prov in ("WA", "NT"):
self[apr25 + rd(weekday=MO)] = name + " (Observed)"
elif (apr25.weekday() == SUN and
self.prov in ('ACT', 'QLD', 'SA', 'WA', 'NT')):
elif apr25.weekday() == SUN and self.prov in ("ACT", "QLD", "SA", "WA", "NT"):
self[apr25 + rd(weekday=MO)] = name + " (Observed)"

# Western Australia Day
if self.prov == 'WA' and year > 1832:
if self.prov == "WA" and year > 1832:
if year >= 2015:
name = "Western Australia Day"
else:
Expand All @@ -121,7 +119,7 @@ def _populate(self, year):
name = "King's Birthday"
if year >= 1936:
name = "Queen's Birthday"
if self.prov == 'QLD':
if self.prov == "QLD":
if year == 2012:
self[date(year, JUN, 11)] = "Queen's Diamond Jubilee"
if year < 2016 and year != 2012:
Expand All @@ -130,10 +128,10 @@ def _populate(self, year):
else:
dt = date(year, OCT, 1) + rd(weekday=MO)
self[dt] = name
elif self.prov == 'WA':
elif self.prov == "WA":
# by proclamation ?!?!
self[date(year, OCT, 1) + rd(weekday=MO(-1))] = name
elif self.prov in ('NSW', 'VIC', 'ACT', 'SA', 'NT', 'TAS'):
elif self.prov in ("NSW", "VIC", "ACT", "SA", "NT", "TAS"):
dt = date(year, JUN, 1) + rd(weekday=MO(+2))
self[dt] = name
elif year > 1911:
Expand All @@ -142,38 +140,38 @@ def _populate(self, year):
self[date(year, NOV, 9)] = name # Edward VII

# Picnic Day
if self.prov == 'NT':
if self.prov == "NT":
name = "Picnic Day"
self[date(year, AUG, 1) + rd(weekday=MO)] = name

# Bank Holiday
if self.prov == 'NSW':
if self.prov == "NSW":
if year >= 1912:
name = "Bank Holiday"
self[date(year, 8, 1) + rd(weekday=MO)] = name

# Labour Day
name = "Labour Day"
if self.prov in ('NSW', 'ACT', 'SA'):
if self.prov in ("NSW", "ACT", "SA"):
self[date(year, OCT, 1) + rd(weekday=MO)] = name
elif self.prov == 'WA':
elif self.prov == "WA":
self[date(year, MAR, 1) + rd(weekday=MO)] = name
elif self.prov == 'VIC':
elif self.prov == "VIC":
self[date(year, MAR, 1) + rd(weekday=MO(+2))] = name
elif self.prov == 'QLD':
elif self.prov == "QLD":
if 2013 <= year <= 2015:
self[date(year, OCT, 1) + rd(weekday=MO)] = name
else:
self[date(year, MAY, 1) + rd(weekday=MO)] = name
elif self.prov == 'NT':
elif self.prov == "NT":
name = "May Day"
self[date(year, MAY, 1) + rd(weekday=MO)] = name
elif self.prov == 'TAS':
elif self.prov == "TAS":
name = "Eight Hours Day"
self[date(year, MAR, 1) + rd(weekday=MO(+2))] = name

# Family & Community Day
if self.prov == 'ACT':
if self.prov == "ACT":
name = "Family & Community Day"
if 2007 <= year <= 2009:
self[date(year, NOV, 1) + rd(weekday=TU)] = name
Expand All @@ -199,12 +197,12 @@ def _populate(self, year):
self[date(year, SEP, 25)] = name

# Reconciliation Day
if self.prov == 'ACT':
if self.prov == "ACT":
name = "Reconciliation Day"
if year >= 2018:
self[date(year, 5, 27) + rd(weekday=MO)] = name

if self.prov == 'VIC':
if self.prov == "VIC":
# Grand Final Day
if year == 2020:
# Rescheduled due to COVID-19
Expand All @@ -219,7 +217,7 @@ def _populate(self, year):
# 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':
if self.prov == "QLD":
name = "The Royal Queensland Show"
if year == 2020:
self[date(year, AUG, 14)] = name
Expand All @@ -235,7 +233,7 @@ def _populate(self, year):
self[date(year, DEC, 27)] = name + " (Observed)"

# Boxing Day
if self.prov == 'SA':
if self.prov == "SA":
name = "Proclamation Day"
else:
name = "Boxing Day"
Expand Down
Loading

0 comments on commit e1d993f

Please sign in to comment.