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
|
from copy import copy
from datetime import timedelta, date
from ..core import OrthodoxCalendar, SAT, SUN
from ..registry_tools import iso_register
@iso_register('BG')
class Bulgaria(OrthodoxCalendar):
'Bulgaria'
FIXED_HOLIDAYS = OrthodoxCalendar.FIXED_HOLIDAYS + (
(3, 3, "Liberation Day"), # Ден на Освобождението на Б
(5, 6, "Saint George's Day"), # Гергьовден, ден на храброс
(5, 24, "Saints Cyril & Methodius Day"), # Ден на българската просвет
(9, 6, "Unification Day"), # Ден на Съединението
(9, 22, "Independence Day"), # Ден на независимостта на Б
)
# Civil holidays
include_labour_day = True
# Ден на труда и на междунар
labour_day_label = "International Workers' Day"
# Christian holidays
include_good_friday = True
include_easter_saturday = True
include_easter_sunday = True
include_easter_monday = True
include_christmas_eve = True # Бъдни вечер
include_christmas = True # Рождество Христово
include_boxing_day = True
# despite being an Orthodox calendar, don't observe Orthodox XMas
include_orthodox_christmas = False
# wikipedia says The Bulgarians have two days of Christmas,
# both called Christmas Day
boxing_day_label = "Christmas"
def get_shifted_holidays(self, days):
for holiday, label in days:
if holiday.weekday() == SUN:
yield (
holiday + timedelta(days=1),
f'{label} shift'
)
elif holiday.weekday() == SAT:
yield (
holiday + timedelta(days=2),
f'{label} shift'
)
def get_fixed_holidays(self, year):
"""
Return fixed holidays, with shifts computed accordingly.
"""
# 2021 exception.
# Because May 1st is both International Workers' day and Easter
self.include_labour_day = (year != 2021)
# Unshifted days are here:
days = super().get_fixed_holidays(year)
days_to_inspect = copy(days)
for day_shifted in self.get_shifted_holidays(days_to_inspect):
days.append(day_shifted)
# 2021 exception.
# Because May 1st is both International Workers' day and Easter
if year == 2021:
days.append((date(2021, 5, 4), self.labour_day_label))
return days
|