Skip to content

Commit

Permalink
[US] no presidential election day for US territories
Browse files Browse the repository at this point in the history
  • Loading branch information
PPsyrius committed Jan 26, 2024
1 parent 8237ee5 commit 4c01137
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 285 deletions.
6 changes: 6 additions & 0 deletions holidays/countries/american_samoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.constants import NON_PUBLIC, PUBLIC
from holidays.countries.united_states import US


Expand All @@ -18,12 +19,17 @@ class HolidaysAS(US):
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1

country = "AS"
supported_categories = (NON_PUBLIC, PUBLIC)
subdivisions = () # Override US subdivisions.

def _populate_public_holidays(self) -> None:
self.subdiv = "AS"
super()._populate_public_holidays()

def _populate_non_public_holidays(self) -> None:
self.subdiv = "AS"
super()._populate_non_public_holidays()


class AS(HolidaysAS):
pass
Expand Down
6 changes: 6 additions & 0 deletions holidays/countries/guam.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.constants import NON_PUBLIC, PUBLIC
from holidays.countries.united_states import US


Expand All @@ -18,12 +19,17 @@ class HolidaysGU(US):
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1

country = "GU"
supported_categories = (NON_PUBLIC, PUBLIC)
subdivisions = () # Override US subdivisions.

def _populate_public_holidays(self) -> None:
self.subdiv = "GU"
super()._populate_public_holidays()

def _populate_non_public_holidays(self) -> None:
self.subdiv = "GU"
super()._populate_non_public_holidays()


class GU(HolidaysGU):
pass
Expand Down
6 changes: 6 additions & 0 deletions holidays/countries/northern_mariana_islands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.constants import NON_PUBLIC, PUBLIC
from holidays.countries.united_states import US


Expand All @@ -18,12 +19,17 @@ class HolidaysMP(US):
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1

country = "MP"
supported_categories = (NON_PUBLIC, PUBLIC)
subdivisions = () # Override US subdivisions.

def _populate_public_holidays(self) -> None:
self.subdiv = "MP"
super()._populate_public_holidays()

def _populate_non_public_holidays(self) -> None:
self.subdiv = "MP"
super()._populate_non_public_holidays()


class MP(HolidaysMP):
pass
Expand Down
6 changes: 6 additions & 0 deletions holidays/countries/puerto_rico.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.constants import NON_PUBLIC, PUBLIC
from holidays.countries.united_states import US


Expand All @@ -18,12 +19,17 @@ class HolidaysPR(US):
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1

country = "PR"
supported_categories = (NON_PUBLIC, PUBLIC)
subdivisions = () # Override US subdivisions.

def _populate_public_holidays(self) -> None:
self.subdiv = "PR"
super()._populate_public_holidays()

def _populate_non_public_holidays(self) -> None:
self.subdiv = "PR"
super()._populate_non_public_holidays()


class PR(HolidaysPR):
pass
Expand Down
6 changes: 5 additions & 1 deletion holidays/countries/united_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,11 @@ def _populate_non_public_holidays(self):
# May be duplicates for certain states which has this as their actual public holiday.
# The current US Presidential Election date pattern was only codified in 1848 nationwide.

if self._year >= 1848 and self._year % 4 == 0:
if (
self._year >= 1848
and self._year % 4 == 0
and self.subdiv not in {"AS", "GU", "MP", "PR", "UM", "VI"}
):
self._add_holiday_1_day_past_1st_mon_of_nov("Election Day")


Expand Down
6 changes: 6 additions & 0 deletions holidays/countries/united_states_minor_outlying_islands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.constants import NON_PUBLIC, PUBLIC
from holidays.countries.united_states import US


Expand All @@ -18,12 +19,17 @@ class HolidaysUM(US):
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1

country = "UM"
supported_categories = (NON_PUBLIC, PUBLIC)
subdivisions = () # Override US subdivisions.

def _populate_public_holidays(self) -> None:
self.subdiv = "UM"
super()._populate_public_holidays()

def _populate_non_public_holidays(self) -> None:
self.subdiv = "UM"
super()._populate_non_public_holidays()


class UM(HolidaysUM):
pass
Expand Down
6 changes: 6 additions & 0 deletions holidays/countries/united_states_virgin_islands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)

from holidays.constants import NON_PUBLIC, PUBLIC
from holidays.countries.united_states import US


Expand All @@ -18,12 +19,17 @@ class HolidaysVI(US):
# https://en.wikipedia.org/wiki/ISO_3166-2:US#Subdivisions_included_in_ISO_3166-1

country = "VI"
supported_categories = (NON_PUBLIC, PUBLIC)
subdivisions = () # Override US subdivisions.

def _populate_public_holidays(self) -> None:
self.subdiv = "VI"
super()._populate_public_holidays()

def _populate_non_public_holidays(self) -> None:
self.subdiv = "VI"
super()._populate_non_public_holidays()


class VI(HolidaysVI):
pass
Expand Down
25 changes: 0 additions & 25 deletions snapshots/countries/AS_COMMON.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"1952-09-01": "Labor Day",
"1952-10-12": "Columbus Day",
"1952-10-31": "Halloween",
"1952-11-04": "Election Day",
"1952-11-11": "Armistice Day",
"1952-11-27": "Thanksgiving",
"1952-12-24": "Christmas Eve",
Expand Down Expand Up @@ -98,7 +97,6 @@
"1956-09-03": "Labor Day",
"1956-10-12": "Columbus Day",
"1956-10-31": "Halloween",
"1956-11-06": "Election Day",
"1956-11-11": "Veterans Day",
"1956-11-12": "Veterans Day (observed)",
"1956-11-22": "Thanksgiving",
Expand Down Expand Up @@ -153,7 +151,6 @@
"1960-09-05": "Labor Day",
"1960-10-12": "Columbus Day",
"1960-10-31": "Halloween",
"1960-11-08": "Election Day",
"1960-11-11": "Veterans Day",
"1960-11-24": "Thanksgiving",
"1960-12-23": "Christmas Eve (observed)",
Expand Down Expand Up @@ -213,7 +210,6 @@
"1964-09-07": "Labor Day",
"1964-10-12": "Columbus Day",
"1964-10-31": "Halloween",
"1964-11-03": "Election Day",
"1964-11-11": "Veterans Day",
"1964-11-26": "Thanksgiving",
"1964-12-24": "Christmas Eve",
Expand Down Expand Up @@ -274,7 +270,6 @@
"1968-09-02": "Labor Day",
"1968-10-12": "Columbus Day",
"1968-10-31": "Halloween",
"1968-11-05": "Election Day",
"1968-11-11": "Veterans Day",
"1968-11-28": "Thanksgiving",
"1968-12-24": "Christmas Eve",
Expand Down Expand Up @@ -332,7 +327,6 @@
"1972-10-09": "Columbus Day",
"1972-10-23": "Veterans Day",
"1972-10-31": "Halloween",
"1972-11-07": "Election Day",
"1972-11-23": "Thanksgiving",
"1972-12-22": "Christmas Eve (observed)",
"1972-12-24": "Christmas Eve",
Expand Down Expand Up @@ -387,7 +381,6 @@
"1976-10-11": "Columbus Day",
"1976-10-25": "Veterans Day",
"1976-10-31": "Halloween",
"1976-11-02": "Election Day",
"1976-11-25": "Thanksgiving",
"1976-12-23": "Christmas Eve (observed)",
"1976-12-24": "Christmas Day (observed); Christmas Eve",
Expand Down Expand Up @@ -447,7 +440,6 @@
"1980-09-01": "Labor Day",
"1980-10-13": "Columbus Day",
"1980-10-31": "Halloween",
"1980-11-04": "Election Day",
"1980-11-11": "Veterans Day",
"1980-11-27": "Thanksgiving",
"1980-12-24": "Christmas Eve",
Expand Down Expand Up @@ -507,7 +499,6 @@
"1984-09-03": "Labor Day",
"1984-10-08": "Columbus Day",
"1984-10-31": "Halloween",
"1984-11-06": "Election Day",
"1984-11-11": "Veterans Day",
"1984-11-12": "Veterans Day (observed)",
"1984-11-22": "Thanksgiving",
Expand Down Expand Up @@ -565,7 +556,6 @@
"1988-09-05": "Labor Day",
"1988-10-10": "Columbus Day",
"1988-10-31": "Halloween",
"1988-11-08": "Election Day",
"1988-11-11": "Veterans Day",
"1988-11-24": "Thanksgiving",
"1988-12-23": "Christmas Eve (observed)",
Expand Down Expand Up @@ -629,7 +619,6 @@
"1992-09-07": "Labor Day",
"1992-10-12": "Columbus Day",
"1992-10-31": "Halloween",
"1992-11-03": "Election Day",
"1992-11-11": "Veterans Day",
"1992-11-26": "Thanksgiving",
"1992-12-24": "Christmas Eve",
Expand Down Expand Up @@ -694,7 +683,6 @@
"1996-09-02": "Labor Day",
"1996-10-14": "Columbus Day",
"1996-10-31": "Halloween",
"1996-11-05": "Election Day",
"1996-11-11": "Veterans Day",
"1996-11-28": "Thanksgiving",
"1996-12-24": "Christmas Eve",
Expand Down Expand Up @@ -755,7 +743,6 @@
"2000-09-04": "Labor Day",
"2000-10-09": "Columbus Day",
"2000-10-31": "Halloween",
"2000-11-07": "Election Day",
"2000-11-10": "Veterans Day (observed)",
"2000-11-11": "Veterans Day",
"2000-11-23": "Thanksgiving",
Expand Down Expand Up @@ -816,7 +803,6 @@
"2004-09-06": "Labor Day",
"2004-10-11": "Columbus Day",
"2004-10-31": "Halloween",
"2004-11-02": "Election Day",
"2004-11-11": "Veterans Day",
"2004-11-25": "Thanksgiving",
"2004-12-23": "Christmas Eve (observed)",
Expand Down Expand Up @@ -881,7 +867,6 @@
"2008-09-01": "Labor Day",
"2008-10-13": "Columbus Day",
"2008-10-31": "Halloween",
"2008-11-04": "Election Day",
"2008-11-11": "Veterans Day",
"2008-11-27": "Thanksgiving",
"2008-12-24": "Christmas Eve",
Expand Down Expand Up @@ -945,7 +930,6 @@
"2012-09-03": "Labor Day",
"2012-10-08": "Columbus Day",
"2012-10-31": "Halloween",
"2012-11-06": "Election Day",
"2012-11-11": "Veterans Day",
"2012-11-12": "Veterans Day (observed)",
"2012-11-22": "Thanksgiving",
Expand Down Expand Up @@ -1004,7 +988,6 @@
"2016-09-05": "Labor Day",
"2016-10-10": "Columbus Day",
"2016-10-31": "Halloween",
"2016-11-08": "Election Day",
"2016-11-11": "Veterans Day",
"2016-11-24": "Thanksgiving",
"2016-12-23": "Christmas Eve (observed)",
Expand Down Expand Up @@ -1068,7 +1051,6 @@
"2020-09-07": "Labor Day",
"2020-10-12": "Columbus Day",
"2020-10-31": "Halloween",
"2020-11-03": "Election Day",
"2020-11-11": "Veterans Day",
"2020-11-26": "Thanksgiving",
"2020-12-24": "Christmas Eve",
Expand Down Expand Up @@ -1139,7 +1121,6 @@
"2024-09-02": "Labor Day",
"2024-10-14": "Columbus Day",
"2024-10-31": "Halloween",
"2024-11-05": "Election Day",
"2024-11-11": "Veterans Day",
"2024-11-28": "Thanksgiving",
"2024-12-24": "Christmas Eve",
Expand Down Expand Up @@ -1205,7 +1186,6 @@
"2028-09-04": "Labor Day",
"2028-10-09": "Columbus Day",
"2028-10-31": "Halloween",
"2028-11-07": "Election Day",
"2028-11-10": "Veterans Day (observed)",
"2028-11-11": "Veterans Day",
"2028-11-23": "Thanksgiving",
Expand Down Expand Up @@ -1271,7 +1251,6 @@
"2032-09-06": "Labor Day",
"2032-10-11": "Columbus Day",
"2032-10-31": "Halloween",
"2032-11-02": "Election Day",
"2032-11-11": "Veterans Day",
"2032-11-25": "Thanksgiving",
"2032-12-23": "Christmas Eve (observed)",
Expand Down Expand Up @@ -1341,7 +1320,6 @@
"2036-09-01": "Labor Day",
"2036-10-13": "Columbus Day",
"2036-10-31": "Halloween",
"2036-11-04": "Election Day",
"2036-11-11": "Veterans Day",
"2036-11-27": "Thanksgiving",
"2036-12-24": "Christmas Eve",
Expand Down Expand Up @@ -1411,7 +1389,6 @@
"2040-09-03": "Labor Day",
"2040-10-08": "Columbus Day",
"2040-10-31": "Halloween",
"2040-11-06": "Election Day",
"2040-11-11": "Veterans Day",
"2040-11-12": "Veterans Day (observed)",
"2040-11-22": "Thanksgiving",
Expand Down Expand Up @@ -1475,7 +1452,6 @@
"2044-09-05": "Labor Day",
"2044-10-10": "Columbus Day",
"2044-10-31": "Halloween",
"2044-11-08": "Election Day",
"2044-11-11": "Veterans Day",
"2044-11-24": "Thanksgiving",
"2044-12-23": "Christmas Eve (observed)",
Expand Down Expand Up @@ -1543,7 +1519,6 @@
"2048-09-07": "Labor Day",
"2048-10-12": "Columbus Day",
"2048-10-31": "Halloween",
"2048-11-03": "Election Day",
"2048-11-11": "Veterans Day",
"2048-11-26": "Thanksgiving",
"2048-12-24": "Christmas Eve",
Expand Down
Loading

0 comments on commit 4c01137

Please sign in to comment.