Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce start/end year for entity #2141

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions holidays/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@
HEBREW = "hebrew"
HINDU = "hindu"
ISLAMIC = "islamic"

DEFAULT_START_YEAR = 1901
DEFAULT_END_YEAR = 2100
6 changes: 2 additions & 4 deletions holidays/countries/albania.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Albania(
# %s (observed, estimated).
observed_estimated_label = tr("%s (ditë pushimi e shtyrë, e vlerësuar)")
supported_languages = ("en_US", "sq", "uk")
# Law No. 7651 from 21.12.1992.
start_year = 1993

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -53,10 +55,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Law No. 7651 from 21.12.1992.
if self._year <= 1992:
return None

dts_observed = set()

# New Year's Day.
Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/angola.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class Angola(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Stat
supported_languages = ("en_US", "pt_AO", "uk")
# %s (observed).
observed_label = tr("%s (ponte)")
# Decree #5/75.
start_year = 1975

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -68,10 +70,6 @@ def _add_observed(self, dt: date, **kwargs) -> tuple[bool, Optional[date]]:
return super()._add_observed(dt, **kwargs)

def _populate_public_holidays(self):
# Decree #5/75.
if self._year <= 1974:
return None

# New Year's Day.
name = self.tr("Dia do Ano Novo")
dt = self._add_new_years_day(name)
Expand Down
1 change: 1 addition & 0 deletions holidays/countries/argentina.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Argentina(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, S
supported_languages = ("en_US", "es", "uk")
# %s (observed).
observed_label = tr("%s (observado)")
start_year = 1801

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand Down
4 changes: 1 addition & 3 deletions holidays/countries/armenia.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ class Armenia(HolidayBase, ChristianHolidays, InternationalHolidays):
country = "AM"
default_language = "hy"
supported_languages = ("en_US", "hy")
start_year = 1991

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self, JULIAN_CALENDAR)
InternationalHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1990:
return None

# New Year's Day.
name = tr("Նոր տարվա օր")
self._add_new_years_day(name)
Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/aruba.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@ class Aruba(HolidayBase, ChristianHolidays, InternationalHolidays):
country = "AW"
default_language = "pap_AW"
supported_languages = ("en_US", "nl", "pap_AW", "uk")
# AUG 1947: Autonomous State status in the Kingdom of the Netherlands.
start_year = 1947

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# AUG 1947: Autonomous State status in the Kingdom of the Netherlands.
if self._year <= 1946:
return None

# Aña Nobo.
# Status: In-Use.

Expand Down
1 change: 1 addition & 0 deletions holidays/countries/australia.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Australia(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, S
"Victoria": "VIC",
"Western Australia": "WA",
}
start_year = 1801

@property
def sovereign_birthday(self) -> str:
Expand Down
4 changes: 1 addition & 3 deletions holidays/countries/azerbaijan.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Azerbaijan(ObservedHolidayBase, InternationalHolidays, IslamicHolidays, St
observed_estimated_label = tr("%s (müşahidə olunur, təxmini)")
supported_categories = (PUBLIC, WORKDAY)
supported_languages = ("az", "en_US", "uk")
start_year = 1990

def __init__(self, *args, **kwargs):
InternationalHolidays.__init__(self)
Expand All @@ -49,9 +50,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1989:
return None

dts_observed = set()
dts_non_observed = set()
dts_bairami = set()
Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/bahamas.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Bahamas(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Sta

country = "BS"
observed_label = "%s (observed)"
# Gained Independence on Jul 10, 1973.
start_year = 1974

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -48,10 +50,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Gained Independence on Jul 10, 1973.
if self._year <= 1973:
return None

# New Year's Day.
# Pre-2012 Observance:
# - If TUE, New Year's Day (observed) prev MON.
Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/barbados.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Barbados(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, St

country = "BB"
observed_label = "%s (observed)"
# Public Holidays Act Cap.352, 1968-12-30
start_year = 1969

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -42,10 +44,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Public Holidays Act Cap.352, 1968-12-30
if self._year <= 1968:
return None

# New Year's Day
self._add_observed(self._add_new_years_day("New Year's Day"))

Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/belarus.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Belarus(HolidayBase, ChristianHolidays, InternationalHolidays, StaticHolid
country = "BY"
default_language = "be"
supported_languages = ("be", "en_US")
# The current set of holidays actual from 1998.
start_year = 1998

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self, JULIAN_CALENDAR)
Expand All @@ -41,10 +43,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# The current set of holidays actual from 1998.
if self._year <= 1997:
return None

# New Year's Day.
self._add_new_years_day(tr("Новы год"))

Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/belize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class Belize(ObservedHolidayBase, ChristianHolidays, InternationalHolidays):

country = "BZ"
observed_label = "%s (observed)"
# Belize was granted independence on 21.09.1981.
start_year = 1982

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -42,10 +44,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Belize was granted independence on 21.09.1981.
if self._year <= 1981:
return None

# New Year's Day.
self._move_holiday(self._add_new_years_day("New Year's Day"))

Expand Down
4 changes: 1 addition & 3 deletions holidays/countries/bolivia.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Bolivia(ObservedHolidayBase, ChristianHolidays, InternationalHolidays):
"S", # Santa Cruz
"T", # Tarija
)
start_year = 1825

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -61,9 +62,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1824:
return None

# New Year's Day.
self._add_observed(self._add_new_years_day(tr("Año Nuevo")))

Expand Down
4 changes: 1 addition & 3 deletions holidays/countries/botswana.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Botswana(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, St

country = "BW"
observed_label = "%s (observed)"
start_year = 1966

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -40,9 +41,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1965:
return None

self._add_observed(self._add_new_years_day("New Year's Day"), rule=SUN_TO_NEXT_TUE)
self._add_observed(self._add_new_years_day_two("New Year's Day Holiday"))

Expand Down
9 changes: 2 additions & 7 deletions holidays/countries/brazil.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,15 @@ class Brazil(ObservedHolidayBase, ChristianHolidays, InternationalHolidays):

supported_categories = (OPTIONAL, PUBLIC)
supported_languages = ("en_US", "pt_BR", "uk")
# Decreto n. 155-B, de 14.01.1890
start_year = 1890

def __init__(self, *args, **kwargs) -> None:
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Decreto n. 155-B, de 14.01.1890
if self._year <= 1889:
return None

# Universal Fraternization Day.
self._add_new_years_day(tr("Confraternização Universal"))

Expand Down Expand Up @@ -158,9 +156,6 @@ def _populate_public_holidays(self):
self._add_christmas_day(tr("Natal"))

def _populate_optional_holidays(self):
if self._year <= 1889:
return None

# Carnival.
name = tr("Carnaval")
self._add_carnival_monday(name)
Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/brunei.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class Brunei(
observed_estimated_label = tr("%s (diperhatikan, anggaran)")
supported_languages = ("en_US", "ms", "th")
weekend = {FRI, SUN}
# Available post-Independence from 1984 afterwards
start_year = 1984

def __init__(self, *args, **kwargs):
ChineseCalendarHolidays.__init__(self)
Expand All @@ -138,10 +140,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Available post-Independence from 1984 afterwards
if self._year <= 1983:
return None

# Awal Tahun Masihi
# Status: In-Use.

Expand Down
7 changes: 1 addition & 6 deletions holidays/countries/bulgaria.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Bulgaria(ObservedHolidayBase, ChristianHolidays, InternationalHolidays):
observed_label = tr("%s (почивен ден)")
supported_categories = (PUBLIC, SCHOOL)
supported_languages = ("bg", "en_US", "uk")
start_year = 1990

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self, JULIAN_REVISED_CALENDAR)
Expand All @@ -65,9 +66,6 @@ def _populate_observed(self, dts: set[date], excluded_names: set[str]) -> None:
self._add_observed(dt, name)

def _populate_public_holidays(self):
if self._year <= 1989:
return None

dts_observed = set()

# New Year's Day.
Expand Down Expand Up @@ -129,9 +127,6 @@ def _populate_public_holidays(self):
)

def _populate_school_holidays(self):
if self._year <= 1989:
return None

# National Awakening Day.
self._add_holiday_nov_1(tr("Ден на народните будители"))

Expand Down
8 changes: 3 additions & 5 deletions holidays/countries/burkina_faso.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class BurkinaFaso(ObservedHolidayBase, ChristianHolidays, InternationalHolidays,

country = "BF"
observed_label = "%s (observed)"
# On 5 August 1960, Burkina Faso (Republic of Upper Volta at that time)
# gained independence from France.
start_year = 1961

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -33,11 +36,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# On 5 August 1960, Burkina Faso (Republic of Upper Volta at that time)
# gained independence from France.
if self._year <= 1960:
return None

# New Year's Day.
self._add_observed(self._add_new_years_day("New Year's Day"))

Expand Down
4 changes: 1 addition & 3 deletions holidays/countries/burundi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Burundi(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, Isl

country = "BI"
observed_label = "%s (observed)"
start_year = 1962

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -37,9 +38,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
if self._year <= 1961:
return None

# New Year's Day
self._add_observed(self._add_new_years_day("New Year's Day"))

Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/cambodia.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class Cambodia(HolidayBase, InternationalHolidays, StaticHolidays, ThaiCalendarH
country = "KH"
default_language = "km"
supported_languages = ("en_US", "km", "th")
# Available post-Independence from 1993 afterwards
start_year = 1993

def __init__(self, *args, **kwargs):
InternationalHolidays.__init__(self)
Expand All @@ -60,10 +62,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# Available post-Independence from 1993 afterwards
if self._year <= 1992:
return None

# Fixed Holidays

# ទិវាចូលឆ្នាំសាកល
Expand Down
6 changes: 2 additions & 4 deletions holidays/countries/cameroon.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Cameroon(

country = "CM"
observed_label = "%s (observed)"
# On 1 January 1960, French Cameroun gained independence from France.
start_year = 1960

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -43,10 +45,6 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# On 1 January 1960, French Cameroun gained independence from France.
if self._year <= 1959:
return None

dts_observed = set()

# New Year's Day.
Expand Down
Loading