File: palestine.py

package info (click to toggle)
python-holidays 0.86-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 57,296 kB
  • sloc: python: 117,830; javascript: 85; makefile: 59
file content (174 lines) | stat: -rw-r--r-- 6,164 bytes parent folder | download
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#  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: Vacanza Team and individual contributors (see CONTRIBUTORS file)
#           dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
#           ryanss <ryanssdev@icloud.com> (c) 2014-2017
#  Website: https://github.com/vacanza/holidays
#  License: MIT (see LICENSE file)

from gettext import gettext as tr

from holidays.calendars import _CustomIslamicHolidays
from holidays.calendars.gregorian import GREGORIAN_CALENDAR
from holidays.calendars.julian import JULIAN_CALENDAR
from holidays.constants import CATHOLIC, ORTHODOX, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays
from holidays.holiday_base import HolidayBase


class Palestine(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays):
    """Palestine holidays.

    References:
        * <https://en.wikipedia.org/wiki/Public_holidays_in_Palestine>
        * <https://web.archive.org/web/20250705114216/https://info.wafa.ps/pages/details/29601>
        * [Declaration of Palestine independence](https://en.wikipedia.org/wiki/Palestine#Uprising,_declaration_and_peace_treaty)
    """

    country = "PS"
    default_language = "ar"
    # %s (estimated).
    estimated_label = tr("%s (المقدرة)")
    # State of Palestine declared in November 1988.
    start_year = 1989
    supported_categories = (CATHOLIC, ORTHODOX, PUBLIC)
    supported_languages = ("ar", "en_US")

    def __init__(self, *args, islamic_show_estimated: bool = False, **kwargs):
        """
        Args:
            islamic_show_estimated:
                Whether to add "estimated" label to Islamic holidays name
                if holiday date is estimated.
        """
        ChristianHolidays.__init__(self, calendar=JULIAN_CALENDAR)
        InternationalHolidays.__init__(self)
        IslamicHolidays.__init__(
            self, cls=PalestineIslamicHolidays, show_estimated=islamic_show_estimated
        )
        super().__init__(*args, **kwargs)

    def _populate_public_holidays(self):
        # New Year's Day.
        self._add_new_years_day(tr("رأس السنة الميلادي"))

        # Orthodox Christmas Day.
        self._add_christmas_day(tr("عيد الميلاد المجيد الشرقي"))

        # International Women's Day.
        self._add_womens_day(tr("يوم المراة العالمي"))

        # Easter.
        self._add_easter_sunday(tr("عيد الفصح المجيد"), GREGORIAN_CALENDAR)

        # Easter.
        self._add_easter_sunday(tr("عيد الفصح المجيد"))

        # Labor Day.
        self._add_labor_day(tr("عيد العمال"))

        # Independence Day.
        self._add_holiday_nov_15(tr("عيد الإستقلال"))

        # Catholic Christmas Day.
        self._add_christmas_day(tr("عيد الميلاد المجيد الغربي"), GREGORIAN_CALENDAR)

        # Hijri New Year.
        self._add_islamic_new_year_day(tr("رأس السنة الهجرية"))

        # Prophet's Birthday.
        self._add_mawlid_day(tr("ذكرى المولد النبوي الشريف"))

        # Isra' and Mi'raj.
        self._add_isra_and_miraj_day(tr("ذكرى الإسراء والمعراج"))

        # Eid al-Fitr.
        name = tr("عيد الفطر السعيد")
        self._add_eid_al_fitr_day(name)
        self._add_eid_al_fitr_day_two(name)
        self._add_eid_al_fitr_day_three(name)

        # Eid al-Adha.
        name = tr("عيد الأضحى المبارك")
        self._add_eid_al_adha_day(name)
        self._add_eid_al_adha_day_two(name)
        self._add_eid_al_adha_day_three(name)
        self._add_eid_al_adha_day_four(name)

    def _populate_catholic_holidays(self):
        # New Year's Day.
        self._add_new_years_day(tr("رأس السنة الميلادي"))

        # Epiphany.
        self._add_epiphany_day(tr("عيد الغطاس"), GREGORIAN_CALENDAR)

        # Palm Sunday.
        self._add_palm_sunday(tr("أحد الشعانين"), GREGORIAN_CALENDAR)

        # Holy Thursday.
        self._add_holy_thursday(tr("خميس الغسل"), GREGORIAN_CALENDAR)

        # Good Friday.
        self._add_good_friday(tr("الجمعة العظيمة"), GREGORIAN_CALENDAR)

        # Holy Saturday.
        self._add_holy_saturday(tr("سبت النور"), GREGORIAN_CALENDAR)

        # Easter.
        self._add_easter_monday(tr("عيد الفصح المجيد"), GREGORIAN_CALENDAR)

        # Ascension Day.
        self._add_ascension_thursday(tr("خميس الصعود"), GREGORIAN_CALENDAR)

        # Pentecost.
        self._add_whit_sunday(tr("أحد العنصرة"), GREGORIAN_CALENDAR)

        # Catholic Christmas Day.
        self._add_christmas_day_two(tr("عيد الميلاد المجيد الغربي"), GREGORIAN_CALENDAR)

    def _populate_orthodox_holidays(self):
        # Orthodox New Year's Day.
        self._add_holiday_jan_14(tr("عيد رأس السنة الشرقي"))

        # Orthodox Christmas Day.
        self._add_christmas_day_two(tr("عيد الميلاد المجيد الشرقي"))

        # Epiphany.
        self._add_epiphany_day(tr("عيد الغطاس"))

        # Palm Sunday.
        self._add_palm_sunday(tr("أحد الشعانين"))

        # Holy Thursday.
        self._add_holy_thursday(tr("خميس الغسل"))

        # Good Friday.
        self._add_good_friday(tr("الجمعة العظيمة"))

        # Holy Saturday.
        self._add_holy_saturday(tr("سبت النور"))

        # Easter.
        self._add_easter_monday(tr("عيد الفصح المجيد"))

        # Ascension Day.
        self._add_ascension_thursday(tr("خميس الصعود"))

        # Pentecost.
        self._add_whit_sunday(tr("أحد العنصرة"))


class PS(Palestine):
    pass


class PSE(Palestine):
    pass


class PalestineIslamicHolidays(_CustomIslamicHolidays):
    MAWLID_DATES_CONFIRMED_YEARS = (2020, 2024)