File: virginia.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 (43 lines) | stat: -rw-r--r-- 1,250 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
43
"""
Virginia module

You may or may want not to treat the Day before Thanksgiving as a non-working
day by implementing the following class:

.. code::

    from workalenda.usa import Virginia as VirginiaBase

    class Virginia(VirginiaBase):
        include_thanksgiving_wednesday = False

"""
from ..core import WED, FRI
from ..registry_tools import iso_register
from .core import UnitedStates


@iso_register('US-VA')
class Virginia(UnitedStates):
    """Virginia"""
    include_christmas_eve = True
    include_thanksgiving_friday = True
    include_boxing_day = True
    presidents_day_label = "George Washington Day"
    # Virginia specific. By default, it's treated as a holiday, but
    # you may chose to exclude it for you own uses. See the module doc.
    include_thanksgiving_wednesday = True

    def get_variable_days(self, year):
        days = super().get_variable_days(year)
        days.append(
            (self.get_nth_weekday_in_month(year, 1, FRI, 3),
             "Lee-Jackson Day")
        )
        if self.include_thanksgiving_wednesday:
            days.append(
                (self.get_nth_weekday_in_month(year, 11, WED, 4),
                 "Day before Thanksgiving (start at noon)")
            )

        return days