Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-OK')
class Oklahoma(UnitedStates):
"""Oklahoma"""
include_thanksgiving_friday = True
include_boxing_day = True
include_columbus_day = False
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import warnings
from .core import UnitedStates
from ..registry_tools import iso_register
@iso_register('US-MT')
class Montana(UnitedStates):
"""Montana"""
include_election_day_even = True
def get_variable_days(self, year):
warnings.warn(
"Montana states is supposed to observe General Election Day on "
"even years, but for some reason some sources are including it "
"in 2019. Please use with care."
)
return super(Montana, self).get_variable_days(year)
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-NH')
class NewHampshire(UnitedStates):
"""New Hampshire"""
include_thanksgiving_friday = True
martin_luther_king_label = "Martin Luther King, Jr. Civil Rights Day"
if self.include_patriots_day:
days.append(self.get_patriots_day(year))
if self.include_columbus_day:
days.append(self.get_columbus_day(year))
if self.include_confederation_day:
days.append(self.get_confederate_day(year))
if self.include_jefferson_davis_birthday:
days.append(self.get_jefferson_davis_birthday(year))
if self.include_inauguration_day:
# Is it a "Inauguration year"?
if UnitedStates.is_presidential_year(year - 1):
days.append(
(self.get_inauguration_date(year), "Inauguration Day")
)
if self.include_election_day_every_year:
days.append(self.get_election_day(year))
elif self.include_election_day_even:
if (year % 2) == 0:
days.append(self.get_election_day(year))
if self.include_thanksgiving_friday:
days.append(
self.get_thanksgiving_friday(year)
)
return days
from datetime import date
from .core import UnitedStates
from ..registry_tools import iso_register
@iso_register('US-AS')
class AmericanSamoa(UnitedStates):
"American Samoa"
include_boxing_day = True
boxing_day_label = "Family Day"
def get_flag_day(self, year):
"""
Flag day is on April 17th
"""
return (
date(year, 4, 17),
"Flag Day"
)
def get_variable_days(self, year):
days = super().get_variable_days(year)
days.extend([
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-SD')
class SouthDakota(UnitedStates):
"""South Dakota"""
columbus_day_label = "Native Americans Day"
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-WY')
class Wyoming(UnitedStates):
"""Wyoming"""
martin_luther_king_label = "Martin Luther King, Jr. / Wyoming Equality Day"
from .core import UnitedStates
from ..registry_tools import iso_register
@iso_register('US-MA')
class Massachusetts(UnitedStates):
"""Massachusetts"""
include_patriots_day = True
class SuffolkCountyMassachusetts(Massachusetts):
"""Suffolk County, Massachusetts"""
FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
(3, 17, 'Evacuation Day'),
(6, 17, 'Bunker Hill Day'),
)
from .core import UnitedStates
from ..registry_tools import iso_register
@iso_register('US-MA')
class Massachusetts(UnitedStates):
"""Massachusetts"""
include_patriots_day = True
class SuffolkCountyMassachusetts(Massachusetts):
"""Suffolk County, Massachusetts"""
FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
(3, 17, 'Evacuation Day'),
(6, 17, 'Bunker Hill Day'),
)
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-UT')
class Utah(UnitedStates):
"""Utah"""
FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
(7, 24, "Pioneer Day"),
)