|
| 1 | +# holidays |
| 2 | +# -------- |
| 3 | +# A fast, efficient Python library for generating country, province and state |
| 4 | +# specific sets of holidays on the fly. It aims to make determining whether a |
| 5 | +# specific date is a holiday as fast and flexible as possible. |
| 6 | +# |
| 7 | +# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file) |
| 8 | +# dr-prodigy <[email protected]> (c) 2017-2023 |
| 9 | +# ryanss <[email protected]> (c) 2014-2017 |
| 10 | +# Website: https://github.com/vacanza/holidays |
| 11 | +# License: MIT (see LICENSE file) |
| 12 | + |
| 13 | +from gettext import gettext as tr |
| 14 | + |
| 15 | +from holidays.calendars import _CustomIslamicHolidays |
| 16 | +from holidays.calendars.gregorian import GREGORIAN_CALENDAR, SEP |
| 17 | +from holidays.calendars.julian import JULIAN_CALENDAR |
| 18 | +from holidays.constants import CATHOLIC, ORTHODOX, PUBLIC |
| 19 | +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays |
| 20 | +from holidays.holiday_base import HolidayBase |
| 21 | + |
| 22 | + |
| 23 | +class Palestine(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): |
| 24 | + """Palestine holidays. |
| 25 | +
|
| 26 | + References: |
| 27 | + * <https://en.wikipedia.org/wiki/Public_holidays_in_Palestine> |
| 28 | + * <https://web.archive.org/web/20250705114216/https://info.wafa.ps/pages/details/29601> |
| 29 | + * [Declaration of Palestine independence](https://en.wikipedia.org/wiki/Palestine#Uprising,_declaration_and_peace_treaty) |
| 30 | + """ |
| 31 | + |
| 32 | + country = "PS" |
| 33 | + default_language = "ar" |
| 34 | + # %s (estimated). |
| 35 | + estimated_label = tr("%s (المقدرة)") |
| 36 | + # State of Palestine declared in November 1988. |
| 37 | + start_year = 1989 |
| 38 | + supported_categories = (CATHOLIC, ORTHODOX, PUBLIC) |
| 39 | + supported_languages = ("ar", "en_US") |
| 40 | + |
| 41 | + def __init__(self, *args, islamic_show_estimated: bool = False, **kwargs): |
| 42 | + """ |
| 43 | + Args: |
| 44 | + islamic_show_estimated: |
| 45 | + Whether to add "estimated" label to Islamic holidays name |
| 46 | + if holiday date is estimated. |
| 47 | + """ |
| 48 | + ChristianHolidays.__init__(self, calendar=JULIAN_CALENDAR) |
| 49 | + InternationalHolidays.__init__(self) |
| 50 | + IslamicHolidays.__init__( |
| 51 | + self, cls=PalestineIslamicHolidays, show_estimated=islamic_show_estimated |
| 52 | + ) |
| 53 | + super().__init__(*args, **kwargs) |
| 54 | + |
| 55 | + def _populate_public_holidays(self): |
| 56 | + # New Year's Day. |
| 57 | + self._add_new_years_day(tr("رأس السنة الميلادي")) |
| 58 | + |
| 59 | + # Orthodox Christmas Day. |
| 60 | + self._add_christmas_day(tr("عيد الميلاد المجيد الشرقي")) |
| 61 | + |
| 62 | + # International Women's Day. |
| 63 | + self._add_womens_day(tr("يوم المراة العالمي")) |
| 64 | + |
| 65 | + # Easter. |
| 66 | + self._add_easter_sunday(tr("عيد الفصح المجيد"), GREGORIAN_CALENDAR) |
| 67 | + |
| 68 | + # Easter. |
| 69 | + self._add_easter_sunday(tr("عيد الفصح المجيد")) |
| 70 | + |
| 71 | + # Labor Day. |
| 72 | + self._add_labor_day(tr("عيد العمال")) |
| 73 | + |
| 74 | + # Independence Day. |
| 75 | + self._add_holiday_nov_15(tr("عيد الإستقلال")) |
| 76 | + |
| 77 | + # Catholic Christmas Day. |
| 78 | + self._add_christmas_day(tr("عيد الميلاد المجيد الغربي"), GREGORIAN_CALENDAR) |
| 79 | + |
| 80 | + # Hijri New Year. |
| 81 | + self._add_islamic_new_year_day(tr("رأس السنة الهجرية")) |
| 82 | + |
| 83 | + # Prophet's Birthday. |
| 84 | + self._add_mawlid_day(tr("ذكرى المولد النبوي الشريف")) |
| 85 | + |
| 86 | + # Isra' and Mi'raj. |
| 87 | + self._add_isra_and_miraj_day(tr("ذكرى الإسراء والمعراج")) |
| 88 | + |
| 89 | + # Eid al-Fitr. |
| 90 | + name = tr("عيد الفطر السعيد") |
| 91 | + self._add_eid_al_fitr_day(name) |
| 92 | + self._add_eid_al_fitr_day_two(name) |
| 93 | + self._add_eid_al_fitr_day_three(name) |
| 94 | + |
| 95 | + # Eid al-Adha. |
| 96 | + name = tr("عيد الأضحى المبارك") |
| 97 | + self._add_eid_al_adha_day(name) |
| 98 | + self._add_eid_al_adha_day_two(name) |
| 99 | + self._add_eid_al_adha_day_three(name) |
| 100 | + self._add_eid_al_adha_day_four(name) |
| 101 | + |
| 102 | + def _populate_catholic_holidays(self): |
| 103 | + # New Year's Day. |
| 104 | + self._add_new_years_day(tr("رأس السنة الميلادي")) |
| 105 | + |
| 106 | + # Epiphany. |
| 107 | + self._add_epiphany_day(tr("عيد الغطاس"), GREGORIAN_CALENDAR) |
| 108 | + |
| 109 | + # Palm Sunday. |
| 110 | + self._add_palm_sunday(tr("أحد الشعانين"), GREGORIAN_CALENDAR) |
| 111 | + |
| 112 | + # Holy Thursday. |
| 113 | + self._add_holy_thursday(tr("خميس الغسل"), GREGORIAN_CALENDAR) |
| 114 | + |
| 115 | + # Good Friday. |
| 116 | + self._add_good_friday(tr("الجمعة العظيمة"), GREGORIAN_CALENDAR) |
| 117 | + |
| 118 | + # Holy Saturday. |
| 119 | + self._add_holy_saturday(tr("سبت النور"), GREGORIAN_CALENDAR) |
| 120 | + |
| 121 | + # Easter. |
| 122 | + self._add_easter_monday(tr("عيد الفصح المجيد"), GREGORIAN_CALENDAR) |
| 123 | + |
| 124 | + # Ascension Day. |
| 125 | + self._add_ascension_thursday(tr("خميس الصعود"), GREGORIAN_CALENDAR) |
| 126 | + |
| 127 | + # Pentecost. |
| 128 | + self._add_whit_sunday(tr("أحد العنصرة"), GREGORIAN_CALENDAR) |
| 129 | + |
| 130 | + # Catholic Christmas Day. |
| 131 | + self._add_christmas_day_two(tr("عيد الميلاد المجيد الغربي"), GREGORIAN_CALENDAR) |
| 132 | + |
| 133 | + def _populate_orthodox_holidays(self): |
| 134 | + # Orthodox New Year's Day. |
| 135 | + self._add_holiday_jan_14(tr("عيد رأس السنة الشرقي")) |
| 136 | + |
| 137 | + # Orthodox Christmas Day. |
| 138 | + self._add_christmas_day_two(tr("عيد الميلاد المجيد الشرقي")) |
| 139 | + |
| 140 | + # Epiphany. |
| 141 | + self._add_epiphany_day(tr("عيد الغطاس")) |
| 142 | + |
| 143 | + # Palm Sunday. |
| 144 | + self._add_palm_sunday(tr("أحد الشعانين")) |
| 145 | + |
| 146 | + # Holy Thursday. |
| 147 | + self._add_holy_thursday(tr("خميس الغسل")) |
| 148 | + |
| 149 | + # Good Friday. |
| 150 | + self._add_good_friday(tr("الجمعة العظيمة")) |
| 151 | + |
| 152 | + # Holy Saturday. |
| 153 | + self._add_holy_saturday(tr("سبت النور")) |
| 154 | + |
| 155 | + # Easter. |
| 156 | + self._add_easter_monday(tr("عيد الفصح المجيد")) |
| 157 | + |
| 158 | + # Ascension Day. |
| 159 | + self._add_ascension_thursday(tr("خميس الصعود")) |
| 160 | + |
| 161 | + # Pentecost. |
| 162 | + self._add_whit_sunday(tr("أحد العنصرة")) |
| 163 | + |
| 164 | + |
| 165 | +class PS(Palestine): |
| 166 | + pass |
| 167 | + |
| 168 | + |
| 169 | +class PSE(Palestine): |
| 170 | + pass |
| 171 | + |
| 172 | + |
| 173 | +class PalestineIslamicHolidays(_CustomIslamicHolidays): |
| 174 | + # All other dates follow Umm al-Qura calendar. |
| 175 | + MAWLID_DATES = { |
| 176 | + 2023: (SEP, 27), |
| 177 | + } |
0 commit comments