forked from vacanza/holidays
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonaco.py
More file actions
98 lines (74 loc) · 2.98 KB
/
Copy pathmonaco.py
File metadata and controls
98 lines (74 loc) · 2.98 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/dr-prodigy/python-holidays
# License: MIT (see LICENSE file)
from datetime import date
from datetime import timedelta as td
from gettext import gettext as tr
from holidays.constants import JAN, NOV, DEC
from holidays.holiday_base import HolidayBase
from holidays.holiday_groups import ChristianHolidays, InternationalHolidays
class Monaco(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
https://en.wikipedia.org/wiki/Public_holidays_in_Monaco
https://en.service-public-entreprises.gouv.mc/Employment-and-social-affairs/Employment-regulations/Leave/Public-Holidays # noqa: E501
"""
country = "MC"
default_language = "fr"
special_holidays = {
2015: ((JAN, 7, tr("Jour férié")),),
}
def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
super().__init__(*args, **kwargs)
def _populate(self, year):
super()._populate(year)
observed_dates = set()
# New Year's Day.
observed_dates.add(self._add_new_years_day(tr("Le jour de l'An")))
# Saint Dévote's Day.
self._add_holiday(tr("La Sainte Dévote"), JAN, 27)
# Easter Monday.
self._add_easter_monday(tr("Le lundi de Pâques"))
# Labour Day.
observed_dates.add(self._add_labour_day(tr("Fête de la Travaille")))
# Ascension's Day.
self._add_ascension_thursday(tr("L'Ascension"))
# Whit Monday.
self._add_whit_monday(tr("Le lundi de Pentecôte"))
# Corpus Christi.
self._add_corpus_christi_day(tr("La Fête Dieu"))
# Assumption's Day.
observed_dates.add(
self._add_assumption_of_mary_day(tr("L'Assomption de Marie"))
)
# All Saints' Day.
observed_dates.add(self._add_all_saints_day(tr("La Toussaint")))
# Prince's Day.
observed_dates.add(self._add_holiday(tr("La Fête du Prince"), NOV, 19))
dt = date(year, DEC, 8)
if year >= 2019 and self._is_sunday(dt):
dt += td(days=+1)
# Immaculate Conception's Day.
self._add_holiday(tr("L'Immaculée Conception"), dt)
# Christmas Day.
observed_dates.add(self._add_christmas_day(tr("Noël")))
if self.observed:
for dt in observed_dates:
if not self._is_sunday(dt):
continue
self._add_holiday(
self.tr("%s (Observé)") % self[dt],
dt + td(days=+1),
)
class MC(Monaco):
pass
class MCO(Monaco):
pass