How to use the workalendar.usa.core.UnitedStates function in workalendar

To help you get started, we’ve selected a few workalendar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github peopledoc / workalendar / workalendar / usa / oklahoma.py View on Github external
# -*- 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
github peopledoc / workalendar / workalendar / usa / montana.py View on Github external
# -*- 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)
github peopledoc / workalendar / workalendar / usa / new_hampshire.py View on Github external
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"
github peopledoc / workalendar / workalendar / usa / core.py View on Github external
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
github peopledoc / workalendar / workalendar / usa / american_samoa.py View on Github external
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([
github peopledoc / workalendar / workalendar / usa / south_dakota.py View on Github external
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"
github peopledoc / workalendar / workalendar / usa / wyoming.py View on Github external
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"
github peopledoc / workalendar / workalendar / usa / massachusetts.py View on Github external
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'),
    )
github peopledoc / workalendar / workalendar / usa / massachusetts.py View on Github external
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'),
    )
github peopledoc / workalendar / workalendar / usa / utah.py View on Github external
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"),
    )