How to use the workalendar.usa.FloatToNearestWeekdayMixin 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.py View on Github external
class NewMexico(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """New Mexico"""
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(NewMexico, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(NewMexico, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class NewYork(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """New York"""
    FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
        (2, 12, "Lincoln's Birthday"),
    )

    def get_variable_days(self, year):
        days = super(NewYork, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(NewYork, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days
github peopledoc / workalendar / workalendar / usa.py View on Github external
)

    include_good_friday = True

    def get_variable_days(self, year):
        days = super(Connecticut, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Connecticut, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Delaware(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """Delaware"""

    include_good_friday = True
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(Delaware, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Delaware, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days
github peopledoc / workalendar / workalendar / usa.py View on Github external
"""Indiana"""
    include_good_friday = True
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(Indiana, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Indiana, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Iowa(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """Iowa"""
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(Iowa, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Iowa, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Kansas(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin,
             DayAfterChristmasNoFloatMixin):
github peopledoc / workalendar / workalendar / usa.py View on Github external
"""Mississippi"""
    include_thanksgiving_friday = True
    include_confederation_day = True

    def get_variable_days(self, year):
        days = super(Mississippi, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Mississippi, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Missouri(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """Missouri"""
    FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
        (2, 12, "Lincoln's Birthday"),
        (5, 8, "Truman Day"),
    )

    def get_variable_days(self, year):
        days = super(Missouri, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Missouri, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days
github peopledoc / workalendar / workalendar / usa.py View on Github external
sunday = self.get_easter_sunday(year)
        return (sunday - timedelta(days=47), "Mardi Gras")

    def get_variable_days(self, year):
        days = super(Louisiana, self).get_variable_days(year)
        days = self.float(days)
        days.append(self.get_mardi_gras(year))
        return days

    def get_fixed_holidays(self, year):
        days = super(Louisiana, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Maine(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin,
            PatriotsDayMixin):
    """Maine"""
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(Maine, self).get_variable_days(year)
        days = self.float(days)
        days.extend([
            self.get_patriots_day(year),
        ])
        return days

    def get_fixed_holidays(self, year):
        days = super(Maine, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days
github peopledoc / workalendar / workalendar / usa.py View on Github external
(2, 12, "Lincoln's Birthday"),
        (5, 8, "Truman Day"),
    )

    def get_variable_days(self, year):
        days = super(Missouri, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Missouri, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Montana(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """Montana"""

    def get_variable_days(self, year):
        days = super(Montana, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Montana, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Nebraska(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """Nebraska"""
    include_thanksgiving_friday = True
github peopledoc / workalendar / workalendar / usa.py View on Github external
"""Tennessee"""
    include_good_friday = True
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(Tennessee, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Tennessee, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Texas(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin,
            CesarChavezDayMixin):
    """Texas"""
    include_good_friday = True

    def get_variable_days(self, year):
        days = super(Texas, self).get_variable_days(year)
        days = self.float(days)
        return days

    # FIXME: fixed days that DON'T float.
    def get_fixed_holidays(self, year):
        days = super(Texas, self).get_fixed_holidays(year)
        days = self.float(days, year)
        days.extend([
            (date(year, 1, 19), "Confederate Heroes Day"),
            (date(year, 3, 2), "Texas Independence Day"),
github peopledoc / workalendar / workalendar / usa.py View on Github external
def get_variable_days(self, year):
        days = super(Vermont, self).get_variable_days(year)
        days = self.float(days)
        days.append(
            (self.get_nth_weekday_in_month(year, 3, TUE, 1),
             "Town Meeting Day")
        )
        return days

    def get_fixed_holidays(self, year):
        days = super(Vermont, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Virginia(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin,
               DayAfterChristmasNoFloatMixin):
    """Virginia"""
    include_christmas_eve = True
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(Virginia, self).get_variable_days(year)
        days = self.float(days)
        days.extend([
            (self.get_nth_weekday_in_month(year, 1, FRI, 3),
             "Lee-Jackson Day"),
            (self.get_nth_weekday_in_month(year, 11, WED, 4),
             "Additional Thanksgiving Holiday")
        ])
        return days
github peopledoc / workalendar / workalendar / usa.py View on Github external
class NewHampshire(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """New Hampshire"""
    include_thanksgiving_friday = True

    def get_variable_days(self, year):
        days = super(NewHampshire, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(NewHampshire, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class NewJersey(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """New Jersey"""
    include_good_friday = True

    def get_variable_days(self, year):
        days = super(NewJersey, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(NewJersey, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class NewMexico(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """New Mexico"""
github peopledoc / workalendar / workalendar / usa.py View on Github external
class NorthDakota(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """North Dakota"""
    include_good_friday = True

    def get_variable_days(self, year):
        days = super(NorthDakota, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(NorthDakota, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days


class Ohio(UnitedStates, WesternCalendar, FloatToNearestWeekdayMixin):
    """Ohio"""
    FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
        (12, 1, "Rosa Parks Day"),
    )

    def get_variable_days(self, year):
        days = super(Ohio, self).get_variable_days(year)
        days = self.float(days)
        return days

    def get_fixed_holidays(self, year):
        days = super(Ohio, self).get_fixed_holidays(year)
        days = self.float(days, year)
        return days