File: alabama.py

package info (click to toggle)
python-calendra 7.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,600 kB
  • sloc: python: 16,840; makefile: 6
file content (42 lines) | stat: -rw-r--r-- 1,153 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from .core import UnitedStates
from ..core import MON
from ..registry_tools import iso_register


@iso_register('US-AL')
class Alabama(UnitedStates):
    "Alabama"
    include_confederation_day = True
    martin_luther_king_label = "Robert E. Lee/Martin Luther King Birthday"
    presidents_day_label = "George Washington/Thomas Jefferson Birthday"
    columbus_day_label = ("Columbus Day / Fraternal Day /"
                          " American Indian Heritage Day")
    include_jefferson_davis_birthday = True


class AlabamaBaldwinCounty(Alabama):
    "Baldwin County, Alabama"
    include_fat_tuesday = True


class AlabamaMobileCounty(Alabama):
    "Mobile County, Alabama"
    include_fat_tuesday = True


class AlabamaPerryCounty(Alabama):
    "Mobile Perry, Alabama"

    def get_obama_day(self, year):
        """
        Obama Day happens on the 2nd MON of November.
        """
        return (
            self.get_nth_weekday_in_month(year, 11, MON, 2),
            "Obama Day"
        )

    def get_variable_days(self, year):
        days = super().get_variable_days(year)
        days.append(self.get_obama_day(year))
        return days