diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 5ff0c03b9..1a1104aaa 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12.0-beta.4', 'pypy-3.8'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8'] steps: - uses: actions/checkout@v3 @@ -37,6 +37,7 @@ jobs: requirements/runtime.txt requirements/tests.txt python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install Dependencies run: | python -m pip install --upgrade pip @@ -100,7 +101,7 @@ jobs: name: dist path: dist - name: Publish Package - uses: pypa/gh-action-pypi-publish@v1.8.8 + uses: pypa/gh-action-pypi-publish@v1.8.10 with: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d1b911f21..614c5aeb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,7 @@ repos: exclude: ^(docs) - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.5.0 hooks: - id: mypy additional_dependencies: [types-all] diff --git a/CHANGES b/CHANGES index 52f44ee56..940f6d0f5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,23 @@ +Version 0.31 +============ + +Released August 21, 2023 + +- Refactor HolidayBase methods (#1425 by @KJhellico) +- Add Barbados holidays (#1393 by @arjunanan6) +- Add Iran holidays (#1409 by @KJhellico) +- Add Vanuatu holidays (#1423 by @Strategos1) +- Fix Ukraine overlapping observed holidays (#1421 by @KJhellico) +- Update Barbados holidays (#1430 by @KJhellico) +- Update Saudi Arabia holidays: fix Eid al-Fitr and Eid al-Adha observance (#1414 by @KJhellico) +- Update Singapore holidays: add 2023 Polling Day (#1424 by @mborsetti) +- Update Slovenia holidays: add 2023 Solidarity Day (#1426 by @kanobi, @PPsyrius) +- Update Vanuatu holidays (#1431 by @KJhellico) +- Add l10n tests (#1420 by @arkid15r) +- Add latest Python 3.12 release to tests (#1432 by @KJhellico) +- Use holidays.groups instead of holidays.holiday_groups (#1428 by @arkid15r) +- Use typing cast for HolidayBase::__eq__ (#1429 by @arkid15r) + Version 0.30 ============ diff --git a/README.rst b/README.rst index d17c92acd..e2c55c314 100644 --- a/README.rst +++ b/README.rst @@ -109,7 +109,7 @@ Available Countries .. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes .. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes -We currently support 131 country codes. The standard way to refer to a country +We currently support 134 country codes. The standard way to refer to a country is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and for a subdivision its `ISO 3166-2 code`_. Some of the countries support more than one language for holiday names output. @@ -185,6 +185,10 @@ The list of supported countries, their subdivisions and supported languages - BD - - + * - Barbados + - BB + - + - * - Belarus - BY - @@ -240,7 +244,7 @@ The list of supported countries, their subdivisions and supported languages * - Canada - CA - Provinces and territories: AB, BC, MB, NB, NL, NS, NT, NU, **ON**, PE, QC, SK, YT - - ar, **en**, en_US, fr, th + - ar, **en**, fr, th * - Chad - TD - @@ -373,6 +377,10 @@ The list of supported countries, their subdivisions and supported languages - ID - - en_US, **id**, uk + * - Iran + - IR + - + - en_US, **fa** * - Ireland - IE - @@ -637,6 +645,10 @@ The list of supported countries, their subdivisions and supported languages - UZ - - + * - Vanuatu + - VU + - + - * - Vatican City - VA - diff --git a/holidays/__init__.py b/holidays/__init__.py index 304b1fa57..27a435e44 100644 --- a/holidays/__init__.py +++ b/holidays/__init__.py @@ -16,7 +16,7 @@ from holidays.registry import EntityLoader from holidays.utils import * -__version__ = "0.30" +__version__ = "0.31" EntityLoader.load("countries", globals()) diff --git a/holidays/calendars/__init__.py b/holidays/calendars/__init__.py index 49b3bbbb0..742394b6e 100644 --- a/holidays/calendars/__init__.py +++ b/holidays/calendars/__init__.py @@ -20,4 +20,5 @@ from holidays.calendars.islamic import _CustomIslamicCalendar, _IslamicLunar from holidays.calendars.julian import JULIAN_CALENDAR from holidays.calendars.julian_revised import JULIAN_REVISED_CALENDAR +from holidays.calendars.persian import _Persian from holidays.calendars.thai import _ThaiLunisolar, KHMER_CALENDAR, THAI_CALENDAR diff --git a/holidays/calendars/islamic.py b/holidays/calendars/islamic.py index 4443e49c8..f392e3946 100644 --- a/holidays/calendars/islamic.py +++ b/holidays/calendars/islamic.py @@ -16,18 +16,656 @@ from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC from holidays.helpers import _normalize_tuple +ALI_AL_RIDA_DEATH = "ALI_AL_RIDA_DEATH" +ALI_BIRTHDAY = "ALI_BIRTHDAY" +ALI_DEATH = "ALI_DEATH" +ARBAEEN = "ARBAEEN" ASHURA = "ASHURA" EID_AL_ADHA = "EID_AL_ADHA" EID_AL_FITR = "EID_AL_FITR" +EID_AL_GHADIR = "EID_AL_GHADIR" +FATIMA_DEATH = "FATIMA_DEATH" HARI_HOL_JOHOR = "HARI_HOL_JOHOR" +HASAN_AL_ASKARI_DEATH = "HASAN_AL_ASKARI_DEATH" HIJRI_NEW_YEAR = "HIJRI_NEW_YEAR" +IMAM_MAHDI_BIRTHDAY = "IMAM_MAHDI_BIRTHDAY" ISRA_AND_MIRAJ = "ISRA_AND_MIRAJ" MAWLID = "MAWLID" NUZUL_AL_QURAN = "NUZUL_AL_QURAN" +PROPHET_DEATH = "PROPHET_DEATH" RAMADAN_BEGINNING = "RAMADAN_BEGINNING" +SADIQ_BIRTHDAY = "SADIQ_BIRTHDAY" +SADIQ_DEATH = "SADIQ_DEATH" +TASUA = "TASUA" class _IslamicLunar: + ALI_AL_RIDA_DEATH_DATES = { + 1924: (SEP, 28), + 1925: (SEP, 18), + 1926: (SEP, 7), + 1927: (AUG, 27), + 1928: (AUG, 15), + 1929: (AUG, 5), + 1930: (JUL, 25), + 1931: (JUL, 16), + 1932: (JUL, 4), + 1933: (JUN, 23), + 1934: (JUN, 12), + 1935: (JUN, 2), + 1936: (MAY, 21), + 1937: (MAY, 10), + 1938: (APR, 29), + 1939: (APR, 20), + 1940: (APR, 8), + 1941: (MAR, 27), + 1942: (MAR, 17), + 1943: (MAR, 6), + 1944: (FEB, 23), + 1945: (FEB, 12), + 1946: (FEB, 1), + 1947: (JAN, 22), + 1948: ((JAN, 11), (DEC, 30)), + 1949: (DEC, 20), + 1950: (DEC, 10), + 1951: (NOV, 29), + 1952: (NOV, 18), + 1953: (NOV, 7), + 1954: (OCT, 27), + 1955: (OCT, 17), + 1956: (OCT, 5), + 1957: (SEP, 24), + 1958: (SEP, 14), + 1959: (SEP, 3), + 1960: (AUG, 22), + 1961: (AUG, 11), + 1962: (JUL, 31), + 1963: (JUL, 21), + 1964: (JUL, 9), + 1965: (JUN, 28), + 1966: (JUN, 19), + 1967: (JUN, 7), + 1968: (MAY, 27), + 1969: (MAY, 16), + 1970: (MAY, 6), + 1971: (APR, 25), + 1972: (APR, 13), + 1973: (APR, 3), + 1974: (MAR, 23), + 1975: (MAR, 12), + 1976: (FEB, 29), + 1977: (FEB, 18), + 1978: (FEB, 7), + 1979: (JAN, 28), + 1980: (JAN, 18), + 1981: ((JAN, 6), (DEC, 26)), + 1982: (DEC, 15), + 1983: (DEC, 4), + 1984: (NOV, 22), + 1985: (NOV, 12), + 1986: (NOV, 2), + 1987: (OCT, 22), + 1988: (OCT, 10), + 1989: (SEP, 29), + 1990: (SEP, 19), + 1991: (SEP, 8), + 1992: (AUG, 28), + 1993: (AUG, 17), + 1994: (AUG, 7), + 1995: (JUL, 27), + 1996: (JUL, 15), + 1997: (JUL, 4), + 1998: (JUN, 24), + 1999: (JUN, 14), + 2000: (JUN, 2), + 2001: (MAY, 23), + 2002: (MAY, 12), + 2003: (MAY, 1), + 2004: (APR, 19), + 2005: (APR, 9), + 2006: (MAR, 29), + 2007: (MAR, 19), + 2008: (MAR, 8), + 2009: (FEB, 25), + 2010: (FEB, 14), + 2011: (FEB, 3), + 2012: (JAN, 23), + 2013: (JAN, 12), + 2014: ((JAN, 1), (DEC, 22)), + 2015: (DEC, 11), + 2016: (NOV, 29), + 2017: (NOV, 18), + 2018: (NOV, 8), + 2019: (OCT, 28), + 2020: (OCT, 17), + 2021: (OCT, 6), + 2022: (SEP, 26), + 2023: (SEP, 15), + 2024: (SEP, 3), + 2025: (AUG, 23), + 2026: (AUG, 13), + 2027: (AUG, 2), + 2028: (JUL, 22), + 2029: (JUL, 12), + 2030: (JUL, 1), + 2031: (JUN, 20), + 2032: (JUN, 8), + 2033: (MAY, 28), + 2034: (MAY, 18), + 2035: (MAY, 8), + 2036: (APR, 26), + 2037: (APR, 16), + 2038: (APR, 5), + 2039: (MAR, 25), + 2040: (MAR, 13), + 2041: (MAR, 3), + 2042: (FEB, 20), + 2043: (FEB, 10), + 2044: (JAN, 30), + 2045: (JAN, 18), + 2046: ((JAN, 7), (DEC, 27)), + 2047: (DEC, 17), + 2048: (DEC, 6), + 2049: (NOV, 25), + 2050: (NOV, 14), + 2051: (NOV, 4), + 2052: (OCT, 23), + 2053: (OCT, 12), + 2054: (OCT, 1), + 2055: (SEP, 21), + 2056: (SEP, 10), + 2057: (AUG, 30), + 2058: (AUG, 19), + 2059: (AUG, 8), + 2060: (JUL, 27), + 2061: (JUL, 17), + 2062: (JUL, 7), + 2063: (JUN, 26), + 2064: (JUN, 15), + 2065: (JUN, 4), + 2066: (MAY, 24), + 2067: (MAY, 13), + 2068: (MAY, 2), + 2069: (APR, 21), + 2070: (APR, 11), + 2071: (APR, 1), + 2072: (MAR, 20), + 2073: (MAR, 9), + 2074: (FEB, 26), + 2075: (FEB, 15), + 2076: (FEB, 5), + 2077: (JAN, 25), + } + + ALI_BIRTHDAY_DATES = { + 1925: (FEB, 7), + 1926: (JAN, 27), + 1927: (JAN, 17), + 1928: ((JAN, 6), (DEC, 25)), + 1929: (DEC, 14), + 1930: (DEC, 3), + 1931: (NOV, 23), + 1932: (NOV, 12), + 1933: (NOV, 1), + 1934: (OCT, 22), + 1935: (OCT, 11), + 1936: (SEP, 29), + 1937: (SEP, 18), + 1938: (SEP, 7), + 1939: (AUG, 28), + 1940: (AUG, 17), + 1941: (AUG, 5), + 1942: (JUL, 26), + 1943: (JUL, 15), + 1944: (JUL, 3), + 1945: (JUN, 23), + 1946: (JUN, 12), + 1947: (JUN, 2), + 1948: (MAY, 21), + 1949: (MAY, 10), + 1950: (APR, 30), + 1951: (APR, 20), + 1952: (APR, 8), + 1953: (MAR, 29), + 1954: (MAR, 18), + 1955: (MAR, 7), + 1956: (FEB, 25), + 1957: (FEB, 13), + 1958: (FEB, 2), + 1959: (JAN, 23), + 1960: ((JAN, 12), (DEC, 31)), + 1961: (DEC, 21), + 1962: (DEC, 10), + 1963: (NOV, 29), + 1964: (NOV, 17), + 1965: (NOV, 6), + 1966: (OCT, 27), + 1967: (OCT, 16), + 1968: (OCT, 5), + 1969: (SEP, 24), + 1970: (SEP, 14), + 1971: (SEP, 3), + 1972: (AUG, 22), + 1973: (AUG, 11), + 1974: (AUG, 1), + 1975: (JUL, 22), + 1976: (JUL, 10), + 1977: (JUN, 29), + 1978: (JUN, 18), + 1979: (JUN, 8), + 1980: (MAY, 27), + 1981: (MAY, 17), + 1982: (MAY, 6), + 1983: (APR, 26), + 1984: (APR, 14), + 1985: (APR, 3), + 1986: (MAR, 23), + 1987: (MAR, 13), + 1988: (MAR, 1), + 1989: (FEB, 19), + 1990: (FEB, 8), + 1991: (JAN, 28), + 1992: (JAN, 17), + 1993: ((JAN, 6), (DEC, 26)), + 1994: (DEC, 15), + 1995: (DEC, 5), + 1996: (NOV, 24), + 1997: (NOV, 13), + 1998: (NOV, 2), + 1999: (OCT, 22), + 2000: (OCT, 10), + 2001: (SEP, 30), + 2002: (SEP, 20), + 2003: (SEP, 10), + 2004: (AUG, 29), + 2005: (AUG, 18), + 2006: (AUG, 7), + 2007: (JUL, 27), + 2008: (JUL, 16), + 2009: (JUL, 6), + 2010: (JUN, 25), + 2011: (JUN, 15), + 2012: (JUN, 3), + 2013: (MAY, 23), + 2014: (MAY, 12), + 2015: (MAY, 2), + 2016: (APR, 20), + 2017: (APR, 10), + 2018: (MAR, 30), + 2019: (MAR, 20), + 2020: (MAR, 8), + 2021: (FEB, 25), + 2022: (FEB, 14), + 2023: (FEB, 4), + 2024: (JAN, 25), + 2025: (JAN, 13), + 2026: ((JAN, 2), (DEC, 22)), + 2027: (DEC, 11), + 2028: (NOV, 30), + 2029: (NOV, 19), + 2030: (NOV, 9), + 2031: (OCT, 29), + 2032: (OCT, 18), + 2033: (OCT, 7), + 2034: (SEP, 26), + 2035: (SEP, 15), + 2036: (SEP, 4), + 2037: (AUG, 24), + 2038: (AUG, 14), + 2039: (AUG, 3), + 2040: (JUL, 22), + 2041: (JUL, 11), + 2042: (JUL, 1), + 2043: (JUN, 20), + 2044: (JUN, 9), + 2045: (MAY, 30), + 2046: (MAY, 19), + 2047: (MAY, 8), + 2048: (APR, 26), + 2049: (APR, 15), + 2050: (APR, 5), + 2051: (MAR, 26), + 2052: (MAR, 14), + 2053: (MAR, 4), + 2054: (FEB, 21), + 2055: (FEB, 10), + 2056: (JAN, 30), + 2057: (JAN, 18), + 2058: ((JAN, 8), (DEC, 29)), + 2059: (DEC, 18), + 2060: (DEC, 6), + 2061: (NOV, 25), + 2062: (NOV, 15), + 2063: (NOV, 4), + 2064: (OCT, 24), + 2065: (OCT, 13), + 2066: (OCT, 3), + 2067: (SEP, 22), + 2068: (SEP, 10), + 2069: (AUG, 30), + 2070: (AUG, 20), + 2071: (AUG, 9), + 2072: (JUL, 29), + 2073: (JUL, 18), + 2074: (JUL, 8), + 2075: (JUN, 27), + 2076: (JUN, 15), + 2077: (JUN, 4), + } + + ALI_DEATH_DATES = { + 1925: (APR, 16), + 1926: (APR, 4), + 1927: (MAR, 24), + 1928: (MAR, 13), + 1929: (MAR, 2), + 1930: (FEB, 20), + 1931: (FEB, 9), + 1932: (JAN, 29), + 1933: (JAN, 17), + 1934: ((JAN, 7), (DEC, 28)), + 1935: (DEC, 17), + 1936: (DEC, 5), + 1937: (NOV, 25), + 1938: (NOV, 13), + 1939: (NOV, 3), + 1940: (OCT, 23), + 1941: (OCT, 11), + 1942: (OCT, 1), + 1943: (SEP, 20), + 1944: (SEP, 8), + 1945: (AUG, 28), + 1946: (AUG, 18), + 1947: (AUG, 8), + 1948: (JUL, 27), + 1949: (JUL, 16), + 1950: (JUL, 7), + 1951: (JUN, 26), + 1952: (JUN, 14), + 1953: (JUN, 3), + 1954: (MAY, 24), + 1955: (MAY, 14), + 1956: (MAY, 2), + 1957: (APR, 21), + 1958: (APR, 10), + 1959: (MAR, 31), + 1960: (MAR, 19), + 1961: (MAR, 8), + 1962: (FEB, 25), + 1963: (FEB, 15), + 1964: (FEB, 4), + 1965: (JAN, 23), + 1966: (JAN, 12), + 1967: ((JAN, 2), (DEC, 22)), + 1968: (DEC, 11), + 1969: (NOV, 30), + 1970: (NOV, 21), + 1971: (NOV, 9), + 1972: (OCT, 28), + 1973: (OCT, 17), + 1974: (OCT, 7), + 1975: (SEP, 26), + 1976: (SEP, 15), + 1977: (SEP, 4), + 1978: (AUG, 25), + 1979: (AUG, 14), + 1980: (AUG, 2), + 1981: (JUL, 22), + 1982: (JUL, 12), + 1983: (JUL, 2), + 1984: (JUN, 20), + 1985: (JUN, 9), + 1986: (MAY, 29), + 1987: (MAY, 19), + 1988: (MAY, 7), + 1989: (APR, 27), + 1990: (APR, 16), + 1991: (APR, 6), + 1992: (MAR, 25), + 1993: (MAR, 14), + 1994: (MAR, 3), + 1995: (FEB, 20), + 1996: (FEB, 10), + 1997: (JAN, 30), + 1998: (JAN, 19), + 1999: ((JAN, 8), (DEC, 29)), + 2000: (DEC, 17), + 2001: (DEC, 6), + 2002: (NOV, 26), + 2003: (NOV, 15), + 2004: (NOV, 4), + 2005: (OCT, 24), + 2006: (OCT, 14), + 2007: (OCT, 3), + 2008: (SEP, 21), + 2009: (SEP, 11), + 2010: (AUG, 31), + 2011: (AUG, 21), + 2012: (AUG, 9), + 2013: (JUL, 29), + 2014: (JUL, 18), + 2015: (JUL, 8), + 2016: (JUN, 26), + 2017: (JUN, 16), + 2018: (JUN, 5), + 2019: (MAY, 26), + 2020: (MAY, 14), + 2021: (MAY, 3), + 2022: (APR, 22), + 2023: (APR, 12), + 2024: (MAR, 31), + 2025: (MAR, 21), + 2026: (MAR, 10), + 2027: (FEB, 28), + 2028: (FEB, 17), + 2029: (FEB, 5), + 2030: (JAN, 25), + 2031: (JAN, 15), + 2032: ((JAN, 4), (DEC, 24)), + 2033: (DEC, 13), + 2034: (DEC, 2), + 2035: (NOV, 21), + 2036: (NOV, 9), + 2037: (OCT, 30), + 2038: (OCT, 20), + 2039: (OCT, 9), + 2040: (SEP, 27), + 2041: (SEP, 17), + 2042: (SEP, 6), + 2043: (AUG, 26), + 2044: (AUG, 15), + 2045: (AUG, 4), + 2046: (JUL, 25), + 2047: (JUL, 14), + 2048: (JUL, 2), + 2049: (JUN, 22), + 2050: (JUN, 11), + 2051: (MAY, 31), + 2052: (MAY, 20), + 2053: (MAY, 10), + 2054: (APR, 29), + 2055: (APR, 18), + 2056: (APR, 6), + 2057: (MAR, 26), + 2058: (MAR, 16), + 2059: (MAR, 6), + 2060: (FEB, 23), + 2061: (FEB, 12), + 2062: (FEB, 1), + 2063: (JAN, 21), + 2064: ((JAN, 10), (DEC, 29)), + 2065: (DEC, 19), + 2066: (DEC, 9), + 2067: (NOV, 28), + 2068: (NOV, 16), + 2069: (NOV, 5), + 2070: (OCT, 25), + 2071: (OCT, 15), + 2072: (OCT, 3), + 2073: (SEP, 23), + 2074: (SEP, 12), + 2075: (SEP, 2), + 2076: (AUG, 21), + 2077: (AUG, 10), + } + + ARBAEEN_DATES = { + 1924: (SEP, 19), + 1925: (SEP, 9), + 1926: (AUG, 29), + 1927: (AUG, 18), + 1928: (AUG, 6), + 1929: (JUL, 27), + 1930: (JUL, 16), + 1931: (JUL, 6), + 1932: (JUN, 25), + 1933: (JUN, 14), + 1934: (JUN, 3), + 1935: (MAY, 23), + 1936: (MAY, 12), + 1937: (MAY, 1), + 1938: (APR, 20), + 1939: (APR, 10), + 1940: (MAR, 29), + 1941: (MAR, 18), + 1942: (MAR, 8), + 1943: (FEB, 25), + 1944: (FEB, 14), + 1945: (FEB, 3), + 1946: (JAN, 23), + 1947: (JAN, 13), + 1948: ((JAN, 2), (DEC, 21)), + 1949: (DEC, 11), + 1950: (DEC, 1), + 1951: (NOV, 20), + 1952: (NOV, 8), + 1953: (OCT, 28), + 1954: (OCT, 18), + 1955: (OCT, 8), + 1956: (SEP, 25), + 1957: (SEP, 15), + 1958: (SEP, 5), + 1959: (AUG, 24), + 1960: (AUG, 13), + 1961: (AUG, 2), + 1962: (JUL, 22), + 1963: (JUL, 11), + 1964: (JUN, 30), + 1965: (JUN, 19), + 1966: (JUN, 9), + 1967: (MAY, 29), + 1968: (MAY, 17), + 1969: (MAY, 7), + 1970: (APR, 27), + 1971: (APR, 16), + 1972: (APR, 4), + 1973: (MAR, 25), + 1974: (MAR, 14), + 1975: (MAR, 3), + 1976: (FEB, 20), + 1977: (FEB, 8), + 1978: (JAN, 29), + 1979: (JAN, 18), + 1980: ((JAN, 8), (DEC, 27)), + 1981: (DEC, 16), + 1982: (DEC, 5), + 1983: (NOV, 24), + 1984: (NOV, 13), + 1985: (NOV, 3), + 1986: (OCT, 23), + 1987: (OCT, 13), + 1988: (OCT, 1), + 1989: (SEP, 20), + 1990: (SEP, 9), + 1991: (AUG, 30), + 1992: (AUG, 18), + 1993: (AUG, 8), + 1994: (JUL, 28), + 1995: (JUL, 18), + 1996: (JUL, 6), + 1997: (JUN, 25), + 1998: (JUN, 14), + 1999: (JUN, 4), + 2000: (MAY, 24), + 2001: (MAY, 14), + 2002: (MAY, 3), + 2003: (APR, 22), + 2004: (APR, 10), + 2005: (MAR, 30), + 2006: (MAR, 20), + 2007: (MAR, 10), + 2008: (FEB, 27), + 2009: (FEB, 15), + 2010: (FEB, 4), + 2011: (JAN, 24), + 2012: (JAN, 14), + 2013: ((JAN, 2), (DEC, 23)), + 2014: (DEC, 12), + 2015: (DEC, 2), + 2016: (NOV, 20), + 2017: (NOV, 9), + 2018: (OCT, 29), + 2019: (OCT, 19), + 2020: (OCT, 7), + 2021: (SEP, 27), + 2022: (SEP, 16), + 2023: (SEP, 5), + 2024: (AUG, 24), + 2025: (AUG, 14), + 2026: (AUG, 3), + 2027: (JUL, 24), + 2028: (JUL, 13), + 2029: (JUL, 2), + 2030: (JUN, 21), + 2031: (JUN, 10), + 2032: (MAY, 29), + 2033: (MAY, 19), + 2034: (MAY, 9), + 2035: (APR, 28), + 2036: (APR, 17), + 2037: (APR, 6), + 2038: (MAR, 26), + 2039: (MAR, 15), + 2040: (MAR, 4), + 2041: (FEB, 21), + 2042: (FEB, 11), + 2043: (JAN, 31), + 2044: (JAN, 21), + 2045: ((JAN, 9), (DEC, 29)), + 2046: (DEC, 18), + 2047: (DEC, 8), + 2048: (NOV, 26), + 2049: (NOV, 16), + 2050: (NOV, 5), + 2051: (OCT, 25), + 2052: (OCT, 13), + 2053: (OCT, 2), + 2054: (SEP, 22), + 2055: (SEP, 12), + 2056: (AUG, 31), + 2057: (AUG, 20), + 2058: (AUG, 9), + 2059: (JUL, 30), + 2060: (JUL, 18), + 2061: (JUL, 8), + 2062: (JUN, 27), + 2063: (JUN, 17), + 2064: (JUN, 5), + 2065: (MAY, 25), + 2066: (MAY, 14), + 2067: (MAY, 4), + 2068: (APR, 22), + 2069: (APR, 12), + 2070: (APR, 2), + 2071: (MAR, 22), + 2072: (MAR, 10), + 2073: (FEB, 27), + 2074: (FEB, 16), + 2075: (FEB, 6), + 2076: (JAN, 26), + 2077: (JAN, 15), + } + ASHURA_DATES = { 1924: (AUG, 10), 1925: (AUG, 1), @@ -496,6 +1134,319 @@ class _IslamicLunar: 2077: (AUG, 19), } + EID_AL_GHADIR_DATES = { + 1925: (JUL, 10), + 1926: (JUN, 29), + 1927: (JUN, 18), + 1928: (JUN, 7), + 1929: (MAY, 27), + 1930: (MAY, 17), + 1931: (MAY, 6), + 1932: (APR, 24), + 1933: (APR, 13), + 1934: (APR, 3), + 1935: (MAR, 23), + 1936: (MAR, 12), + 1937: (MAR, 1), + 1938: (FEB, 18), + 1939: (FEB, 7), + 1940: (JAN, 28), + 1941: (JAN, 16), + 1942: ((JAN, 5), (DEC, 26)), + 1943: (DEC, 15), + 1944: (DEC, 3), + 1945: (NOV, 23), + 1946: (NOV, 12), + 1947: (NOV, 2), + 1948: (OCT, 21), + 1949: (OCT, 10), + 1950: (OCT, 1), + 1951: (SEP, 20), + 1952: (SEP, 8), + 1953: (AUG, 28), + 1954: (AUG, 17), + 1955: (AUG, 7), + 1956: (JUL, 27), + 1957: (JUL, 16), + 1958: (JUL, 5), + 1959: (JUN, 25), + 1960: (JUN, 12), + 1961: (JUN, 2), + 1962: (MAY, 22), + 1963: (MAY, 11), + 1964: (APR, 30), + 1965: (APR, 19), + 1966: (APR, 9), + 1967: (MAR, 29), + 1968: (MAR, 17), + 1969: (MAR, 7), + 1970: (FEB, 24), + 1971: (FEB, 14), + 1972: (FEB, 3), + 1973: (JAN, 22), + 1974: (JAN, 11), + 1975: ((JAN, 1), (DEC, 21)), + 1976: (DEC, 9), + 1977: (NOV, 29), + 1978: (NOV, 18), + 1979: (NOV, 8), + 1980: (OCT, 27), + 1981: (OCT, 16), + 1982: (OCT, 5), + 1983: (SEP, 25), + 1984: (SEP, 13), + 1985: (SEP, 3), + 1986: (AUG, 23), + 1987: (AUG, 12), + 1988: (JUL, 31), + 1989: (JUL, 21), + 1990: (JUL, 10), + 1991: (JUN, 30), + 1992: (JUN, 19), + 1993: (JUN, 8), + 1994: (MAY, 28), + 1995: (MAY, 17), + 1996: (MAY, 5), + 1997: (APR, 25), + 1998: (APR, 15), + 1999: (APR, 4), + 2000: (MAR, 24), + 2001: (MAR, 13), + 2002: (MAR, 2), + 2003: (FEB, 19), + 2004: (FEB, 9), + 2005: (JAN, 29), + 2006: (JAN, 18), + 2007: ((JAN, 8), (DEC, 28)), + 2008: (DEC, 16), + 2009: (DEC, 5), + 2010: (NOV, 24), + 2011: (NOV, 14), + 2012: (NOV, 3), + 2013: (OCT, 23), + 2014: (OCT, 12), + 2015: (OCT, 1), + 2016: (SEP, 19), + 2017: (SEP, 9), + 2018: (AUG, 29), + 2019: (AUG, 19), + 2020: (AUG, 8), + 2021: (JUL, 28), + 2022: (JUL, 17), + 2023: (JUL, 6), + 2024: (JUN, 24), + 2025: (JUN, 14), + 2026: (JUN, 4), + 2027: (MAY, 24), + 2028: (MAY, 13), + 2029: (MAY, 2), + 2030: (APR, 21), + 2031: (APR, 10), + 2032: (MAR, 30), + 2033: (MAR, 19), + 2034: (MAR, 9), + 2035: (FEB, 26), + 2036: (FEB, 15), + 2037: (FEB, 3), + 2038: (JAN, 24), + 2039: (JAN, 13), + 2040: ((JAN, 3), (DEC, 22)), + 2041: (DEC, 12), + 2042: (DEC, 1), + 2043: (NOV, 20), + 2044: (NOV, 8), + 2045: (OCT, 29), + 2046: (OCT, 18), + 2047: (OCT, 8), + 2048: (SEP, 27), + 2049: (SEP, 16), + 2050: (SEP, 5), + 2051: (AUG, 25), + 2052: (AUG, 13), + 2053: (AUG, 3), + 2054: (JUL, 23), + 2055: (JUL, 13), + 2056: (JUL, 1), + 2057: (JUN, 20), + 2058: (JUN, 9), + 2059: (MAY, 30), + 2060: (MAY, 18), + 2061: (MAY, 8), + 2062: (APR, 28), + 2063: (APR, 17), + 2064: (APR, 5), + 2065: (MAR, 25), + 2066: (MAR, 14), + 2067: (MAR, 4), + 2068: (FEB, 21), + 2069: (FEB, 10), + 2070: (JAN, 30), + 2071: (JAN, 19), + 2072: ((JAN, 8), (DEC, 28)), + 2073: (DEC, 17), + 2074: (DEC, 7), + 2075: (NOV, 26), + 2076: (NOV, 15), + 2077: (NOV, 4), + } + + FATIMA_DEATH_DATES = { + 1924: (DEC, 29), + 1925: (DEC, 19), + 1926: (DEC, 9), + 1927: (NOV, 27), + 1928: (NOV, 15), + 1929: (NOV, 5), + 1930: (OCT, 25), + 1931: (OCT, 15), + 1932: (OCT, 4), + 1933: (SEP, 23), + 1934: (SEP, 12), + 1935: (SEP, 1), + 1936: (AUG, 21), + 1937: (AUG, 10), + 1938: (JUL, 30), + 1939: (JUL, 20), + 1940: (JUL, 9), + 1941: (JUN, 27), + 1942: (JUN, 17), + 1943: (JUN, 6), + 1944: (MAY, 25), + 1945: (MAY, 15), + 1946: (MAY, 4), + 1947: (APR, 24), + 1948: (APR, 12), + 1949: (APR, 1), + 1950: (MAR, 22), + 1951: (MAR, 12), + 1952: (FEB, 28), + 1953: (FEB, 17), + 1954: (FEB, 6), + 1955: (JAN, 27), + 1956: (JAN, 17), + 1957: ((JAN, 4), (DEC, 24)), + 1958: (DEC, 15), + 1959: (DEC, 3), + 1960: (NOV, 22), + 1961: (NOV, 11), + 1962: (OCT, 31), + 1963: (OCT, 21), + 1964: (OCT, 9), + 1965: (SEP, 28), + 1966: (SEP, 18), + 1967: (SEP, 7), + 1968: (AUG, 27), + 1969: (AUG, 16), + 1970: (AUG, 6), + 1971: (JUL, 26), + 1972: (JUL, 14), + 1973: (JUL, 3), + 1974: (JUN, 23), + 1975: (JUN, 12), + 1976: (JUN, 1), + 1977: (MAY, 21), + 1978: (MAY, 10), + 1979: (APR, 29), + 1980: (APR, 18), + 1981: (APR, 7), + 1982: (MAR, 28), + 1983: (MAR, 17), + 1984: (MAR, 5), + 1985: (FEB, 22), + 1986: (FEB, 12), + 1987: (FEB, 1), + 1988: (JAN, 22), + 1989: ((JAN, 10), (DEC, 31)), + 1990: (DEC, 20), + 1991: (DEC, 9), + 1992: (NOV, 27), + 1993: (NOV, 16), + 1994: (NOV, 6), + 1995: (OCT, 27), + 1996: (OCT, 15), + 1997: (OCT, 4), + 1998: (SEP, 23), + 1999: (SEP, 13), + 2000: (SEP, 1), + 2001: (AUG, 22), + 2002: (AUG, 12), + 2003: (AUG, 1), + 2004: (JUL, 20), + 2005: (JUL, 9), + 2006: (JUN, 29), + 2007: (JUN, 18), + 2008: (JUN, 7), + 2009: (MAY, 27), + 2010: (MAY, 17), + 2011: (MAY, 6), + 2012: (APR, 24), + 2013: (APR, 13), + 2014: (APR, 3), + 2015: (MAR, 23), + 2016: (MAR, 12), + 2017: (MAR, 2), + 2018: (FEB, 19), + 2019: (FEB, 8), + 2020: (JAN, 28), + 2021: (JAN, 16), + 2022: ((JAN, 6), (DEC, 27)), + 2023: (DEC, 16), + 2024: (DEC, 4), + 2025: (NOV, 24), + 2026: (NOV, 13), + 2027: (NOV, 2), + 2028: (OCT, 21), + 2029: (OCT, 11), + 2030: (OCT, 1), + 2031: (SEP, 20), + 2032: (SEP, 8), + 2033: (AUG, 28), + 2034: (AUG, 17), + 2035: (AUG, 7), + 2036: (JUL, 26), + 2037: (JUL, 16), + 2038: (JUL, 5), + 2039: (JUN, 25), + 2040: (JUN, 13), + 2041: (JUN, 2), + 2042: (MAY, 22), + 2043: (MAY, 12), + 2044: (MAY, 1), + 2045: (APR, 20), + 2046: (APR, 9), + 2047: (MAR, 29), + 2048: (MAR, 18), + 2049: (MAR, 7), + 2050: (FEB, 25), + 2051: (FEB, 14), + 2052: (FEB, 4), + 2053: (JAN, 23), + 2054: (JAN, 12), + 2055: ((JAN, 1), (DEC, 21)), + 2056: (DEC, 10), + 2057: (NOV, 29), + 2058: (NOV, 19), + 2059: (NOV, 8), + 2060: (OCT, 27), + 2061: (OCT, 17), + 2062: (OCT, 6), + 2063: (SEP, 26), + 2064: (SEP, 14), + 2065: (SEP, 4), + 2066: (AUG, 24), + 2067: (AUG, 13), + 2068: (AUG, 1), + 2069: (JUL, 22), + 2070: (JUL, 11), + 2071: (JUL, 1), + 2072: (JUN, 19), + 2073: (JUN, 9), + 2074: (MAY, 29), + 2075: (MAY, 18), + 2076: (MAY, 6), + 2077: (APR, 26), + } + HARI_HOL_JOHOR_DATES = { 1924: (SEP, 5), 1925: (AUG, 26), @@ -653,6 +1604,163 @@ class _IslamicLunar: 2077: (JAN, 1), } + HASAN_AL_ASKARI_DEATH_DATES = { + 1924: (OCT, 6), + 1925: (SEP, 26), + 1926: (SEP, 15), + 1927: (SEP, 4), + 1928: (AUG, 23), + 1929: (AUG, 13), + 1930: (AUG, 2), + 1931: (JUL, 24), + 1932: (JUL, 12), + 1933: (JUL, 1), + 1934: (JUN, 20), + 1935: (JUN, 10), + 1936: (MAY, 29), + 1937: (MAY, 18), + 1938: (MAY, 7), + 1939: (APR, 28), + 1940: (APR, 16), + 1941: (APR, 4), + 1942: (MAR, 25), + 1943: (MAR, 14), + 1944: (MAR, 2), + 1945: (FEB, 20), + 1946: (FEB, 9), + 1947: (JAN, 30), + 1948: (JAN, 19), + 1949: ((JAN, 7), (DEC, 28)), + 1950: (DEC, 18), + 1951: (DEC, 7), + 1952: (NOV, 26), + 1953: (NOV, 15), + 1954: (NOV, 4), + 1955: (OCT, 25), + 1956: (OCT, 13), + 1957: (OCT, 2), + 1958: (SEP, 22), + 1959: (SEP, 11), + 1960: (AUG, 30), + 1961: (AUG, 19), + 1962: (AUG, 8), + 1963: (JUL, 29), + 1964: (JUL, 17), + 1965: (JUL, 6), + 1966: (JUN, 27), + 1967: (JUN, 15), + 1968: (JUN, 4), + 1969: (MAY, 24), + 1970: (MAY, 14), + 1971: (MAY, 3), + 1972: (APR, 21), + 1973: (APR, 11), + 1974: (MAR, 31), + 1975: (MAR, 20), + 1976: (MAR, 8), + 1977: (FEB, 26), + 1978: (FEB, 15), + 1979: (FEB, 5), + 1980: (JAN, 26), + 1981: (JAN, 14), + 1982: ((JAN, 3), (DEC, 23)), + 1983: (DEC, 12), + 1984: (NOV, 30), + 1985: (NOV, 20), + 1986: (NOV, 10), + 1987: (OCT, 30), + 1988: (OCT, 18), + 1989: (OCT, 7), + 1990: (SEP, 27), + 1991: (SEP, 16), + 1992: (SEP, 5), + 1993: (AUG, 25), + 1994: (AUG, 15), + 1995: (AUG, 4), + 1996: (JUL, 23), + 1997: (JUL, 12), + 1998: (JUL, 2), + 1999: (JUN, 22), + 2000: (JUN, 10), + 2001: (MAY, 31), + 2002: (MAY, 20), + 2003: (MAY, 9), + 2004: (APR, 27), + 2005: (APR, 17), + 2006: (APR, 6), + 2007: (MAR, 27), + 2008: (MAR, 16), + 2009: (MAR, 5), + 2010: (FEB, 22), + 2011: (FEB, 11), + 2012: (JAN, 31), + 2013: (JAN, 20), + 2014: ((JAN, 9), (DEC, 30)), + 2015: (DEC, 19), + 2016: (DEC, 7), + 2017: (NOV, 26), + 2018: (NOV, 16), + 2019: (NOV, 5), + 2020: (OCT, 25), + 2021: (OCT, 14), + 2022: (OCT, 4), + 2023: (SEP, 23), + 2024: (SEP, 11), + 2025: (AUG, 31), + 2026: (AUG, 21), + 2027: (AUG, 10), + 2028: (JUL, 30), + 2029: (JUL, 20), + 2030: (JUL, 9), + 2031: (JUN, 28), + 2032: (JUN, 16), + 2033: (JUN, 5), + 2034: (MAY, 26), + 2035: (MAY, 16), + 2036: (MAY, 4), + 2037: (APR, 24), + 2038: (APR, 13), + 2039: (APR, 2), + 2040: (MAR, 21), + 2041: (MAR, 11), + 2042: (FEB, 28), + 2043: (FEB, 18), + 2044: (FEB, 7), + 2045: (JAN, 26), + 2046: (JAN, 15), + 2047: ((JAN, 4), (DEC, 25)), + 2048: (DEC, 14), + 2049: (DEC, 3), + 2050: (NOV, 22), + 2051: (NOV, 12), + 2052: (OCT, 31), + 2053: (OCT, 20), + 2054: (OCT, 9), + 2055: (SEP, 29), + 2056: (SEP, 18), + 2057: (SEP, 7), + 2058: (AUG, 27), + 2059: (AUG, 16), + 2060: (AUG, 4), + 2061: (JUL, 25), + 2062: (JUL, 15), + 2063: (JUL, 4), + 2064: (JUN, 23), + 2065: (JUN, 12), + 2066: (JUN, 1), + 2067: (MAY, 21), + 2068: (MAY, 10), + 2069: (APR, 29), + 2070: (APR, 19), + 2071: (APR, 9), + 2072: (MAR, 28), + 2073: (MAR, 17), + 2074: (MAR, 6), + 2075: (FEB, 23), + 2076: (FEB, 13), + 2077: (FEB, 2), + } + HIJRI_NEW_YEAR_DATES = { 1924: (AUG, 1), 1925: (JUL, 23), @@ -809,6 +1917,162 @@ class _IslamicLunar: 2076: (NOV, 27), } + IMAM_MAHDI_BIRTHDAY_DATES = { + 1925: (MAR, 11), + 1926: (FEB, 28), + 1927: (FEB, 18), + 1928: (FEB, 7), + 1929: (JAN, 26), + 1930: (JAN, 15), + 1931: ((JAN, 4), (DEC, 25)), + 1932: (DEC, 13), + 1933: (DEC, 3), + 1934: (NOV, 22), + 1935: (NOV, 12), + 1936: (OCT, 31), + 1937: (OCT, 20), + 1938: (OCT, 9), + 1939: (SEP, 29), + 1940: (SEP, 17), + 1941: (SEP, 6), + 1942: (AUG, 27), + 1943: (AUG, 16), + 1944: (AUG, 4), + 1945: (JUL, 25), + 1946: (JUL, 14), + 1947: (JUL, 4), + 1948: (JUN, 22), + 1949: (JUN, 11), + 1950: (JUN, 1), + 1951: (MAY, 22), + 1952: (MAY, 9), + 1953: (APR, 29), + 1954: (APR, 18), + 1955: (APR, 8), + 1956: (MAR, 28), + 1957: (MAR, 17), + 1958: (MAR, 5), + 1959: (FEB, 24), + 1960: (FEB, 12), + 1961: (FEB, 1), + 1962: (JAN, 21), + 1963: ((JAN, 11), (DEC, 31)), + 1964: (DEC, 19), + 1965: (DEC, 8), + 1966: (NOV, 28), + 1967: (NOV, 17), + 1968: (NOV, 6), + 1969: (OCT, 26), + 1970: (OCT, 16), + 1971: (OCT, 5), + 1972: (SEP, 23), + 1973: (SEP, 12), + 1974: (SEP, 2), + 1975: (AUG, 22), + 1976: (AUG, 11), + 1977: (JUL, 31), + 1978: (JUL, 20), + 1979: (JUL, 9), + 1980: (JUN, 28), + 1981: (JUN, 17), + 1982: (JUN, 7), + 1983: (MAY, 27), + 1984: (MAY, 16), + 1985: (MAY, 5), + 1986: (APR, 24), + 1987: (APR, 13), + 1988: (APR, 2), + 1989: (MAR, 22), + 1990: (MAR, 12), + 1991: (MAR, 1), + 1992: (FEB, 18), + 1993: (FEB, 6), + 1994: (JAN, 26), + 1995: (JAN, 16), + 1996: ((JAN, 6), (DEC, 25)), + 1997: (DEC, 15), + 1998: (DEC, 4), + 1999: (NOV, 23), + 2000: (NOV, 11), + 2001: (OCT, 31), + 2002: (OCT, 21), + 2003: (OCT, 11), + 2004: (SEP, 29), + 2005: (SEP, 19), + 2006: (SEP, 8), + 2007: (AUG, 28), + 2008: (AUG, 16), + 2009: (AUG, 6), + 2010: (JUL, 27), + 2011: (JUL, 16), + 2012: (JUL, 5), + 2013: (JUN, 24), + 2014: (JUN, 13), + 2015: (JUN, 2), + 2016: (MAY, 22), + 2017: (MAY, 11), + 2018: (MAY, 1), + 2019: (APR, 20), + 2020: (APR, 8), + 2021: (MAR, 28), + 2022: (MAR, 18), + 2023: (MAR, 7), + 2024: (FEB, 25), + 2025: (FEB, 14), + 2026: (FEB, 3), + 2027: (JAN, 23), + 2028: ((JAN, 12), (DEC, 31)), + 2029: (DEC, 21), + 2030: (DEC, 10), + 2031: (NOV, 30), + 2032: (NOV, 18), + 2033: (NOV, 7), + 2034: (OCT, 27), + 2035: (OCT, 16), + 2036: (OCT, 5), + 2037: (SEP, 25), + 2038: (SEP, 14), + 2039: (SEP, 4), + 2040: (AUG, 23), + 2041: (AUG, 12), + 2042: (AUG, 1), + 2043: (JUL, 22), + 2044: (JUL, 10), + 2045: (JUN, 30), + 2046: (JUN, 19), + 2047: (JUN, 9), + 2048: (MAY, 28), + 2049: (MAY, 17), + 2050: (MAY, 6), + 2051: (APR, 26), + 2052: (APR, 15), + 2053: (APR, 4), + 2054: (MAR, 24), + 2055: (MAR, 13), + 2056: (MAR, 2), + 2057: (FEB, 19), + 2058: (FEB, 8), + 2059: (JAN, 29), + 2060: (JAN, 19), + 2061: ((JAN, 7), (DEC, 27)), + 2062: (DEC, 16), + 2063: (DEC, 6), + 2064: (NOV, 24), + 2065: (NOV, 14), + 2066: (NOV, 3), + 2067: (OCT, 24), + 2068: (OCT, 12), + 2069: (OCT, 1), + 2070: (SEP, 20), + 2071: (SEP, 9), + 2072: (AUG, 29), + 2073: (AUG, 19), + 2074: (AUG, 8), + 2075: (JUL, 28), + 2076: (JUL, 16), + 2077: (JUL, 5), + } + ISRA_AND_MIRAJ_DATES = { 1925: (FEB, 21), 1926: (FEB, 10), @@ -1278,6 +2542,163 @@ class _IslamicLunar: 2077: (AUG, 6), } + PROPHET_DEATH_DATES = { + 1924: (SEP, 27), + 1925: (SEP, 17), + 1926: (SEP, 6), + 1927: (AUG, 26), + 1928: (AUG, 14), + 1929: (AUG, 4), + 1930: (JUL, 24), + 1931: (JUL, 14), + 1932: (JUL, 3), + 1933: (JUN, 22), + 1934: (JUN, 11), + 1935: (MAY, 31), + 1936: (MAY, 20), + 1937: (MAY, 9), + 1938: (APR, 28), + 1939: (APR, 18), + 1940: (APR, 6), + 1941: (MAR, 26), + 1942: (MAR, 16), + 1943: (MAR, 5), + 1944: (FEB, 22), + 1945: (FEB, 11), + 1946: (JAN, 31), + 1947: (JAN, 21), + 1948: ((JAN, 10), (DEC, 29)), + 1949: (DEC, 19), + 1950: (DEC, 9), + 1951: (NOV, 28), + 1952: (NOV, 16), + 1953: (NOV, 5), + 1954: (OCT, 26), + 1955: (OCT, 16), + 1956: (OCT, 3), + 1957: (SEP, 23), + 1958: (SEP, 13), + 1959: (SEP, 1), + 1960: (AUG, 21), + 1961: (AUG, 10), + 1962: (JUL, 30), + 1963: (JUL, 19), + 1964: (JUL, 8), + 1965: (JUN, 27), + 1966: (JUN, 17), + 1967: (JUN, 6), + 1968: (MAY, 25), + 1969: (MAY, 15), + 1970: (MAY, 5), + 1971: (APR, 24), + 1972: (APR, 12), + 1973: (APR, 2), + 1974: (MAR, 22), + 1975: (MAR, 11), + 1976: (FEB, 28), + 1977: (FEB, 16), + 1978: (FEB, 6), + 1979: (JAN, 26), + 1980: (JAN, 16), + 1981: ((JAN, 4), (DEC, 24)), + 1982: (DEC, 13), + 1983: (DEC, 2), + 1984: (NOV, 21), + 1985: (NOV, 11), + 1986: (OCT, 31), + 1987: (OCT, 21), + 1988: (OCT, 9), + 1989: (SEP, 28), + 1990: (SEP, 17), + 1991: (SEP, 7), + 1992: (AUG, 26), + 1993: (AUG, 16), + 1994: (AUG, 5), + 1995: (JUL, 26), + 1996: (JUL, 14), + 1997: (JUL, 3), + 1998: (JUN, 22), + 1999: (JUN, 12), + 2000: (JUN, 1), + 2001: (MAY, 22), + 2002: (MAY, 11), + 2003: (APR, 30), + 2004: (APR, 18), + 2005: (APR, 7), + 2006: (MAR, 28), + 2007: (MAR, 18), + 2008: (MAR, 6), + 2009: (FEB, 23), + 2010: (FEB, 12), + 2011: (FEB, 1), + 2012: (JAN, 22), + 2013: ((JAN, 10), (DEC, 31)), + 2014: (DEC, 20), + 2015: (DEC, 10), + 2016: (NOV, 28), + 2017: (NOV, 17), + 2018: (NOV, 6), + 2019: (OCT, 27), + 2020: (OCT, 15), + 2021: (OCT, 5), + 2022: (SEP, 24), + 2023: (SEP, 13), + 2024: (SEP, 1), + 2025: (AUG, 22), + 2026: (AUG, 11), + 2027: (AUG, 1), + 2028: (JUL, 21), + 2029: (JUL, 10), + 2030: (JUN, 29), + 2031: (JUN, 18), + 2032: (JUN, 6), + 2033: (MAY, 27), + 2034: (MAY, 17), + 2035: (MAY, 6), + 2036: (APR, 25), + 2037: (APR, 14), + 2038: (APR, 3), + 2039: (MAR, 23), + 2040: (MAR, 12), + 2041: (MAR, 1), + 2042: (FEB, 19), + 2043: (FEB, 8), + 2044: (JAN, 29), + 2045: (JAN, 17), + 2046: ((JAN, 6), (DEC, 26)), + 2047: (DEC, 16), + 2048: (DEC, 4), + 2049: (NOV, 24), + 2050: (NOV, 13), + 2051: (NOV, 2), + 2052: (OCT, 21), + 2053: (OCT, 10), + 2054: (SEP, 30), + 2055: (SEP, 20), + 2056: (SEP, 8), + 2057: (AUG, 28), + 2058: (AUG, 17), + 2059: (AUG, 7), + 2060: (JUL, 26), + 2061: (JUL, 16), + 2062: (JUL, 5), + 2063: (JUN, 25), + 2064: (JUN, 13), + 2065: (JUN, 2), + 2066: (MAY, 22), + 2067: (MAY, 12), + 2068: (APR, 30), + 2069: (APR, 20), + 2070: (APR, 10), + 2071: (MAR, 30), + 2072: (MAR, 18), + 2073: (MAR, 7), + 2074: (FEB, 24), + 2075: (FEB, 14), + 2076: (FEB, 3), + 2077: (JAN, 23), + } + RAMADAN_BEGINNING_DATES = { 1925: (MAR, 27), 1926: (MAR, 15), @@ -1434,6 +2855,475 @@ class _IslamicLunar: 2077: (JUL, 21), } + SADIQ_BIRTHDAY_DATES = { + 1924: (OCT, 15), + 1925: (OCT, 5), + 1926: (SEP, 24), + 1927: (SEP, 13), + 1928: (SEP, 1), + 1929: (AUG, 22), + 1930: (AUG, 11), + 1931: (AUG, 2), + 1932: (JUL, 21), + 1933: (JUL, 10), + 1934: (JUN, 29), + 1935: (JUN, 19), + 1936: (JUN, 7), + 1937: (MAY, 27), + 1938: (MAY, 16), + 1939: (MAY, 7), + 1940: (APR, 25), + 1941: (APR, 13), + 1942: (APR, 3), + 1943: (MAR, 23), + 1944: (MAR, 11), + 1945: (MAR, 1), + 1946: (FEB, 18), + 1947: (FEB, 8), + 1948: (JAN, 28), + 1949: (JAN, 16), + 1950: ((JAN, 6), (DEC, 27)), + 1951: (DEC, 16), + 1952: (DEC, 5), + 1953: (NOV, 24), + 1954: (NOV, 13), + 1955: (NOV, 3), + 1956: (OCT, 22), + 1957: (OCT, 11), + 1958: (OCT, 1), + 1959: (SEP, 20), + 1960: (SEP, 8), + 1961: (AUG, 28), + 1962: (AUG, 17), + 1963: (AUG, 7), + 1964: (JUL, 26), + 1965: (JUL, 15), + 1966: (JUL, 6), + 1967: (JUN, 24), + 1968: (JUN, 13), + 1969: (JUN, 2), + 1970: (MAY, 23), + 1971: (MAY, 12), + 1972: (APR, 30), + 1973: (APR, 20), + 1974: (APR, 9), + 1975: (MAR, 29), + 1976: (MAR, 17), + 1977: (MAR, 7), + 1978: (FEB, 24), + 1979: (FEB, 14), + 1980: (FEB, 4), + 1981: (JAN, 23), + 1982: (JAN, 12), + 1983: ((JAN, 1), (DEC, 21)), + 1984: (DEC, 9), + 1985: (NOV, 29), + 1986: (NOV, 19), + 1987: (NOV, 8), + 1988: (OCT, 27), + 1989: (OCT, 16), + 1990: (OCT, 6), + 1991: (SEP, 25), + 1992: (SEP, 14), + 1993: (SEP, 3), + 1994: (AUG, 24), + 1995: (AUG, 13), + 1996: (AUG, 1), + 1997: (JUL, 21), + 1998: (JUL, 11), + 1999: (JUL, 1), + 2000: (JUN, 19), + 2001: (JUN, 9), + 2002: (MAY, 29), + 2003: (MAY, 18), + 2004: (MAY, 6), + 2005: (APR, 26), + 2006: (APR, 15), + 2007: (APR, 5), + 2008: (MAR, 25), + 2009: (MAR, 14), + 2010: (MAR, 3), + 2011: (FEB, 20), + 2012: (FEB, 9), + 2013: (JAN, 29), + 2014: (JAN, 18), + 2015: ((JAN, 8), (DEC, 28)), + 2016: (DEC, 16), + 2017: (DEC, 5), + 2018: (NOV, 25), + 2019: (NOV, 14), + 2020: (NOV, 3), + 2021: (OCT, 23), + 2022: (OCT, 13), + 2023: (OCT, 2), + 2024: (SEP, 20), + 2025: (SEP, 9), + 2026: (AUG, 30), + 2027: (AUG, 19), + 2028: (AUG, 8), + 2029: (JUL, 29), + 2030: (JUL, 18), + 2031: (JUL, 7), + 2032: (JUN, 25), + 2033: (JUN, 14), + 2034: (JUN, 4), + 2035: (MAY, 25), + 2036: (MAY, 13), + 2037: (MAY, 3), + 2038: (APR, 22), + 2039: (APR, 11), + 2040: (MAR, 30), + 2041: (MAR, 20), + 2042: (MAR, 9), + 2043: (FEB, 27), + 2044: (FEB, 16), + 2045: (FEB, 4), + 2046: (JAN, 24), + 2047: (JAN, 13), + 2048: ((JAN, 3), (DEC, 23)), + 2049: (DEC, 12), + 2050: (DEC, 1), + 2051: (NOV, 21), + 2052: (NOV, 9), + 2053: (OCT, 29), + 2054: (OCT, 18), + 2055: (OCT, 8), + 2056: (SEP, 27), + 2057: (SEP, 16), + 2058: (SEP, 5), + 2059: (AUG, 25), + 2060: (AUG, 13), + 2061: (AUG, 3), + 2062: (JUL, 24), + 2063: (JUL, 13), + 2064: (JUL, 2), + 2065: (JUN, 21), + 2066: (JUN, 10), + 2067: (MAY, 30), + 2068: (MAY, 19), + 2069: (MAY, 8), + 2070: (APR, 28), + 2071: (APR, 18), + 2072: (APR, 6), + 2073: (MAR, 26), + 2074: (MAR, 15), + 2075: (MAR, 4), + 2076: (FEB, 22), + 2077: (FEB, 11), + } + + SADIQ_DEATH_DATES = { + 1925: (MAY, 18), + 1926: (MAY, 8), + 1927: (APR, 27), + 1928: (APR, 15), + 1929: (APR, 5), + 1930: (MAR, 25), + 1931: (MAR, 15), + 1932: (MAR, 3), + 1933: (FEB, 20), + 1934: (FEB, 10), + 1935: (JAN, 31), + 1936: (JAN, 20), + 1937: ((JAN, 8), (DEC, 28)), + 1938: (DEC, 17), + 1939: (DEC, 6), + 1940: (NOV, 25), + 1941: (NOV, 14), + 1942: (NOV, 4), + 1943: (OCT, 24), + 1944: (OCT, 12), + 1945: (OCT, 1), + 1946: (SEP, 21), + 1947: (SEP, 11), + 1948: (AUG, 30), + 1949: (AUG, 19), + 1950: (AUG, 9), + 1951: (JUL, 30), + 1952: (JUL, 17), + 1953: (JUL, 7), + 1954: (JUN, 26), + 1955: (JUN, 16), + 1956: (JUN, 4), + 1957: (MAY, 25), + 1958: (MAY, 14), + 1959: (MAY, 4), + 1960: (APR, 21), + 1961: (APR, 11), + 1962: (MAR, 31), + 1963: (MAR, 20), + 1964: (MAR, 9), + 1965: (FEB, 26), + 1966: (FEB, 15), + 1967: (FEB, 5), + 1968: (JAN, 25), + 1969: (JAN, 14), + 1970: ((JAN, 3), (DEC, 24)), + 1971: (DEC, 13), + 1972: (DEC, 1), + 1973: (NOV, 20), + 1974: (NOV, 9), + 1975: (OCT, 30), + 1976: (OCT, 18), + 1977: (OCT, 8), + 1978: (SEP, 27), + 1979: (SEP, 16), + 1980: (SEP, 5), + 1981: (AUG, 25), + 1982: (AUG, 14), + 1983: (AUG, 4), + 1984: (JUL, 24), + 1985: (JUL, 13), + 1986: (JUL, 2), + 1987: (JUN, 21), + 1988: (JUN, 9), + 1989: (MAY, 30), + 1990: (MAY, 20), + 1991: (MAY, 9), + 1992: (APR, 28), + 1993: (APR, 17), + 1994: (APR, 6), + 1995: (MAR, 26), + 1996: (MAR, 14), + 1997: (MAR, 4), + 1998: (FEB, 22), + 1999: (FEB, 11), + 2000: (FEB, 1), + 2001: (JAN, 20), + 2002: ((JAN, 9), (DEC, 29)), + 2003: (DEC, 19), + 2004: (DEC, 8), + 2005: (NOV, 27), + 2006: (NOV, 16), + 2007: (NOV, 6), + 2008: (OCT, 25), + 2009: (OCT, 14), + 2010: (OCT, 4), + 2011: (SEP, 23), + 2012: (SEP, 12), + 2013: (SEP, 1), + 2014: (AUG, 21), + 2015: (AUG, 10), + 2016: (JUL, 30), + 2017: (JUL, 19), + 2018: (JUL, 9), + 2019: (JUN, 28), + 2020: (JUN, 17), + 2021: (JUN, 6), + 2022: (MAY, 26), + 2023: (MAY, 15), + 2024: (MAY, 4), + 2025: (APR, 23), + 2026: (APR, 13), + 2027: (APR, 2), + 2028: (MAR, 21), + 2029: (MAR, 10), + 2030: (FEB, 28), + 2031: (FEB, 17), + 2032: (FEB, 7), + 2033: (JAN, 26), + 2034: (JAN, 16), + 2035: ((JAN, 5), (DEC, 25)), + 2036: (DEC, 13), + 2037: (DEC, 2), + 2038: (NOV, 22), + 2039: (NOV, 12), + 2040: (OCT, 31), + 2041: (OCT, 20), + 2042: (OCT, 9), + 2043: (SEP, 28), + 2044: (SEP, 17), + 2045: (SEP, 7), + 2046: (AUG, 27), + 2047: (AUG, 17), + 2048: (AUG, 5), + 2049: (JUL, 25), + 2050: (JUL, 14), + 2051: (JUL, 4), + 2052: (JUN, 22), + 2053: (JUN, 12), + 2054: (JUN, 2), + 2055: (MAY, 22), + 2056: (MAY, 10), + 2057: (APR, 29), + 2058: (APR, 18), + 2059: (APR, 8), + 2060: (MAR, 28), + 2061: (MAR, 17), + 2062: (MAR, 6), + 2063: (FEB, 23), + 2064: (FEB, 13), + 2065: (FEB, 1), + 2066: (JAN, 21), + 2067: (JAN, 11), + 2068: ((JAN, 1), (DEC, 20)), + 2069: (DEC, 9), + 2070: (NOV, 28), + 2071: (NOV, 17), + 2072: (NOV, 6), + 2073: (OCT, 26), + 2074: (OCT, 16), + 2075: (OCT, 5), + 2076: (SEP, 23), + 2077: (SEP, 12), + } + + TASUA_DATES = { + 1924: (AUG, 9), + 1925: (JUL, 31), + 1926: (JUL, 19), + 1927: (JUL, 9), + 1928: (JUN, 27), + 1929: (JUN, 16), + 1930: (JUN, 5), + 1931: (MAY, 27), + 1932: (MAY, 15), + 1933: (MAY, 4), + 1934: (APR, 23), + 1935: (APR, 13), + 1936: (APR, 1), + 1937: (MAR, 22), + 1938: (MAR, 10), + 1939: (FEB, 28), + 1940: (FEB, 17), + 1941: (FEB, 5), + 1942: (JAN, 26), + 1943: (JAN, 15), + 1944: ((JAN, 4), (DEC, 24)), + 1945: (DEC, 13), + 1946: (DEC, 3), + 1947: (NOV, 22), + 1948: (NOV, 10), + 1949: (OCT, 31), + 1950: (OCT, 21), + 1951: (OCT, 10), + 1952: (SEP, 29), + 1953: (SEP, 18), + 1954: (SEP, 7), + 1955: (AUG, 28), + 1956: (AUG, 16), + 1957: (AUG, 5), + 1958: (JUL, 26), + 1959: (JUL, 15), + 1960: (JUL, 3), + 1961: (JUN, 22), + 1962: (JUN, 11), + 1963: (JUN, 1), + 1964: (MAY, 20), + 1965: (MAY, 9), + 1966: (APR, 29), + 1967: (APR, 19), + 1968: (APR, 7), + 1969: (MAR, 27), + 1970: (MAR, 17), + 1971: (MAR, 6), + 1972: (FEB, 24), + 1973: (FEB, 12), + 1974: (FEB, 1), + 1975: (JAN, 21), + 1976: ((JAN, 10), (DEC, 30)), + 1977: (DEC, 19), + 1978: (DEC, 9), + 1979: (NOV, 28), + 1980: (NOV, 17), + 1981: (NOV, 5), + 1982: (OCT, 26), + 1983: (OCT, 15), + 1984: (OCT, 4), + 1985: (SEP, 23), + 1986: (SEP, 13), + 1987: (SEP, 2), + 1988: (AUG, 21), + 1989: (AUG, 10), + 1990: (JUL, 31), + 1991: (JUL, 20), + 1992: (JUL, 9), + 1993: (JUN, 29), + 1994: (JUN, 18), + 1995: (JUN, 7), + 1996: (MAY, 26), + 1997: (MAY, 15), + 1998: (MAY, 5), + 1999: (APR, 25), + 2000: (APR, 14), + 2001: (APR, 3), + 2002: (MAR, 23), + 2003: (MAR, 12), + 2004: (FEB, 29), + 2005: (FEB, 18), + 2006: (FEB, 8), + 2007: (JAN, 28), + 2008: (JAN, 18), + 2009: ((JAN, 6), (DEC, 26)), + 2010: (DEC, 15), + 2011: (DEC, 4), + 2012: (NOV, 23), + 2013: (NOV, 12), + 2014: (NOV, 2), + 2015: (OCT, 22), + 2016: (OCT, 10), + 2017: (SEP, 29), + 2018: (SEP, 19), + 2019: (SEP, 8), + 2020: (AUG, 28), + 2021: (AUG, 17), + 2022: (AUG, 7), + 2023: (JUL, 27), + 2024: (JUL, 15), + 2025: (JUL, 4), + 2026: (JUN, 24), + 2027: (JUN, 14), + 2028: (JUN, 2), + 2029: (MAY, 22), + 2030: (MAY, 11), + 2031: (MAY, 1), + 2032: (APR, 19), + 2033: (APR, 9), + 2034: (MAR, 29), + 2035: (MAR, 19), + 2036: (MAR, 7), + 2037: (FEB, 24), + 2038: (FEB, 13), + 2039: (FEB, 3), + 2040: (JAN, 23), + 2041: (JAN, 12), + 2042: ((JAN, 1), (DEC, 22)), + 2043: (DEC, 11), + 2044: (NOV, 29), + 2045: (NOV, 18), + 2046: (NOV, 8), + 2047: (OCT, 28), + 2048: (OCT, 17), + 2049: (OCT, 6), + 2050: (SEP, 25), + 2051: (SEP, 14), + 2052: (SEP, 3), + 2053: (AUG, 23), + 2054: (AUG, 13), + 2055: (AUG, 2), + 2056: (JUL, 22), + 2057: (JUL, 11), + 2058: (JUN, 30), + 2059: (JUN, 19), + 2060: (JUN, 8), + 2061: (MAY, 28), + 2062: (MAY, 18), + 2063: (MAY, 8), + 2064: (APR, 26), + 2065: (APR, 15), + 2066: (APR, 4), + 2067: (MAR, 24), + 2068: (MAR, 13), + 2069: (MAR, 3), + 2070: (FEB, 20), + 2071: (FEB, 9), + 2072: (JAN, 29), + 2073: (JAN, 17), + 2074: ((JAN, 7), (DEC, 27)), + 2075: (DEC, 17), + 2076: (DEC, 5), + } + def _get_holiday(self, holiday: str, year: int) -> Iterable[Tuple[date, bool]]: estimated_dates = getattr(self, f"{holiday}_DATES", {}) exact_dates = getattr(self, f"{holiday}_DATES_{_CustomCalendar.CUSTOM_ATTR_POSTFIX}", {}) @@ -1441,6 +3331,18 @@ def _get_holiday(self, holiday: str, year: int) -> Iterable[Tuple[date, bool]]: for dt in _normalize_tuple(exact_dates.get(year, estimated_dates.get(year, ()))): yield date(year, *dt), year not in exact_dates + def ali_al_rida_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(ALI_AL_RIDA_DEATH, year) + + def ali_birthday_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(ALI_BIRTHDAY, year) + + def ali_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(ALI_DEATH, year) + + def arbaeen_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(ARBAEEN, year) + def ashura_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(ASHURA, year) @@ -1450,12 +3352,24 @@ def eid_al_adha_dates(self, year: int) -> Iterable[Tuple[date, bool]]: def eid_al_fitr_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(EID_AL_FITR, year) + def eid_al_ghadir_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(EID_AL_GHADIR, year) + + def fatima_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(FATIMA_DEATH, year) + def hari_hol_johor_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(HARI_HOL_JOHOR, year) + def hasan_al_askari_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(HASAN_AL_ASKARI_DEATH, year) + def hijri_new_year_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(HIJRI_NEW_YEAR, year) + def imam_mahdi_birthday_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(IMAM_MAHDI_BIRTHDAY, year) + def isra_and_miraj_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(ISRA_AND_MIRAJ, year) @@ -1465,9 +3379,21 @@ def mawlid_dates(self, year: int) -> Iterable[Tuple[date, bool]]: def nuzul_al_quran_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(NUZUL_AL_QURAN, year) + def prophet_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(PROPHET_DEATH, year) + def ramadan_beginning_dates(self, year: int) -> Iterable[Tuple[date, bool]]: return self._get_holiday(RAMADAN_BEGINNING, year) + def sadiq_birthday_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(SADIQ_BIRTHDAY, year) + + def sadiq_death_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(SADIQ_DEATH, year) + + def tasua_dates(self, year: int) -> Iterable[Tuple[date, bool]]: + return self._get_holiday(TASUA, year) + class _CustomIslamicCalendar(_CustomCalendar, _IslamicLunar): pass diff --git a/holidays/calendars/persian.py b/holidays/calendars/persian.py new file mode 100644 index 000000000..68d6a3b16 --- /dev/null +++ b/holidays/calendars/persian.py @@ -0,0 +1,56 @@ +# 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 (c) 2017-2023 +# ryanss (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 typing import Optional + + +class _Persian: + """ + Persian calendar (Solar Hijri) for 1901-2100 years. + + https://en.wikipedia.org/wiki/Solar_Hijri_calendar + """ + + START_YEAR = 1901 + END_YEAR = 2100 + + def new_year_date(self, year: int) -> Optional[date]: + """ + Return Gregorian date of Persian new year (1 Farvardin) in a given Gregorian year. + """ + if year < _Persian.START_YEAR or year > _Persian.END_YEAR: + return None + + day = 21 + if ( + (year % 4 == 1 and year >= 2029) + or (year % 4 == 2 and year >= 2062) + or (year % 4 == 3 and year >= 2095) + or (year % 4 == 0 and 1996 <= year <= 2096) + ): + day = 20 + elif (year % 4 == 2 and year <= 1926) or (year % 4 == 3 and year <= 1959): + day = 22 + return date(year, 3, day) + + def persian_to_gregorian(self, year: int, j_month: int, j_day: int) -> Optional[date]: + """ + Return Gregorian date of Persian day and month in a given Gregorian year. + """ + start_date = self.new_year_date(year) + if not start_date: + return None + + m = j_month - 1 + delta = (31 * m if m < 6 else 186 + 30 * (m - 6)) + j_day - 1 + return start_date + td(days=delta) diff --git a/holidays/countries/__init__.py b/holidays/countries/__init__.py index 3082bee05..f57ea6d02 100644 --- a/holidays/countries/__init__.py +++ b/holidays/countries/__init__.py @@ -24,6 +24,7 @@ from .azerbaijan import Azerbaijan, AZ, AZE from .bahrain import Bahrain, BH, BAH from .bangladesh import Bangladesh, BD, BGD +from .barbados import Barbados, BB, BRB from .belarus import Belarus, BY, BLR from .belgium import Belgium, BE, BEL from .belize import Belize, BZ, BLZ @@ -71,6 +72,7 @@ from .iceland import Iceland, IS, ISL from .india import India, IN, IND from .indonesia import Indonesia, ID, IDN +from .iran import Iran, IR, IRN from .ireland import Ireland, IE, IRL from .isle_of_man import IsleOfMan, IM, IMN from .israel import Israel, IL, ISR @@ -142,6 +144,7 @@ from .united_states_virgin_islands import UnitedStatesVirginIslands, VI, VIR, HolidaysVI from .uruguay import Uruguay, UY, URY from .uzbekistan import Uzbekistan, UZ, UZB +from .vanuatu import Vanuatu, VU, VTU from .vatican_city import VaticanCity, VA, VAT from .venezuela import Venezuela, VE, VEN from .vietnam import Vietnam, VN, VNM diff --git a/holidays/countries/albania.py b/holidays/countries/albania.py index 126215cf6..c83ce0b8c 100644 --- a/holidays/countries/albania.py +++ b/holidays/countries/albania.py @@ -13,8 +13,8 @@ from holidays.calendars.gregorian import MAR from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Albania(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/algeria.py b/holidays/countries/algeria.py index 1d53223b7..0fd29bc9a 100644 --- a/holidays/countries/algeria.py +++ b/holidays/countries/algeria.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import IslamicHolidays, InternationalHolidays class Algeria(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/andorra.py b/holidays/countries/andorra.py index 39073f5df..ab4356484 100644 --- a/holidays/countries/andorra.py +++ b/holidays/countries/andorra.py @@ -11,8 +11,8 @@ from datetime import timedelta as td +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Andorra(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/angola.py b/holidays/countries/angola.py index d694ab470..59e2975de 100644 --- a/holidays/countries/angola.py +++ b/holidays/countries/angola.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import AUG, SEP, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Angola(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/argentina.py b/holidays/countries/argentina.py index 02d628af4..84d2e14bd 100644 --- a/holidays/countries/argentina.py +++ b/holidays/countries/argentina.py @@ -28,8 +28,8 @@ MON, _get_nth_weekday_from, ) +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Argentina(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/armenia.py b/holidays/countries/armenia.py index 123475210..77a7f3ce5 100644 --- a/holidays/countries/armenia.py +++ b/holidays/countries/armenia.py @@ -12,8 +12,8 @@ from gettext import gettext as tr from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Armenia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/aruba.py b/holidays/countries/aruba.py index 4e84b2d33..73b0dcb26 100644 --- a/holidays/countries/aruba.py +++ b/holidays/countries/aruba.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import APR, AUG +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Aruba(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/australia.py b/holidays/countries/australia.py index d1a16b1c5..8e6a76d89 100644 --- a/holidays/countries/australia.py +++ b/holidays/countries/australia.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import APR, AUG, SEP, OCT, FRI, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Australia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/austria.py b/holidays/countries/austria.py index 4eab15351..a042981f0 100644 --- a/holidays/countries/austria.py +++ b/holidays/countries/austria.py @@ -12,8 +12,8 @@ from gettext import gettext as tr from holidays.constants import BANK, PUBLIC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Austria(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/azerbaijan.py b/holidays/countries/azerbaijan.py index 54570c522..438961915 100644 --- a/holidays/countries/azerbaijan.py +++ b/holidays/countries/azerbaijan.py @@ -14,8 +14,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, IslamicHolidays class Azerbaijan(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/bahrain.py b/holidays/countries/bahrain.py index 1cf77abc9..d3ae71f58 100644 --- a/holidays/countries/bahrain.py +++ b/holidays/countries/bahrain.py @@ -13,8 +13,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import FRI, SAT, MAY, JUL, AUG, OCT +from holidays.groups import InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, IslamicHolidays class Bahrain(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/bangladesh.py b/holidays/countries/bangladesh.py index ceedfe519..02b971d07 100644 --- a/holidays/countries/bangladesh.py +++ b/holidays/countries/bangladesh.py @@ -10,8 +10,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays class Bangladesh(HolidayBase, InternationalHolidays): diff --git a/holidays/countries/barbados.py b/holidays/countries/barbados.py new file mode 100644 index 000000000..c66c0f43b --- /dev/null +++ b/holidays/countries/barbados.py @@ -0,0 +1,106 @@ +# 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 (c) 2017-2023 +# ryanss (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 holidays.calendars.gregorian import JAN, JUL +from holidays.groups import ChristianHolidays, InternationalHolidays +from holidays.holiday_base import HolidayBase + + +class Barbados(HolidayBase, ChristianHolidays, InternationalHolidays): + """ + https://en.wikipedia.org/wiki/Public_holidays_in_Barbados + https://www.timeanddate.com/holidays/barbados/ + [Public Holidays Act Cap.352] http://barbadosparliament-laws.com/en/showdoc/cs/352 + https://labour.gov.bb/pdf/Library/Other%20Docs/Public%20Holidays%20for%20the%20Year%202018.pdf + https://labour.gov.bb/wp-content/uploads/2020/04/Public-Holidays-for-the-Year-2021.pdf + https://gisbarbados.gov.bb/download/public-holidays-for-2022/ + https://gisbarbados.gov.bb/download/public-holidays-for-2023/ + """ + + country = "BB" + observed_label = "%s (Observed)" + special_holidays = { + 2021: ( + (JAN, 4, "Public Holiday"), + (JAN, 5, "Public Holiday"), + ), + # One off 50th Anniversary of CARICOM Holiday. + # See https://tinyurl.com/brbhol + 2023: (JUL, 31, "50th Anniversary of CARICOM Holiday"), + } + + def __init__(self, *args, **kwargs) -> None: + ChristianHolidays.__init__(self) + InternationalHolidays.__init__(self) + super().__init__(*args, **kwargs) + + def _add_observed(self, dt: date, days: int = +1) -> None: + if self.observed and self._is_sunday(dt): + self._add_holiday(self.observed_label % self[dt], dt + td(days=days)) + + def _populate(self, year): + # Public Holidays Act Cap.352, 1968-12-30 + if year <= 1968: + return None + super()._populate(year) + + # New Year's Day + self._add_observed(self._add_new_years_day("New Year's Day")) + + # Errol Barrow Day + if year >= 1989: + self._add_observed(self._add_holiday_jan_21("Errol Barrow Day")) + + # Good Friday + self._add_good_friday("Good Friday") + + # Easter Monday + self._add_easter_monday("Easter Monday") + + # National Heroes Day + if year >= 1998: + self._add_observed(self._add_holiday_apr_28("National Heroes Day")) + + # May Day + self._add_observed(self._add_labor_day("May Day")) + + # Whit Monday + self._add_whit_monday("Whit Monday") + + # Emancipation Day + name = "Emancipation Day" + self._add_observed(aug_1 := self._add_holiday_aug_1(name), days=+2) + # If Aug 1 is Kadooment Day. + if self.observed and self._is_monday(aug_1): + self._add_holiday(self.observed_label % name, aug_1 + td(days=+1)) + + # Kadooment Day + self._add_holiday_1st_mon_of_aug("Kadooment Day") + + # Independence Day + self._add_observed(self._add_holiday_nov_30("Independence Day")) + + # Christmas + self._add_observed(self._add_christmas_day("Christmas Day"), days=+2) + + # Boxing Day + self._add_observed(self._add_christmas_day_two("Boxing Day")) + + +class BB(Barbados): + pass + + +class BRB(Barbados): + pass diff --git a/holidays/countries/belarus.py b/holidays/countries/belarus.py index 051c3753c..c8ac62f82 100644 --- a/holidays/countries/belarus.py +++ b/holidays/countries/belarus.py @@ -13,8 +13,8 @@ from holidays.calendars.gregorian import GREGORIAN_CALENDAR from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Belarus(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/belgium.py b/holidays/countries/belgium.py index 76c462243..21c2f57dc 100644 --- a/holidays/countries/belgium.py +++ b/holidays/countries/belgium.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Belgium(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/belize.py b/holidays/countries/belize.py index 39740bbf0..36fee74b6 100644 --- a/holidays/countries/belize.py +++ b/holidays/countries/belize.py @@ -12,8 +12,8 @@ from datetime import date from holidays.calendars.gregorian import MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Belize(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/bolivia.py b/holidays/countries/bolivia.py index fe718f9f6..a1435fe10 100644 --- a/holidays/countries/bolivia.py +++ b/holidays/countries/bolivia.py @@ -14,8 +14,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Bolivia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/bosnia_and_herzegovina.py b/holidays/countries/bosnia_and_herzegovina.py index beabf6cd4..a646945ee 100644 --- a/holidays/countries/bosnia_and_herzegovina.py +++ b/holidays/countries/bosnia_and_herzegovina.py @@ -18,8 +18,8 @@ from holidays.calendars.gregorian import GREGORIAN_CALENDAR from holidays.calendars.julian import JULIAN_CALENDAR from holidays.constants import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class BosniaAndHerzegovina(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/botswana.py b/holidays/countries/botswana.py index 667d632d1..88e068822 100644 --- a/holidays/countries/botswana.py +++ b/holidays/countries/botswana.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import JUL +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Botswana(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/brazil.py b/holidays/countries/brazil.py index 49072936f..c117ffbef 100644 --- a/holidays/countries/brazil.py +++ b/holidays/countries/brazil.py @@ -13,8 +13,8 @@ from datetime import date from holidays.calendars.gregorian import JAN, MAR, SEP, NOV, FRI, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Brazil(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/brunei.py b/holidays/countries/brunei.py index ac6a6d0ec..8c6ca9f79 100644 --- a/holidays/countries/brunei.py +++ b/holidays/countries/brunei.py @@ -15,13 +15,13 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC -from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( +from holidays.groups import ( ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays, IslamicHolidays, ) +from holidays.holiday_base import HolidayBase class Brunei( diff --git a/holidays/countries/bulgaria.py b/holidays/countries/bulgaria.py index 3da80a3ed..1a713ab46 100644 --- a/holidays/countries/bulgaria.py +++ b/holidays/countries/bulgaria.py @@ -14,8 +14,8 @@ from holidays.calendars.julian_revised import JULIAN_REVISED_CALENDAR from holidays.constants import PUBLIC, SCHOOL +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Bulgaria(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/burkina_faso.py b/holidays/countries/burkina_faso.py index 6989b91bf..a76ac669d 100644 --- a/holidays/countries/burkina_faso.py +++ b/holidays/countries/burkina_faso.py @@ -14,8 +14,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays, IslamicHolidays class BurkinaFaso(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/burundi.py b/holidays/countries/burundi.py index c8d218e7e..6429c0c7c 100644 --- a/holidays/countries/burundi.py +++ b/holidays/countries/burundi.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from typing import Optional +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Burundi(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/cambodia.py b/holidays/countries/cambodia.py index 2d2f779fa..740908515 100644 --- a/holidays/countries/cambodia.py +++ b/holidays/countries/cambodia.py @@ -14,8 +14,8 @@ from holidays.calendars.gregorian import MAY, AUG, SEP from holidays.calendars.thai import KHMER_CALENDAR +from holidays.groups import InternationalHolidays, ThaiCalendarHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, ThaiCalendarHolidays class Cambodia(HolidayBase, InternationalHolidays, ThaiCalendarHolidays): diff --git a/holidays/countries/cameroon.py b/holidays/countries/cameroon.py index 226231751..cfdbef817 100644 --- a/holidays/countries/cameroon.py +++ b/holidays/countries/cameroon.py @@ -13,8 +13,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays, IslamicHolidays class Cameroon(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/canada.py b/holidays/countries/canada.py index 1723f7fff..37539ed03 100644 --- a/holidays/countries/canada.py +++ b/holidays/countries/canada.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import MAR, APR, JUN, JUL, MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Canada(HolidayBase, ChristianHolidays, InternationalHolidays): @@ -36,7 +36,7 @@ class Canada(HolidayBase, ChristianHolidays, InternationalHolidays): "SK", "YT", ) - supported_languages = ("ar", "en", "en_US", "fr", "th") + supported_languages = ("ar", "en", "fr", "th") def __init__(self, *args, **kwargs): # Default subdivision to ON; prov for backwards compatibility diff --git a/holidays/countries/chad.py b/holidays/countries/chad.py index 6533b3a74..6596b3538 100644 --- a/holidays/countries/chad.py +++ b/holidays/countries/chad.py @@ -14,8 +14,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays, IslamicHolidays class Chad(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/chile.py b/holidays/countries/chile.py index 102839adf..7e5210e1e 100644 --- a/holidays/countries/chile.py +++ b/holidays/countries/chile.py @@ -15,8 +15,8 @@ from typing import Tuple from holidays.calendars.gregorian import JUN, SEP, OCT, MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Chile(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/china.py b/holidays/countries/china.py index 784362d69..16d3426b5 100644 --- a/holidays/countries/china.py +++ b/holidays/countries/china.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import ChineseCalendarHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChineseCalendarHolidays, InternationalHolidays class China(HolidayBase, ChineseCalendarHolidays, InternationalHolidays): diff --git a/holidays/countries/colombia.py b/holidays/countries/colombia.py index 2e47fae3f..25ca46f31 100644 --- a/holidays/countries/colombia.py +++ b/holidays/countries/colombia.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Colombia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/costa_rica.py b/holidays/countries/costa_rica.py index 27331000d..403b10866 100644 --- a/holidays/countries/costa_rica.py +++ b/holidays/countries/costa_rica.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class CostaRica(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/croatia.py b/holidays/countries/croatia.py index ee948d910..5f381c429 100644 --- a/holidays/countries/croatia.py +++ b/holidays/countries/croatia.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Croatia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/cuba.py b/holidays/countries/cuba.py index 985dcc9c4..596aca85d 100644 --- a/holidays/countries/cuba.py +++ b/holidays/countries/cuba.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Cuba(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/curacao.py b/holidays/countries/curacao.py index 87acbc295..3755132b5 100644 --- a/holidays/countries/curacao.py +++ b/holidays/countries/curacao.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import APR, MAY +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Curacao(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/cyprus.py b/holidays/countries/cyprus.py index faec073e2..4f1f20db7 100644 --- a/holidays/countries/cyprus.py +++ b/holidays/countries/cyprus.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.julian_revised import JULIAN_REVISED_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Cyprus(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/czechia.py b/holidays/countries/czechia.py index 7d105682f..a80579c9c 100644 --- a/holidays/countries/czechia.py +++ b/holidays/countries/czechia.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Czechia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/denmark.py b/holidays/countries/denmark.py index f452a311f..f052a1023 100644 --- a/holidays/countries/denmark.py +++ b/holidays/countries/denmark.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Denmark(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/djibouti.py b/holidays/countries/djibouti.py index 49fed1cf1..a0200fa70 100644 --- a/holidays/countries/djibouti.py +++ b/holidays/countries/djibouti.py @@ -12,8 +12,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import FRI, SAT +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Djibouti(HolidayBase, ChristianHolidays, IslamicHolidays, InternationalHolidays): diff --git a/holidays/countries/dominican_republic.py b/holidays/countries/dominican_republic.py index 2a456e073..e865a7fa6 100644 --- a/holidays/countries/dominican_republic.py +++ b/holidays/countries/dominican_republic.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import JUN, MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class DominicanRepublic(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/ecuador.py b/holidays/countries/ecuador.py index e823ea342..8005da5c1 100644 --- a/holidays/countries/ecuador.py +++ b/holidays/countries/ecuador.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Ecuador(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/egypt.py b/holidays/countries/egypt.py index 64dbc678d..eae96dfca 100644 --- a/holidays/countries/egypt.py +++ b/holidays/countries/egypt.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Egypt(HolidayBase, ChristianHolidays, IslamicHolidays, InternationalHolidays): diff --git a/holidays/countries/el_salvador.py b/holidays/countries/el_salvador.py index f6ffc2c19..d34d1fb51 100644 --- a/holidays/countries/el_salvador.py +++ b/holidays/countries/el_salvador.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class ElSalvador(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/estonia.py b/holidays/countries/estonia.py index ea11f304f..8c9831b74 100644 --- a/holidays/countries/estonia.py +++ b/holidays/countries/estonia.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Estonia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/eswatini.py b/holidays/countries/eswatini.py index f9ad434e9..77e761a4e 100644 --- a/holidays/countries/eswatini.py +++ b/holidays/countries/eswatini.py @@ -14,8 +14,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import JAN, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Eswatini(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/ethiopia.py b/holidays/countries/ethiopia.py index dbc4c498f..b54c1c0db 100644 --- a/holidays/countries/ethiopia.py +++ b/holidays/countries/ethiopia.py @@ -14,8 +14,8 @@ from holidays.calendars.gregorian import SEP from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays, IslamicHolidays # Ethiopian holidays are estimated: it is common for the day to be pushed # if falls in a weekend, although not a rule that can be implemented. diff --git a/holidays/countries/finland.py b/holidays/countries/finland.py index e5d4afee4..c3af08983 100644 --- a/holidays/countries/finland.py +++ b/holidays/countries/finland.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Finland(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/france.py b/holidays/countries/france.py index f4d5a9fa3..b0e0610e9 100644 --- a/holidays/countries/france.py +++ b/holidays/countries/france.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class France(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/gabon.py b/holidays/countries/gabon.py index 1cf8e861d..c337a0cd2 100644 --- a/holidays/countries/gabon.py +++ b/holidays/countries/gabon.py @@ -11,8 +11,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays, IslamicHolidays class Gabon(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/georgia.py b/holidays/countries/georgia.py index 19cb869c0..454b95e18 100644 --- a/holidays/countries/georgia.py +++ b/holidays/countries/georgia.py @@ -12,8 +12,8 @@ from gettext import gettext as tr from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Georgia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/germany.py b/holidays/countries/germany.py index 24e236ba8..6760c3696 100644 --- a/holidays/countries/germany.py +++ b/holidays/countries/germany.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Germany(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/greece.py b/holidays/countries/greece.py index 15285ebe1..282be0e0c 100644 --- a/holidays/countries/greece.py +++ b/holidays/countries/greece.py @@ -15,8 +15,8 @@ from holidays.calendars.gregorian import MON, _get_nth_weekday_from from holidays.calendars.julian_revised import JULIAN_REVISED_CALENDAR from holidays.constants import HALF_DAY, PUBLIC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Greece(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/guatemala.py b/holidays/countries/guatemala.py index 170043985..d5bdda7b9 100644 --- a/holidays/countries/guatemala.py +++ b/holidays/countries/guatemala.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import OCT, MON, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Guatemala(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/honduras.py b/holidays/countries/honduras.py index 7018cf1e9..4fccd1a2e 100644 --- a/holidays/countries/honduras.py +++ b/holidays/countries/honduras.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Honduras(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/hongkong.py b/holidays/countries/hongkong.py index 0fda72739..d2a055732 100644 --- a/holidays/countries/hongkong.py +++ b/holidays/countries/hongkong.py @@ -14,12 +14,8 @@ from typing import Optional from holidays.calendars.gregorian import JUL, AUG, SEP, MON, _get_nth_weekday_of_month +from holidays.groups import ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( - ChineseCalendarHolidays, - ChristianHolidays, - InternationalHolidays, -) class HongKong(HolidayBase, ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/hungary.py b/holidays/countries/hungary.py index b656399fb..5d9931711 100644 --- a/holidays/countries/hungary.py +++ b/holidays/countries/hungary.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Hungary(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/iceland.py b/holidays/countries/iceland.py index c37fccc36..8ebe56c4d 100644 --- a/holidays/countries/iceland.py +++ b/holidays/countries/iceland.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Iceland(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/india.py b/holidays/countries/india.py index ae6ec9e90..e52f7e4c4 100644 --- a/holidays/countries/india.py +++ b/holidays/countries/india.py @@ -12,8 +12,8 @@ import warnings from holidays.calendars.gregorian import MAR, OCT, NOV +from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays, IslamicHolidays class India(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/indonesia.py b/holidays/countries/indonesia.py index e407dd7d7..9955ba4ad 100644 --- a/holidays/countries/indonesia.py +++ b/holidays/countries/indonesia.py @@ -18,14 +18,14 @@ ) from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC from holidays.constants import GOVERNMENT, PUBLIC -from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( +from holidays.groups import ( BuddhistCalendarHolidays, ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays, IslamicHolidays, ) +from holidays.holiday_base import HolidayBase class Indonesia( diff --git a/holidays/countries/iran.py b/holidays/countries/iran.py new file mode 100644 index 000000000..4bb570d39 --- /dev/null +++ b/holidays/countries/iran.py @@ -0,0 +1,123 @@ +# 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 (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from gettext import gettext as tr + +from holidays.groups import IslamicHolidays, PersianCalendarHolidays +from holidays.holiday_base import HolidayBase + + +class Iran(HolidayBase, IslamicHolidays, PersianCalendarHolidays): + """ + References: + - https://en.wikipedia.org/wiki/Public_holidays_in_Iran + - https://fa.wikipedia.org/wiki/تعطیلات_عمومی_در_ایران + """ + + country = "IR" + default_language = "fa" + # Estimated label. + estimated_label = tr("(تخمین زده*) *%s") + supported_languages = ("en_US", "fa") + + def __init__(self, *args, **kwargs): + IslamicHolidays.__init__(self) + PersianCalendarHolidays.__init__(self) + super().__init__(*args, **kwargs) + + def _populate(self, year): + if year <= 1979: + return None + + super()._populate(year) + + # Persian New Year. + name = tr("نوروز") + self._add_nowruz_day(name) + self._add_nowruz_day_two(name) + self._add_nowruz_day_three(name) + self._add_nowruz_day_four(name) + + # Islamic Republic Day. + self._add_islamic_republic_day(tr("روز جمهوری اسلامی")) + + # Nature's Day. + self._add_natures_day(tr("روز طبیعت")) + + # Death of Khomeini. + self._add_death_of_khomeini_day(tr("درگذشت سید روح‌الله خمینی")) + + # Khordad National Uprising. + self._add_khordad_uprising_day(tr("تظاهرات ۱۵ خرداد")) + + # Islamic Revolution Day. + self._add_islamic_revolution_day(tr("پیروزی انقلاب ۵۷")) + + # Iranian Oil Industry Nationalization Day. + self._add_oil_nationalization_day(tr("ملی‌شدن صنعت نفت")) + + # Tasua. + self._add_tasua_day(tr("تاسوعا")) + + # Ashura. + self._add_ashura_day(tr("کشته‌شدن حسین بن علی، عاشورا")) + + # Arbaeen. + self._add_arbaeen_day(tr("چهلم حسین بن علی اربعین")) + + # Demise of Prophet Muhammad and Hasan ibn Ali. + self._add_prophet_death_day(tr("کشته‌شدن حسن مجتبی و درگذشت محمد")) + + # Martyrdom of Ali al-Rida. + self._add_ali_al_rida_death_day(tr("کشته‌شدن علی بن موسی الرضا")) + + # Martyrdom of Hasan al-Askari. + self._add_hasan_al_askari_death_day(tr("کشته‌شدن حسن عسکری")) + + # Birthday of Muhammad and Ja'far al-Sadiq. + self._add_sadiq_birthday_day(tr("زادروز محمد و جعفر صادق")) + + # Martyrdom of Fatima. + self._add_fatima_death_day(tr("کشته‌شدن فاطمه زهرا")) + + # Birthday of Ali. + self._add_ali_birthday_day(tr("زادروز علی بن ابی‌طالب")) + + # Ascension of Muhammad. + self._add_isra_and_miraj_day(tr("مبعث")) + + # Birthday of Mahdi. + self._add_imam_mahdi_birthday_day(tr("زادروز حجت بن الحسن")) + + # Martyrdom of Ali. + self._add_ali_death_day(tr("کشته‌شدن علی بن ابی‌طالب")) + + # Eid al-Fitr. + name = tr("عید فطر") + self._add_eid_al_fitr_day(name) + self._add_eid_al_fitr_day_two(name) + + # Martyrdom of Ja'far al-Sadiq. + self._add_sadiq_death_day(tr("کشته‌شدن جعفر صادق")) + + # Eid al-Adha. + self._add_eid_al_adha_day(tr("عید قربان")) + + # Eid al-Ghadeer. + self._add_eid_al_ghadir_day(tr("عید غدیر")) + + +class IR(Iran): + pass + + +class IRN(Iran): + pass diff --git a/holidays/countries/ireland.py b/holidays/countries/ireland.py index 5093b8750..f015d34a9 100644 --- a/holidays/countries/ireland.py +++ b/holidays/countries/ireland.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import FEB, MAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Ireland(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/isle_of_man.py b/holidays/countries/isle_of_man.py index 5a5714d7e..b9ccb82c8 100644 --- a/holidays/countries/isle_of_man.py +++ b/holidays/countries/isle_of_man.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import JUL +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays from .united_kingdom import UnitedKingdom diff --git a/holidays/countries/italy.py b/holidays/countries/italy.py index 47f29ddc3..e4f7e856f 100644 --- a/holidays/countries/italy.py +++ b/holidays/countries/italy.py @@ -12,8 +12,8 @@ from datetime import timedelta as td +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Italy(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/jamaica.py b/holidays/countries/jamaica.py index 86d42a354..fbb57e580 100644 --- a/holidays/countries/jamaica.py +++ b/holidays/countries/jamaica.py @@ -12,8 +12,8 @@ from datetime import date from datetime import timedelta as td +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Jamaica(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/japan.py b/holidays/countries/japan.py index d720e84dd..c70137919 100644 --- a/holidays/countries/japan.py +++ b/holidays/countries/japan.py @@ -16,9 +16,9 @@ from holidays.calendars.gregorian import FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV from holidays.constants import BANK, PUBLIC +from holidays.groups import InternationalHolidays from holidays.helpers import _normalize_tuple from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays class Japan(HolidayBase, InternationalHolidays): diff --git a/holidays/countries/kazakhstan.py b/holidays/countries/kazakhstan.py index cb6a31af4..711dd9489 100644 --- a/holidays/countries/kazakhstan.py +++ b/holidays/countries/kazakhstan.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Kazakhstan(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/kenya.py b/holidays/countries/kenya.py index 39bc057a5..d4cf1a71d 100644 --- a/holidays/countries/kenya.py +++ b/holidays/countries/kenya.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import FEB, APR, AUG, SEP +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Kenya(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/kyrgyzstan.py b/holidays/countries/kyrgyzstan.py index 6ba637f12..940dbe6f9 100644 --- a/holidays/countries/kyrgyzstan.py +++ b/holidays/countries/kyrgyzstan.py @@ -10,8 +10,8 @@ # License: MIT (see LICENSE file) from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Kyrgyzstan(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/latvia.py b/holidays/countries/latvia.py index 47dd1753c..80622ab71 100644 --- a/holidays/countries/latvia.py +++ b/holidays/countries/latvia.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.constants import MAY, JUL, SEP +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Latvia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/lesotho.py b/holidays/countries/lesotho.py index 1b19ea194..208cae077 100644 --- a/holidays/countries/lesotho.py +++ b/holidays/countries/lesotho.py @@ -10,8 +10,8 @@ # License: MIT (see LICENSE file) from holidays.calendars.gregorian import MAY +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Lesotho(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/liechtenstein.py b/holidays/countries/liechtenstein.py index a2a49f5c9..b0dfae973 100644 --- a/holidays/countries/liechtenstein.py +++ b/holidays/countries/liechtenstein.py @@ -12,8 +12,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Liechtenstein(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/lithuania.py b/holidays/countries/lithuania.py index 2121844d0..375fcb41a 100644 --- a/holidays/countries/lithuania.py +++ b/holidays/countries/lithuania.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Lithuania(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/luxembourg.py b/holidays/countries/luxembourg.py index 29e509213..0a1aca2fa 100644 --- a/holidays/countries/luxembourg.py +++ b/holidays/countries/luxembourg.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Luxembourg(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/madagascar.py b/holidays/countries/madagascar.py index e7cb2f9ff..4de8af149 100644 --- a/holidays/countries/madagascar.py +++ b/holidays/countries/madagascar.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import MAY, SUN, _get_nth_weekday_of_month +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Madagascar(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/malawi.py b/holidays/countries/malawi.py index f6dd358c4..b35cf6249 100644 --- a/holidays/countries/malawi.py +++ b/holidays/countries/malawi.py @@ -12,8 +12,8 @@ from datetime import date from datetime import timedelta as td +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Malawi(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/malaysia.py b/holidays/countries/malaysia.py index 445a6e43d..83591c19a 100644 --- a/holidays/countries/malaysia.py +++ b/holidays/countries/malaysia.py @@ -34,8 +34,7 @@ SAT, SUN, ) -from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( +from holidays.groups import ( BuddhistCalendarHolidays, ChineseCalendarHolidays, ChristianHolidays, @@ -43,6 +42,7 @@ InternationalHolidays, IslamicHolidays, ) +from holidays.holiday_base import HolidayBase class Malaysia( diff --git a/holidays/countries/malta.py b/holidays/countries/malta.py index 8c386752d..f7c7b488f 100644 --- a/holidays/countries/malta.py +++ b/holidays/countries/malta.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Malta(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/marshall_islands.py b/holidays/countries/marshall_islands.py index fdf8b23eb..1bc0015a1 100644 --- a/holidays/countries/marshall_islands.py +++ b/holidays/countries/marshall_islands.py @@ -14,8 +14,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import NOV +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class HolidaysMH(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/mexico.py b/holidays/countries/mexico.py index b792ba2f6..8dbdea1ef 100644 --- a/holidays/countries/mexico.py +++ b/holidays/countries/mexico.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Mexico(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/moldova.py b/holidays/countries/moldova.py index 71f76527a..3f0749858 100644 --- a/holidays/countries/moldova.py +++ b/holidays/countries/moldova.py @@ -14,8 +14,8 @@ from holidays.calendars.gregorian import GREGORIAN_CALENDAR from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Moldova(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/monaco.py b/holidays/countries/monaco.py index 2ee81d129..14f1eb33d 100644 --- a/holidays/countries/monaco.py +++ b/holidays/countries/monaco.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import JAN, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Monaco(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/montenegro.py b/holidays/countries/montenegro.py index c57bf09f5..9a212f487 100644 --- a/holidays/countries/montenegro.py +++ b/holidays/countries/montenegro.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Montenegro(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/morocco.py b/holidays/countries/morocco.py index 41cbb73e1..567051a80 100644 --- a/holidays/countries/morocco.py +++ b/holidays/countries/morocco.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import IslamicHolidays, InternationalHolidays class Morocco(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/mozambique.py b/holidays/countries/mozambique.py index eb9ae6b07..b9bfe8a5a 100644 --- a/holidays/countries/mozambique.py +++ b/holidays/countries/mozambique.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Mozambique(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/namibia.py b/holidays/countries/namibia.py index 4121f85c8..9de2f3f14 100644 --- a/holidays/countries/namibia.py +++ b/holidays/countries/namibia.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import JAN, FEB, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Namibia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/netherlands.py b/holidays/countries/netherlands.py index 6bea2c0c8..73fa03a53 100644 --- a/holidays/countries/netherlands.py +++ b/holidays/countries/netherlands.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import APR, AUG +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Netherlands(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/new_zealand.py b/holidays/countries/new_zealand.py index 1901a5bd9..dc87cba27 100644 --- a/holidays/countries/new_zealand.py +++ b/holidays/countries/new_zealand.py @@ -24,8 +24,8 @@ MON, _get_nth_weekday_from, ) +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class NewZealand(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/nicaragua.py b/holidays/countries/nicaragua.py index 31da95812..1caf3419f 100644 --- a/holidays/countries/nicaragua.py +++ b/holidays/countries/nicaragua.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Nicaragua(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/nigeria.py b/holidays/countries/nigeria.py index da405dfea..cedfbdeb2 100644 --- a/holidays/countries/nigeria.py +++ b/holidays/countries/nigeria.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import FEB, MAY +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Nigeria(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/north_macedonia.py b/holidays/countries/north_macedonia.py index 690572759..5ca9d8c0e 100644 --- a/holidays/countries/north_macedonia.py +++ b/holidays/countries/north_macedonia.py @@ -10,8 +10,8 @@ # License: MIT (see LICENSE file) from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class NorthMacedonia(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/norway.py b/holidays/countries/norway.py index f00e894e3..7e5700808 100644 --- a/holidays/countries/norway.py +++ b/holidays/countries/norway.py @@ -12,8 +12,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import _get_all_sundays +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Norway(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/pakistan.py b/holidays/countries/pakistan.py index af75e9868..7a32d9d5b 100644 --- a/holidays/countries/pakistan.py +++ b/holidays/countries/pakistan.py @@ -11,8 +11,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, IslamicHolidays class Pakistan(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/panama.py b/holidays/countries/panama.py index 9fbe305d7..125a4b328 100644 --- a/holidays/countries/panama.py +++ b/holidays/countries/panama.py @@ -12,8 +12,8 @@ from datetime import date from datetime import timedelta as td +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Panama(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/paraguay.py b/holidays/countries/paraguay.py index 53e9d6751..aa618beb2 100644 --- a/holidays/countries/paraguay.py +++ b/holidays/countries/paraguay.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Paraguay(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/peru.py b/holidays/countries/peru.py index 66d1c5ce5..345ae8c10 100644 --- a/holidays/countries/peru.py +++ b/holidays/countries/peru.py @@ -12,8 +12,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Peru(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/philippines.py b/holidays/countries/philippines.py index 9d10f5dbf..3c80e91f3 100644 --- a/holidays/countries/philippines.py +++ b/holidays/countries/philippines.py @@ -10,13 +10,13 @@ # License: MIT (see LICENSE file) -from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( +from holidays.groups import ( ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays, IslamicHolidays, ) +from holidays.holiday_base import HolidayBase class Philippines( diff --git a/holidays/countries/poland.py b/holidays/countries/poland.py index 8d2e3cac1..5a859386a 100644 --- a/holidays/countries/poland.py +++ b/holidays/countries/poland.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import NOV +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Poland(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/portugal.py b/holidays/countries/portugal.py index ba9987183..2cd0e1287 100644 --- a/holidays/countries/portugal.py +++ b/holidays/countries/portugal.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Portugal(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/romania.py b/holidays/countries/romania.py index e56f714df..5dd3a75db 100644 --- a/holidays/countries/romania.py +++ b/holidays/countries/romania.py @@ -12,8 +12,8 @@ from gettext import gettext as tr from holidays.calendars.julian_revised import JULIAN_REVISED_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Romania(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/russia.py b/holidays/countries/russia.py index 0ab555db4..e23593958 100644 --- a/holidays/countries/russia.py +++ b/holidays/countries/russia.py @@ -13,8 +13,8 @@ from holidays.calendars.gregorian import JAN, FEB, MAY from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Russia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/san_marino.py b/holidays/countries/san_marino.py index cc36bf61a..be96083a2 100644 --- a/holidays/countries/san_marino.py +++ b/holidays/countries/san_marino.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class SanMarino(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/saudi_arabia.py b/holidays/countries/saudi_arabia.py index 2b112820e..5853482ec 100644 --- a/holidays/countries/saudi_arabia.py +++ b/holidays/countries/saudi_arabia.py @@ -15,8 +15,8 @@ from typing import Set from holidays.calendars.gregorian import FEB, SEP, NOV, THU, FRI, SAT +from holidays.groups import IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import IslamicHolidays class SaudiArabia(HolidayBase, IslamicHolidays): @@ -38,6 +38,8 @@ class SaudiArabia(HolidayBase, IslamicHolidays): default_language = "ar" # Estimated label. estimated_label = tr("(تقدير*) *%s") + # %s (Observed). + observed_label = tr("(ملاحظة) %s") supported_languages = ("ar", "en_US") special_holidays = { @@ -49,14 +51,21 @@ def __init__(self, *args, **kwargs): IslamicHolidays.__init__(self) super().__init__(*args, **kwargs) - def _add_islamic_observed(self, name: str, dts: Set[date]) -> None: + def _add_islamic_observed(self, dts: Set[date]) -> None: + # Observed days are added to make up for any days falling on a weekend. if not self.observed: return None for dt in dts: - weekend_days = sum(self._is_weekend(dt + td(days=i)) for i in range(4)) - for i in range(weekend_days): - self._add_holiday(self.tr("(ملاحظة) %s") % self.tr(name), dt + td(days=+4 + i)) + for i in range(4): + if not self._is_weekend(dt + td(days=-i)): + continue + dt_observed = dt + td(days=+1) + while dt_observed.year == self._year and ( + self._is_weekend(dt_observed) or dt_observed in self + ): + dt_observed += td(days=+1) + self._add_holiday(self.tr(self.observed_label) % self[dt], dt_observed) def _add_observed(self, dt: date) -> None: if not self.observed: @@ -65,10 +74,10 @@ def _add_observed(self, dt: date) -> None: weekend = sorted(self.weekend) # 1st weekend day (Thursday before 2013 and Friday otherwise) if dt.weekday() == weekend[0]: - self._add_holiday(self.tr("(ملاحظة) %s") % self.tr(self[dt]), dt + td(days=-1)) + self._add_holiday(self.tr(self.observed_label) % self.tr(self[dt]), dt + td(days=-1)) # 2nd weekend day (Friday before 2013 and Saturday otherwise) elif dt.weekday() == weekend[1]: - self._add_holiday(self.tr("(ملاحظة) %s") % self.tr(self[dt]), dt + td(days=+1)) + self._add_holiday(self.tr(self.observed_label) % self.tr(self[dt]), dt + td(days=+1)) def _populate(self, year): super()._populate(year) @@ -78,57 +87,40 @@ def _populate(self, year): # holiday started at 2022; so what below works. self.weekend = {THU, FRI} if year <= 2012 else {FRI, SAT} - # The holiday is a 4-day holiday starting on the day following the - # 29th day of Ramadan, the 9th month of the Islamic calendar. - # Observed days are added to make up for any days falling on a weekend. - # Holidays may straddle across Gregorian years, so we go back one year - # to pick up any such occurrence. - # Date of observance is announced yearly. # Eid al-Fitr Holiday - name = tr("عطلة عيد الفطر") - dates = self._add_eid_al_fitr_day(name) - self._add_eid_al_fitr_day_two(name) - self._add_eid_al_fitr_day_three(name) - self._add_eid_al_fitr_day_four(name) - self._add_islamic_observed(name, dates) - - # The holiday is a 4-day holiday starting on Arafat Day, the 10th of - # Dhu al-Hijjah, the 12th month of the Islamic calendar. - # Observed days are added to make up for any days falling on a weekend. - # Holidays may straddle across Gregorian years, so we go back one year - # to pick up any such occurrence. - # Date of observance is announced yearly. + eid_al_fitr_name = tr("عطلة عيد الفطر") + self._add_eid_al_fitr_day(eid_al_fitr_name) + self._add_eid_al_fitr_day_two(eid_al_fitr_name) + self._add_eid_al_fitr_day_three(eid_al_fitr_name) + self._add_islamic_observed(self._add_eid_al_fitr_day_four(eid_al_fitr_name)) + # Arafat Day - dates = self._add_arafah_day(tr("يوم عرفة")) + self._add_arafah_day(tr("يوم عرفة")) # Eid al-Adha Holiday 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_islamic_observed(name, dates) + self._add_islamic_observed(self._add_eid_al_adha_day_three(name)) - # National Day holiday (started at the year 2005). - # Note: if national day happens within the Eid al-Fitr Holiday or - # within Eid al-Fitr Holiday, there is no extra holidays given for it. + # If National Day happens within the Eid al-Fitr Holiday or + # within Eid al-Adha Holiday, there is no extra holidays given for it. if year >= 2005: dt = date(year, SEP, 23) if dt not in self: # National Day Holiday self._add_observed(self._add_holiday(tr("اليوم الوطني"), dt)) - # Founding Day holiday (started 2022). - # Note: if founding day happens within the Eid al-Fitr Holiday or - # within Eid al-Fitr Holiday, there is no extra holidays given for it. + # If Founding Day happens within the Eid al-Fitr Holiday or + # within Eid al-Adha Holiday, there is no extra holidays given for it. if year >= 2022: dt = date(year, FEB, 22) if dt not in self: # Founding Day self._add_observed(self._add_holiday(tr("يوم التأسيسي"), dt)) - # observed holidays special cases + # observed holidays special case (Eid al-Fitr Holiday (observed)) if self.observed and year == 2001: - # Eid al-Fitr Holiday (observed) - self._add_holiday_jan_1(tr("عطلة عيد الفطر (ملاحظة)")) + self._add_holiday_jan_1(self.tr(self.observed_label) % self.tr(eid_al_fitr_name)) class SA(SaudiArabia): diff --git a/holidays/countries/serbia.py b/holidays/countries/serbia.py index b1ae13952..b83cabd7b 100644 --- a/holidays/countries/serbia.py +++ b/holidays/countries/serbia.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Serbia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/singapore.py b/holidays/countries/singapore.py index 84aa59a22..a7269004e 100644 --- a/holidays/countries/singapore.py +++ b/holidays/countries/singapore.py @@ -18,8 +18,7 @@ _CustomHinduCalendar, ) from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC -from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( +from holidays.groups import ( BuddhistCalendarHolidays, ChineseCalendarHolidays, ChristianHolidays, @@ -27,6 +26,7 @@ InternationalHolidays, IslamicHolidays, ) +from holidays.holiday_base import HolidayBase class Singapore( @@ -51,6 +51,9 @@ class Singapore( (SEP, 11, "Polling Day"), ), 2020: (JUL, 10, "Polling Day"), + # Announced in state-associated press on 12 August 2023 + # https://www.straitstimes.com/singapore/politics/singapore-presidential-election-2023-polling-day-on-sept-1-nomination-day-on-aug-22 + 2023: (SEP, 1, "Polling Day"), } def __init__(self, *args, **kwargs) -> None: diff --git a/holidays/countries/slovakia.py b/holidays/countries/slovakia.py index 2fd636e51..fb9abc5db 100644 --- a/holidays/countries/slovakia.py +++ b/holidays/countries/slovakia.py @@ -13,8 +13,8 @@ from holidays.calendars.gregorian import OCT from holidays.constants import PUBLIC, WORKDAY +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Slovakia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/slovenia.py b/holidays/countries/slovenia.py index 3233be674..c3192578b 100644 --- a/holidays/countries/slovenia.py +++ b/holidays/countries/slovenia.py @@ -11,8 +11,9 @@ from gettext import gettext as tr +from holidays.calendars.gregorian import AUG +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Slovenia(HolidayBase, ChristianHolidays, InternationalHolidays): @@ -30,6 +31,11 @@ class Slovenia(HolidayBase, ChristianHolidays, InternationalHolidays): default_language = "sl" supported_languages = ("en_US", "sl", "uk") + special_holidays = { + # Solidarity Day. + 2023: (AUG, 14, tr("dan solidarnosti")), + } + def __init__(self, *args, **kwargs): ChristianHolidays.__init__(self) InternationalHolidays.__init__(self) diff --git a/holidays/countries/south_africa.py b/holidays/countries/south_africa.py index dba3d1534..749357d0e 100644 --- a/holidays/countries/south_africa.py +++ b/holidays/countries/south_africa.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import JAN, MAR, APR, MAY, JUN, AUG, NOV, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class SouthAfrica(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/south_korea.py b/holidays/countries/south_korea.py index 2b0868f78..58a9c7fd5 100644 --- a/holidays/countries/south_korea.py +++ b/holidays/countries/south_korea.py @@ -17,12 +17,8 @@ from holidays.calendars import _CustomChineseCalendar from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, AUG, SEP, SAT, SUN from holidays.constants import BANK, PUBLIC +from holidays.groups import ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ( - ChineseCalendarHolidays, - ChristianHolidays, - InternationalHolidays, -) class SouthKorea(HolidayBase, ChineseCalendarHolidays, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/spain.py b/holidays/countries/spain.py index 846a85a78..2aedc4152 100644 --- a/holidays/countries/spain.py +++ b/holidays/countries/spain.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from typing import Optional +from holidays.groups import ChristianHolidays, IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, IslamicHolidays, InternationalHolidays class Spain(HolidayBase, ChristianHolidays, IslamicHolidays, InternationalHolidays): diff --git a/holidays/countries/sweden.py b/holidays/countries/sweden.py index 788c6a8b4..e1d98f905 100644 --- a/holidays/countries/sweden.py +++ b/holidays/countries/sweden.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import _get_all_sundays +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Sweden(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/switzerland.py b/holidays/countries/switzerland.py index 6066a3014..48242d2a2 100644 --- a/holidays/countries/switzerland.py +++ b/holidays/countries/switzerland.py @@ -13,8 +13,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import APR, THU, _get_nth_weekday_of_month +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Switzerland(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/taiwan.py b/holidays/countries/taiwan.py index f0ec6e456..569ca1def 100644 --- a/holidays/countries/taiwan.py +++ b/holidays/countries/taiwan.py @@ -12,8 +12,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import DEC +from holidays.groups import ChineseCalendarHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChineseCalendarHolidays, InternationalHolidays class Taiwan(HolidayBase, ChineseCalendarHolidays, InternationalHolidays): diff --git a/holidays/countries/thailand.py b/holidays/countries/thailand.py index 9858c6b28..06b566e67 100644 --- a/holidays/countries/thailand.py +++ b/holidays/countries/thailand.py @@ -14,8 +14,8 @@ from gettext import gettext as tr from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC +from holidays.groups import InternationalHolidays, ThaiCalendarHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, ThaiCalendarHolidays class Thailand(HolidayBase, InternationalHolidays, ThaiCalendarHolidays): diff --git a/holidays/countries/tunisia.py b/holidays/countries/tunisia.py index d6bcf159b..42f27c390 100644 --- a/holidays/countries/tunisia.py +++ b/holidays/countries/tunisia.py @@ -12,8 +12,8 @@ from gettext import gettext as tr +from holidays.groups import InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, IslamicHolidays class Tunisia(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/turkey.py b/holidays/countries/turkey.py index d65b41454..76ff6fd1e 100644 --- a/holidays/countries/turkey.py +++ b/holidays/countries/turkey.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import IslamicHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import IslamicHolidays, InternationalHolidays class Turkey(HolidayBase, IslamicHolidays, InternationalHolidays): diff --git a/holidays/countries/ukraine.py b/holidays/countries/ukraine.py index be61572b5..6bebc1d6a 100644 --- a/holidays/countries/ukraine.py +++ b/holidays/countries/ukraine.py @@ -28,8 +28,8 @@ DEC, ) from holidays.calendars.julian import JULIAN_CALENDAR +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Ukraine(HolidayBase, ChristianHolidays, InternationalHolidays): @@ -212,10 +212,8 @@ def _populate(self, year): dts_observed.add(self._add_new_years_day(tr("Новий рік"))) dts_observed.add( - self._add_christmas_day( - # Christmas (Julian calendar). - tr("Різдво Христове (за юліанським календарем)") - ) + # Christmas (Julian calendar). + self._add_christmas_day(tr("Різдво Христове (за юліанським календарем)")) ) # International Women's Day. @@ -251,10 +249,8 @@ def _populate(self, year): dts_observed.add(self._add_world_war_two_victory_day(name)) if year >= 1997: - dts_observed.add( - # Day of the Constitution of Ukraine. - self._add_holiday_jun_28(tr("День Конституції України")) - ) + # Day of the Constitution of Ukraine. + dts_observed.add(self._add_holiday_jun_28(tr("День Конституції України"))) # Independence Day. name = tr("День незалежності України") @@ -294,15 +290,17 @@ def _populate(self, year): # https://zakon.rada.gov.ua/laws/show/785/97-вр # 23.04.1999: holiday on weekend move to next workday # https://zakon.rada.gov.ua/laws/show/576-14 - if self.observed: - for dt in sorted(dts_observed): - if self._is_weekend(dt) and ( - date(1995, JAN, 27) <= dt <= date(1998, JAN, 9) or dt >= date(1999, APR, 23) - ): - dt_observed = dt + td(days=+2 if self._is_saturday(dt) else +1) - while dt_observed in self: - dt_observed += td(days=+1) - self._add_holiday(self.tr("%s (вихідний)") % self[dt], dt_observed) + if not self.observed: + return None + for dt in sorted(dts_observed): + if self._is_weekend(dt) and ( + date(1995, JAN, 27) <= dt <= date(1998, JAN, 9) or dt >= date(1999, APR, 23) + ): + dt_observed = dt + td(days=+2 if self._is_saturday(dt) else +1) + while dt_observed in self: + dt_observed += td(days=+1) + for name in self.get_list(dt): + self._add_holiday(self.tr("%s (вихідний)") % name, dt_observed) class UA(Ukraine): diff --git a/holidays/countries/united_arab_emirates.py b/holidays/countries/united_arab_emirates.py index 8247a42e9..a13a24b48 100644 --- a/holidays/countries/united_arab_emirates.py +++ b/holidays/countries/united_arab_emirates.py @@ -13,8 +13,8 @@ from holidays.calendars import _CustomIslamicCalendar from holidays.calendars.gregorian import APR, MAY, JUN, JUL, AUG, SEP, NOV, FRI, SAT +from holidays.groups import InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, IslamicHolidays class UnitedArabEmirates(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/united_kingdom.py b/holidays/countries/united_kingdom.py index ace01397c..bac8649a7 100644 --- a/holidays/countries/united_kingdom.py +++ b/holidays/countries/united_kingdom.py @@ -14,8 +14,8 @@ from typing import Tuple, Union from holidays.calendars.gregorian import APR, MAY, JUN, JUL, SEP, DEC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class UnitedKingdom(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/united_states.py b/holidays/countries/united_states.py index a5818dd5b..f1f0f13c6 100644 --- a/holidays/countries/united_states.py +++ b/holidays/countries/united_states.py @@ -14,8 +14,8 @@ from typing import Tuple, Union from holidays.calendars.gregorian import DEC, FRI, _get_nth_weekday_from +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class UnitedStates(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/uruguay.py b/holidays/countries/uruguay.py index 4531150bc..18b2f6ed0 100644 --- a/holidays/countries/uruguay.py +++ b/holidays/countries/uruguay.py @@ -15,8 +15,8 @@ from holidays.calendars.gregorian import MAR, JUN, DEC, MON, _get_nth_weekday_from from holidays.constants import BANK, PUBLIC +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Uruguay(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/uzbekistan.py b/holidays/countries/uzbekistan.py index 212f0f756..dc2b465b8 100644 --- a/holidays/countries/uzbekistan.py +++ b/holidays/countries/uzbekistan.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import InternationalHolidays, IslamicHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import InternationalHolidays, IslamicHolidays class Uzbekistan(HolidayBase, InternationalHolidays, IslamicHolidays): diff --git a/holidays/countries/vanuatu.py b/holidays/countries/vanuatu.py new file mode 100644 index 000000000..ef0ce5f08 --- /dev/null +++ b/holidays/countries/vanuatu.py @@ -0,0 +1,109 @@ +# 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 (c) 2017-2023 +# ryanss (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 holidays.calendars.gregorian import JUL, OCT +from holidays.groups import ChristianHolidays, InternationalHolidays +from holidays.holiday_base import HolidayBase + + +class Vanuatu(HolidayBase, ChristianHolidays, InternationalHolidays): + """ + https://en.wikipedia.org/wiki/Public_holidays_in_Vanuatu + https://www.timeanddate.com/holidays/vanuatu/ + https://www.gov.vu/index.php/events/holidays + """ + + country = "VU" + observed_label = "%s (Observed)" + independence_anniversary = "40th Independence Anniversary" + special_holidays = { + 2020: ( + (JUL, 23, independence_anniversary), + (JUL, 27, independence_anniversary), + (JUL, 28, independence_anniversary), + (JUL, 29, independence_anniversary), + (JUL, 31, independence_anniversary), + ), + 2022: (OCT, 13, "Election Day"), + } + + def __init__(self, *args, **kwargs): + ChristianHolidays.__init__(self) + InternationalHolidays.__init__(self) + super().__init__(*args, **kwargs) + + def _add_observed(self, dt: date) -> None: + if self.observed and self._is_sunday(dt): + self._add_holiday(self.observed_label % self[dt], dt + td(days=+1)) + + def _populate(self, year): + # On 30 July 1980, Vanuatu gained independence from Britain and France. + if year <= 1980: + return None + + super()._populate(year) + + # New Years Day. + self._add_observed(self._add_new_years_day("New Year's Day")) + + if year >= 1999: + # Father Lini Day. + self._add_observed(self._add_holiday_feb_21("Father Lini Day")) + + # Custom Chief's Day. + self._add_observed(self._add_holiday_mar_5("Custom Chief's Day")) + + # Good Friday. + self._add_good_friday("Good Friday") + + # Easter Monday. + self._add_easter_monday("Easter Monday") + + # Labour Day. + self._add_observed(self._add_labor_day("Labour Day")) + + # Ascension Day. + self._add_ascension_thursday("Ascension Day") + + # Children's Day. + self._add_observed(self._add_holiday_jul_24("Children's Day")) + + # Independence Day. + self._add_observed(self._add_holiday_jul_30("Independence Day")) + + # Assumption Day. + self._add_observed(self._add_assumption_of_mary_day("Assumption Day")) + + # Constitution Day. + self._add_observed(self._add_holiday_oct_5("Constitution Day")) + + # Unity Day. + self._add_observed(self._add_holiday_nov_29("Unity Day")) + + # Christmas Day. + self._add_christmas_day("Christmas Day") + + # Family Day. + name = "Family Day" + dec_26 = self._add_christmas_day_two(name) + if self.observed and self._is_monday(dec_26): + self._add_holiday(self.observed_label % name, dec_26 + td(days=+1)) + + +class VU(Vanuatu): + pass + + +class VTU(Vanuatu): + pass diff --git a/holidays/countries/vatican_city.py b/holidays/countries/vatican_city.py index 6dba3a575..91907ae91 100644 --- a/holidays/countries/vatican_city.py +++ b/holidays/countries/vatican_city.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import ChristianHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays class VaticanCity(HolidayBase, ChristianHolidays): diff --git a/holidays/countries/venezuela.py b/holidays/countries/venezuela.py index e0f1ed9fe..e213f4930 100644 --- a/holidays/countries/venezuela.py +++ b/holidays/countries/venezuela.py @@ -11,8 +11,8 @@ from gettext import gettext as tr +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Venezuela(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/vietnam.py b/holidays/countries/vietnam.py index cb4fe4507..6f4b41cf6 100644 --- a/holidays/countries/vietnam.py +++ b/holidays/countries/vietnam.py @@ -11,8 +11,8 @@ from datetime import timedelta as td +from holidays.groups import ChineseCalendarHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChineseCalendarHolidays, InternationalHolidays class Vietnam(HolidayBase, ChineseCalendarHolidays, InternationalHolidays): diff --git a/holidays/countries/zambia.py b/holidays/countries/zambia.py index dc725129e..aa8381d27 100644 --- a/holidays/countries/zambia.py +++ b/holidays/countries/zambia.py @@ -13,8 +13,8 @@ from datetime import timedelta as td from holidays.calendars.gregorian import MAR, JUL, AUG, SEP +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Zambia(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/countries/zimbabwe.py b/holidays/countries/zimbabwe.py index dbaac7db4..968c34911 100644 --- a/holidays/countries/zimbabwe.py +++ b/holidays/countries/zimbabwe.py @@ -12,8 +12,8 @@ from datetime import date from datetime import timedelta as td +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class Zimbabwe(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/financial/european_central_bank.py b/holidays/financial/european_central_bank.py index 22c8145f7..471296238 100644 --- a/holidays/financial/european_central_bank.py +++ b/holidays/financial/european_central_bank.py @@ -9,8 +9,8 @@ # Website: https://github.com/dr-prodigy/python-holidays # License: MIT (see LICENSE file) +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class EuropeanCentralBank(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/financial/ny_stock_exchange.py b/holidays/financial/ny_stock_exchange.py index e32cf68a0..0d387abfc 100644 --- a/holidays/financial/ny_stock_exchange.py +++ b/holidays/financial/ny_stock_exchange.py @@ -28,8 +28,8 @@ MON, _get_nth_weekday_of_month, ) +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class NewYorkStockExchange(HolidayBase, ChristianHolidays, InternationalHolidays): diff --git a/holidays/groups/__init__.py b/holidays/groups/__init__.py index 033e00678..cb66b03fa 100644 --- a/holidays/groups/__init__.py +++ b/holidays/groups/__init__.py @@ -17,4 +17,5 @@ from holidays.groups.hindu import HinduCalendarHolidays from holidays.groups.international import InternationalHolidays from holidays.groups.islamic import IslamicHolidays +from holidays.groups.persian import PersianCalendarHolidays from holidays.groups.thai import ThaiCalendarHolidays diff --git a/holidays/groups/islamic.py b/holidays/groups/islamic.py index e5c8f6f5b..be0064656 100644 --- a/holidays/groups/islamic.py +++ b/holidays/groups/islamic.py @@ -27,6 +27,46 @@ class IslamicHolidays: def __init__(self, calendar=_IslamicLunar()) -> None: self._islamic_calendar = calendar + def _add_ali_al_rida_death_day(self, name) -> Set[date]: + """ + Add death of Ali al-Rida day (last (29th or 30th) day of 2nd month). + + https://en.wikipedia.org/wiki/Ali_al-Rida + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.ali_al_rida_death_dates(self._year) + ) + + def _add_ali_birthday_day(self, name) -> Set[date]: + """ + Add birthday of Ali ibn Abu Talib day (13th day of 7th month). + + https://en.wikipedia.org/wiki/Ali + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.ali_birthday_dates(self._year) + ) + + def _add_ali_death_day(self, name) -> Set[date]: + """ + Add death of Ali ibn Abu Talib day (21st day of 9th month). + + https://en.wikipedia.org/wiki/Ali + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.ali_death_dates(self._year) + ) + + def _add_arbaeen_day(self, name) -> Set[date]: + """ + Add Arbaeen day (20th day of 2nd month). + + https://en.wikipedia.org/wiki/Arbaeen + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.arbaeen_dates(self._year) + ) + def _add_arafah_day(self, name) -> Set[date]: """ Add Day of Arafah (9th day of 12th month). @@ -150,6 +190,26 @@ def _add_eid_al_fitr_day_four(self, name) -> Set[date]: name, self._islamic_calendar.eid_al_fitr_dates(self._year), days_delta=+3 ) + def _add_eid_al_ghadir_day(self, name) -> Set[date]: + """ + Add Eid al-Ghadir Day (18th day of 12th month). + + https://en.wikipedia.org/wiki/Eid_al-Ghadeer + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.eid_al_ghadir_dates(self._year) + ) + + def _add_fatima_death_day(self, name) -> Set[date]: + """ + Add death of Fatima day (3rd day of 6th month). + + https://en.wikipedia.org/wiki/Fatima + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.fatima_death_dates(self._year) + ) + def _add_hari_hol_johor(self, name) -> Set[date]: """ Hari Hol Johor. @@ -160,6 +220,26 @@ def _add_hari_hol_johor(self, name) -> Set[date]: name, self._islamic_calendar.hari_hol_johor_dates(self._year) ) + def _add_hasan_al_askari_death_day(self, name) -> Set[date]: + """ + Add death of Hasan_al-Askari day (8th day of 3rd month). + + https://en.wikipedia.org/wiki/Hasan_al-Askari + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.hasan_al_askari_death_dates(self._year) + ) + + def _add_imam_mahdi_birthday_day(self, name) -> Set[date]: + """ + Add birthday of Muhammad al-Mahdi day (15th day of 8th month). + + https://en.wikipedia.org/wiki/Muhammad_al-Mahdi + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.imam_mahdi_birthday_dates(self._year) + ) + def _add_islamic_calendar_holiday( self, name: str, dates: Iterable[Tuple[date, bool]], days_delta: int = 0 ) -> Set[date]: @@ -244,6 +324,16 @@ def _add_nuzul_al_quran_day(self, name) -> Set[date]: name, self._islamic_calendar.nuzul_al_quran_dates(self._year) ) + def _add_prophet_death_day(self, name) -> Set[date]: + """ + Add death of Prophet Muhammad and Hasan ibn Ali day (28th day of 2nd month). + + https://en.wikipedia.org/wiki/Hasan_ibn_Ali + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.prophet_death_dates(self._year) + ) + def _add_ramadan_beginning_day(self, name) -> Set[date]: """ Add First Day of Ramadan (1st day of 9th month). @@ -255,3 +345,33 @@ def _add_ramadan_beginning_day(self, name) -> Set[date]: return self._add_islamic_calendar_holiday( name, self._islamic_calendar.ramadan_beginning_dates(self._year) ) + + def _add_sadiq_birthday_day(self, name) -> Set[date]: + """ + Add birthday of Prophet Muhammad and Ja'far al-Sadiq day (17th day of 3rd month). + + https://en.wikipedia.org/wiki/Ja%27far_al-Sadiq + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.sadiq_birthday_dates(self._year) + ) + + def _add_sadiq_death_day(self, name) -> Set[date]: + """ + Add death of Ja'far al-Sadiq day (25th day of 10th month). + + https://en.wikipedia.org/wiki/Ja%27far_al-Sadiq + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.sadiq_death_dates(self._year) + ) + + def _add_tasua_day(self, name) -> Set[date]: + """ + Add Tasua day (9th day of 1st month). + + https://en.wikipedia.org/wiki/Tasua + """ + return self._add_islamic_calendar_holiday( + name, self._islamic_calendar.tasua_dates(self._year) + ) diff --git a/holidays/groups/persian.py b/holidays/groups/persian.py new file mode 100644 index 000000000..b3328c61c --- /dev/null +++ b/holidays/groups/persian.py @@ -0,0 +1,145 @@ +# 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 (c) 2017-2023 +# ryanss (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 typing import Optional + +from holidays.calendars.persian import _Persian + + +class PersianCalendarHolidays: + """ + Persian (Solar Hijri) calendar holidays. + """ + + def __init__(self) -> None: + self._persian_calendar = _Persian() + + def _add_death_of_khomeini_day(self, name: str) -> Optional[date]: + """ + Add Death of Ruhollah Khomeini Day (14th day of the 3rd month). + + Ayatollah Ruhollah Khomeini was an Iranian revolutionary, politician and religious leader. + https://en.wikipedia.org/wiki/Ruhollah_Khomeini + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.persian_to_gregorian(self._year, 3, 14) + ) + + def _add_islamic_republic_day(self, name: str) -> Optional[date]: + """ + Add Islamic Republic Day (12th day of the 1st month). + + Iranian Islamic Republic Day is a national and a public holiday in Iran. It marks the day + that the results of the March 1979 Iranian Islamic Republic referendum were announced. + https://en.wikipedia.org/wiki/Islamic_Republic_Day + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.persian_to_gregorian(self._year, 1, 12) + ) + + def _add_islamic_revolution_day(self, name: str) -> Optional[date]: + """ + Add Islamic Revolution Day (22nd day of the 11th month). + + The anniversary of the Iranian Revolution commemorates the protests that led to + the downfall of the Pahlavi dynasty and the installation of the Islamic Revolutionary + which is headed by Imam Khomeini. + https://en.wikipedia.org/wiki/Anniversary_of_Islamic_Revolution + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.persian_to_gregorian(self._year - 1, 11, 22) + ) + + def _add_khordad_uprising_day(self, name: str) -> Optional[date]: + """ + Add 15 Khordad uprising Day (15th day of the 3rd month). + + The demonstrations of June 5 and 6, also called the events of June 1963 or (using + the Iranian calendar) the 15 Khordad uprising were protests in Iran against the arrest + of Ayatollah Ruhollah Khomeini. + https://en.wikipedia.org/wiki/June_5,_1963_demonstrations_in_Iran + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.persian_to_gregorian(self._year, 3, 15) + ) + + def _add_natures_day(self, name: str) -> Optional[date]: + """ + Add Nature's Day, or Sizdah Bedar (13th day of the 1st month). + + Nature's Day is an Iranian festival, during which people spend time picnicking outdoors. + https://en.wikipedia.org/wiki/Sizdah_Be-dar + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.persian_to_gregorian(self._year, 1, 13) + ) + + def _add_nowruz_day(self, name: str) -> Optional[date]: + """ + Add Nowruz Day (1st day of the 1st month). + + Nowruz (Iranian or Persian New Year) is a festival based on the Iranian Solar Hijri + calendar, on the spring equinox. + https://en.wikipedia.org/wiki/Nowruz + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.new_year_date(self._year) + ) + + def _add_nowruz_day_two(self, name: str) -> Optional[date]: + """ + Add Nowruz Day Two. + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.new_year_date(self._year), days_delta=+1 + ) + + def _add_nowruz_day_three(self, name: str) -> Optional[date]: + """ + Add Nowruz Day Three. + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.new_year_date(self._year), days_delta=+2 + ) + + def _add_nowruz_day_four(self, name: str) -> Optional[date]: + """ + Add Nowruz Day Four. + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.new_year_date(self._year), days_delta=+3 + ) + + def _add_oil_nationalization_day(self, name: str) -> Optional[date]: + """ + Add Iranian Oil Industry Nationalization Day (29th day of the 12th month). + + The nationalization of the Iranian oil industry resulted from a movement in the Iranian + parliament (Majlis) to seize control of Iran's oil industry. + https://en.wikipedia.org/wiki/Nationalization_of_the_Iranian_oil_industry + """ + return self._add_persian_calendar_holiday( + name, self._persian_calendar.persian_to_gregorian(self._year - 1, 12, 29) + ) + + def _add_persian_calendar_holiday( + self, name: str, dt: Optional[date], days_delta: int = 0 + ) -> Optional[date]: + """ + Add Persian calendar holiday. + """ + if dt is None: + return None + if days_delta != 0: + dt += td(days=days_delta) + return self._add_holiday(name, dt) diff --git a/holidays/holiday_base.py b/holidays/holiday_base.py index 07dba5f03..b6e58a169 100644 --- a/holidays/holiday_base.py +++ b/holidays/holiday_base.py @@ -325,22 +325,14 @@ def __init__( f"Category is not supported: {', '.join(unknown_categories)}." ) - name = getattr(self, "country", getattr(self, "market", None)) + name: Optional[str] = getattr(self, "country", getattr(self, "market", None)) if name: - locale_path = Path(__file__).with_name("locale") - translator: NullTranslations - translations = { - # Collect `language` part from - # holidays/locale//LC_MESSAGES/country.po - translation.parts[-3] - for translation in locale_path.rglob(f"{name}.mo") - } - if language and language in translations: - translator = translation( - name, languages=[language], localedir=str(locale_path) - ) - else: - translator = translation(name, fallback=True, localedir=str(locale_path)) + translator: NullTranslations = translation( + name, + fallback=language not in self.supported_languages, + languages=[language] if language in self.supported_languages else None, + localedir=str(Path(__file__).with_name("locale")), + ) self.tr = translator.gettext if isinstance(years, int): @@ -399,7 +391,7 @@ def __eq__(self, other: object) -> bool: if getattr(self, attribute_name, None) != getattr(other, attribute_name, None): return False - return dict.__eq__(self, other) + return dict.__eq__(cast("Mapping[Any, Any]", self), other) def __getattr__(self, name): try: @@ -617,9 +609,10 @@ def __str__(self) -> str: if self: return super().__str__() - parts = [] - for attribute_name in self.__attribute_names: - parts.append("'%s': %s" % (attribute_name, getattr(self, attribute_name, None))) + parts = ( + f"'{attribute_name}': {getattr(self, attribute_name, None)}" + for attribute_name in self.__attribute_names + ) return f"{{{', '.join(parts)}}}" diff --git a/holidays/holiday_groups.py b/holidays/holiday_groups.py deleted file mode 100644 index 59fb73823..000000000 --- a/holidays/holiday_groups.py +++ /dev/null @@ -1,22 +0,0 @@ -# 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 (c) 2017-2022 -# ryanss (c) 2014-2017 -# Website: https://github.com/dr-prodigy/python-holidays -# License: MIT (see LICENSE file) - -# flake8: noqa: F401 - -from holidays.groups import ( - BuddhistCalendarHolidays, - ChineseCalendarHolidays, - ChristianHolidays, - HinduCalendarHolidays, - InternationalHolidays, - IslamicHolidays, - ThaiCalendarHolidays, -) diff --git a/holidays/locale/ar/LC_MESSAGES/SA.po b/holidays/locale/ar/LC_MESSAGES/SA.po index 82125225d..5dcdce931 100644 --- a/holidays/locale/ar/LC_MESSAGES/SA.po +++ b/holidays/locale/ar/LC_MESSAGES/SA.po @@ -3,48 +3,38 @@ # msgid "" msgstr "" -"Project-Id-Version: Python Holidays 0.29\n" -"POT-Creation-Date: 2023-06-28 00:13+0100\n" -"PO-Revision-Date: 2023-07-05 17:41+0100\n" -"Last-Translator: \n" -"Language-Team: Abdelkhalek Boukli Hacene \n" +"Project-Id-Version: Python Holidays 0.30\n" +"POT-Creation-Date: 2023-08-04 20:02+0300\n" +"PO-Revision-Date: 2023-08-04 20:05+0300\n" +"Last-Translator: ~Jhellico \n" +"Language-Team: Python Holidays localization team\n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5);\n" "Generated-By: Lingua 4.15.0\n" -"X-Generator: Poedit 3.3.2\n" +"X-Generator: Poedit 3.2.2\n" #. Estimated label. #, c-format msgid "(تقدير*) *%s" msgstr "" -#. Celebrate the country's win against Argentina in the World Cup -msgid "يوم وطني" -msgstr "" - +#. %s (Observed). #, c-format msgid "(ملاحظة) %s" msgstr "" -#. The holiday is a 4-day holiday starting on the day following the 29th day -#. of Ramadan, the 9th -#. month of the Islamic calendar. Observed days are added to make up for any -#. days falling on a -#. weekend. Holidays may straddle across Gregorian years, so we go back one -#. year to pick up any such -#. occurrence. Date of observance is announced yearly. Eid al-Fitr Holiday +#. Celebrate the country's win against Argentina in the World Cup +msgid "يوم وطني" +msgstr "" + +#. Eid al-Fitr Holiday msgid "عطلة عيد الفطر" msgstr "" -#. The holiday is a 4-day holiday starting on Arafat Day, the 10th of Dhu al- -#. Hijjah, the 12th month -#. of the Islamic calendar. Observed days are added to make up for any days -#. falling on a weekend. -#. Holidays may straddle across Gregorian years, so we go back one year to -#. pick up any such -#. occurrence. Date of observance is announced yearly. Arafat Day +#. Arafat Day msgid "يوم عرفة" msgstr "" @@ -59,7 +49,3 @@ msgstr "" #. Founding Day msgid "يوم التأسيسي" msgstr "" - -#. Eid al-Fitr Holiday (observed) -msgid "عطلة عيد الفطر (ملاحظة)" -msgstr "" diff --git a/holidays/locale/en_US/LC_MESSAGES/CA.po b/holidays/locale/en_US/LC_MESSAGES/CA.po deleted file mode 100644 index 12e4c609d..000000000 --- a/holidays/locale/en_US/LC_MESSAGES/CA.po +++ /dev/null @@ -1,140 +0,0 @@ -# Canada holidays en_US localization. -# Authors: Arkadii Yakovets , (c) 2023. -# -msgid "" -msgstr "" -"Project-Id-Version: Python Holidays 0.25\n" -"POT-Creation-Date: 2023-02-15 08:30-0800\n" -"PO-Revision-Date: 2023-02-16 08:52-0800\n" -"Last-Translator: Arkadii Yakovets \n" -"Language-Team: Python Holidays localization team\n" -"Language: en_US\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Lingua 4.15.0\n" -"X-Generator: Poedit 3.2.2\n" - -#. New Year's Day. -msgid "New Year's Day" -msgstr "" - -#, c-format -msgid "%s (Observed)" -msgstr "" - -#. Family Day. -msgid "Family Day" -msgstr "" - -#. Louis Riel Day. -msgid "Louis Riel Day" -msgstr "" - -#. Islander Day. -msgid "Islander Day" -msgstr "" - -#. Heritage Day. -msgid "Heritage Day" -msgstr "" - -#. St. Patrick's Day. -msgid "St. Patrick's Day" -msgstr "" - -#. Good Friday. -msgid "Good Friday" -msgstr "" - -#. Easter Monday. -msgid "Easter Monday" -msgstr "" - -#. St. George's Day. -msgid "St. George's Day" -msgstr "" - -#. Victoria Day. -msgid "Victoria Day" -msgstr "" - -#. National Patriots' Day. -msgid "National Patriots' Day" -msgstr "" - -#. National Aboriginal Day. -msgid "National Aboriginal Day" -msgstr "" - -#. St. Jean Baptiste Day. -msgid "St. Jean Baptiste Day" -msgstr "" - -#. Discovery Day. -msgid "Discovery Day" -msgstr "" - -#. Memorial Day. -msgid "Memorial Day" -msgstr "" - -#. Canada Day. -msgid "Canada Day" -msgstr "" - -#. Dominion Day. -msgid "Dominion Day" -msgstr "" - -#. Nunavut Day. -msgid "Nunavut Day" -msgstr "" - -#. Civic Holiday. -msgid "Civic Holiday" -msgstr "" - -#. British Columbia Day. -msgid "British Columbia Day" -msgstr "" - -#. New Brunswick Day. -msgid "New Brunswick Day" -msgstr "" - -#. Saskatchewan Day. -msgid "Saskatchewan Day" -msgstr "" - -#. Labour Day. -msgid "Labour Day" -msgstr "" - -#. Funeral of Queen Elizabeth II. -msgid "Funeral of Her Majesty the Queen Elizabeth II" -msgstr "" - -#. National Day for Truth and Reconciliation. -msgid "National Day for Truth and Reconciliation" -msgstr "" - -#. Thanksgiving. -msgid "Thanksgiving" -msgstr "" - -#. Remembrance Day. -msgid "Remembrance Day" -msgstr "" - -#. Christmas Day. -msgid "Christmas Day" -msgstr "" - -#. Boxing Day. -msgid "Boxing Day" -msgstr "" - -#. Terry Fox Day. -msgid "Terry Fox Day" -msgstr "" diff --git a/holidays/locale/en_US/LC_MESSAGES/IR.po b/holidays/locale/en_US/LC_MESSAGES/IR.po new file mode 100644 index 000000000..c6cb542c6 --- /dev/null +++ b/holidays/locale/en_US/LC_MESSAGES/IR.po @@ -0,0 +1,114 @@ +# Iran holidays en_US localization. +# Authors: ~Jhellico , (c) 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: Python Holidays 0.31\n" +"POT-Creation-Date: 2023-08-03 18:21+0300\n" +"PO-Revision-Date: 2023-08-03 18:26+0300\n" +"Last-Translator: ~Jhellico \n" +"Language-Team: Python Holidays localization team\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Generated-By: Lingua 4.15.0\n" +"X-Generator: Poedit 3.2.2\n" + +#. Estimated label. +#, c-format +msgid "(تخمین زده*) *%s" +msgstr "%s* (*estimated)" + +#. Persian New Year. +msgid "نوروز" +msgstr "Persian New Year" + +#. Islamic Republic Day. +msgid "روز جمهوری اسلامی" +msgstr "Islamic Republic Day" + +#. Nature's Day. +msgid "روز طبیعت" +msgstr "Nature's Day" + +#. Death of Khomeini. +msgid "درگذشت سید روح‌الله خمینی" +msgstr "Death of Khomeini" + +#. Khordad National Uprising. +msgid "تظاهرات ۱۵ خرداد" +msgstr "Khordad National Uprising" + +#. Islamic Revolution Day. +msgid "پیروزی انقلاب ۵۷" +msgstr "Islamic Revolution Day" + +#. Iranian Oil Industry Nationalization Day. +msgid "ملی‌شدن صنعت نفت" +msgstr "Iranian Oil Industry Nationalization Day" + +#. Tasua. +msgid "تاسوعا" +msgstr "Tasua" + +#. Ashura. +msgid "کشته‌شدن حسین بن علی، عاشورا" +msgstr "Ashura" + +#. Arbaeen. +msgid "چهلم حسین بن علی اربعین" +msgstr "Arbaeen" + +#. Demise of Prophet Muhammad and Hasan ibn Ali. +msgid "کشته‌شدن حسن مجتبی و درگذشت محمد" +msgstr "Demise of Prophet Muhammad and Hasan ibn Ali" + +#. Martyrdom of Ali al-Rida. +msgid "کشته‌شدن علی بن موسی الرضا" +msgstr "Martyrdom of Ali al-Rida" + +#. Martyrdom of Hasan al-Askari. +msgid "کشته‌شدن حسن عسکری" +msgstr "Martyrdom of Hasan al-Askari" + +#. Birthday of Muhammad and Ja'far al-Sadiq. +msgid "زادروز محمد و جعفر صادق" +msgstr "Birthday of Muhammad and Ja'far al-Sadiq" + +#. Martyrdom of Fatima. +msgid "کشته‌شدن فاطمه زهرا" +msgstr "Martyrdom of Fatima" + +#. Birthday of Ali. +msgid "زادروز علی بن ابی‌طالب" +msgstr "Birthday of Ali" + +#. Ascension of Muhammad. +msgid "مبعث" +msgstr "Ascension of Muhammad" + +#. Birthday of Mahdi. +msgid "زادروز حجت بن الحسن" +msgstr "Birthday of Mahdi" + +#. Martyrdom of Ali. +msgid "کشته‌شدن علی بن ابی‌طالب" +msgstr "Martyrdom of Ali" + +#. Eid al-Fitr. +msgid "عید فطر" +msgstr "Eid al-Fitr" + +#. Martyrdom of Ja'far al-Sadiq. +msgid "کشته‌شدن جعفر صادق" +msgstr "Martyrdom of Ja'far al-Sadiq" + +#. Eid al-Adha. +msgid "عید قربان" +msgstr "Eid al-Adha" + +#. Eid al-Ghadeer. +msgid "عید غدیر" +msgstr "Eid al-Ghadeer" diff --git a/holidays/locale/en_US/LC_MESSAGES/SA.po b/holidays/locale/en_US/LC_MESSAGES/SA.po index 43a162579..ed873012c 100644 --- a/holidays/locale/en_US/LC_MESSAGES/SA.po +++ b/holidays/locale/en_US/LC_MESSAGES/SA.po @@ -3,49 +3,38 @@ # msgid "" msgstr "" -"Project-Id-Version: Python Holidays 0.29\n" -"POT-Creation-Date: 2023-06-28 00:13+0100\n" -"PO-Revision-Date: 2023-07-11 03:44+0100\n" -"Last-Translator: \n" -"Language-Team: Abdelkhalek Boukli Hacene \n" +"Project-Id-Version: Python Holidays 0.30\n" +"POT-Creation-Date: 2023-08-04 20:02+0300\n" +"PO-Revision-Date: 2023-08-04 20:03+0300\n" +"Last-Translator: ~Jhellico \n" +"Language-Team: Python Holidays localization team\n" "Language: en_US\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "Generated-By: Lingua 4.15.0\n" -"X-Generator: Poedit 3.3.2\n" +"X-Generator: Poedit 3.2.2\n" #. Estimated label. #, c-format msgid "(تقدير*) *%s" msgstr "%s* (*estimated)" -#. Celebrate the country's win against Argentina in the World Cup -msgid "يوم وطني" -msgstr "A National Day" - +#. %s (Observed). #, c-format msgid "(ملاحظة) %s" msgstr "%s (observed)" -#. The holiday is a 4-day holiday starting on the day following the 29th day -#. of Ramadan, the 9th -#. month of the Islamic calendar. Observed days are added to make up for any -#. days falling on a -#. weekend. Holidays may straddle across Gregorian years, so we go back one -#. year to pick up any such -#. occurrence. Date of observance is announced yearly. Eid al-Fitr Holiday +#. Celebrate the country's win against Argentina in the World Cup +msgid "يوم وطني" +msgstr "A National Day" + +#. Eid al-Fitr Holiday msgid "عطلة عيد الفطر" msgstr "Eid al-Fitr Holiday" -#. The holiday is a 4-day holiday starting on Arafat Day, the 10th of Dhu al- -#. Hijjah, the 12th month -#. of the Islamic calendar. Observed days are added to make up for any days -#. falling on a weekend. -#. Holidays may straddle across Gregorian years, so we go back one year to -#. pick up any such -#. occurrence. Date of observance is announced yearly. Arafat Day +#. Arafat Day msgid "يوم عرفة" msgstr "Arafat Day" @@ -60,7 +49,3 @@ msgstr "National Day Holiday" #. Founding Day msgid "يوم التأسيسي" msgstr "Founding Day Holiday" - -#. Eid al-Fitr Holiday (observed) -msgid "عطلة عيد الفطر (ملاحظة)" -msgstr "Eid al-Fitr Holiday (Observed)" diff --git a/holidays/locale/en_US/LC_MESSAGES/SI.po b/holidays/locale/en_US/LC_MESSAGES/SI.po index a52ae0b51..36d555d6c 100644 --- a/holidays/locale/en_US/LC_MESSAGES/SI.po +++ b/holidays/locale/en_US/LC_MESSAGES/SI.po @@ -59,3 +59,7 @@ msgstr "Christmas Day" #. Independence and Unity Day. msgid "dan samostojnosti in enotnosti" msgstr "Independence and Unity Day" + +#. Solidarity Day. +msgid "dan solidarnosti" +msgstr "Solidarity Day" diff --git a/holidays/locale/fa/LC_MESSAGES/IR.po b/holidays/locale/fa/LC_MESSAGES/IR.po new file mode 100644 index 000000000..b4fb2742e --- /dev/null +++ b/holidays/locale/fa/LC_MESSAGES/IR.po @@ -0,0 +1,114 @@ +# Iran holidays. +# Authors: ~Jhellico , (c) 2023. +# +msgid "" +msgstr "" +"Project-Id-Version: Python Holidays 0.31\n" +"POT-Creation-Date: 2023-08-03 18:21+0300\n" +"PO-Revision-Date: 2023-08-03 18:23+0300\n" +"Last-Translator: ~Jhellico \n" +"Language-Team: Python Holidays localization team\n" +"Language: fa\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n==0 || n==1);\n" +"Generated-By: Lingua 4.15.0\n" +"X-Generator: Poedit 3.2.2\n" + +#. Estimated label. +#, c-format +msgid "(تخمین زده*) *%s" +msgstr "" + +#. Persian New Year. +msgid "نوروز" +msgstr "" + +#. Islamic Republic Day. +msgid "روز جمهوری اسلامی" +msgstr "" + +#. Nature's Day. +msgid "روز طبیعت" +msgstr "" + +#. Death of Khomeini. +msgid "درگذشت سید روح‌الله خمینی" +msgstr "" + +#. Khordad National Uprising. +msgid "تظاهرات ۱۵ خرداد" +msgstr "" + +#. Islamic Revolution Day. +msgid "پیروزی انقلاب ۵۷" +msgstr "" + +#. Iranian Oil Industry Nationalization Day. +msgid "ملی‌شدن صنعت نفت" +msgstr "" + +#. Tasua. +msgid "تاسوعا" +msgstr "" + +#. Ashura. +msgid "کشته‌شدن حسین بن علی، عاشورا" +msgstr "" + +#. Arbaeen. +msgid "چهلم حسین بن علی اربعین" +msgstr "" + +#. Demise of Prophet Muhammad and Hasan ibn Ali. +msgid "کشته‌شدن حسن مجتبی و درگذشت محمد" +msgstr "" + +#. Martyrdom of Ali al-Rida. +msgid "کشته‌شدن علی بن موسی الرضا" +msgstr "" + +#. Martyrdom of Hasan al-Askari. +msgid "کشته‌شدن حسن عسکری" +msgstr "" + +#. Birthday of Muhammad and Ja'far al-Sadiq. +msgid "زادروز محمد و جعفر صادق" +msgstr "" + +#. Martyrdom of Fatima. +msgid "کشته‌شدن فاطمه زهرا" +msgstr "" + +#. Birthday of Ali. +msgid "زادروز علی بن ابی‌طالب" +msgstr "" + +#. Ascension of Muhammad. +msgid "مبعث" +msgstr "" + +#. Birthday of Mahdi. +msgid "زادروز حجت بن الحسن" +msgstr "" + +#. Martyrdom of Ali. +msgid "کشته‌شدن علی بن ابی‌طالب" +msgstr "" + +#. Eid al-Fitr. +msgid "عید فطر" +msgstr "" + +#. Martyrdom of Ja'far al-Sadiq. +msgid "کشته‌شدن جعفر صادق" +msgstr "" + +#. Eid al-Adha. +msgid "عید قربان" +msgstr "" + +#. Eid al-Ghadeer. +msgid "عید غدیر" +msgstr "" diff --git a/holidays/locale/sl/LC_MESSAGES/SI.po b/holidays/locale/sl/LC_MESSAGES/SI.po index 3d1edfa5e..390022758 100644 --- a/holidays/locale/sl/LC_MESSAGES/SI.po +++ b/holidays/locale/sl/LC_MESSAGES/SI.po @@ -59,3 +59,7 @@ msgstr "" #. Independence and Unity Day. msgid "dan samostojnosti in enotnosti" msgstr "" + +#. Solidarity Day. +msgid "dan solidarnosti" +msgstr "" diff --git a/holidays/locale/uk/LC_MESSAGES/SI.po b/holidays/locale/uk/LC_MESSAGES/SI.po index 2d01c42ae..540bb9a38 100644 --- a/holidays/locale/uk/LC_MESSAGES/SI.po +++ b/holidays/locale/uk/LC_MESSAGES/SI.po @@ -59,3 +59,7 @@ msgstr "Різдво Христове" #. Independence and Unity Day. msgid "dan samostojnosti in enotnosti" msgstr "День незалежності та єднання" + +#. Solidarity Day. +msgid "dan solidarnosti" +msgstr "День солідарності" diff --git a/holidays/registry.py b/holidays/registry.py index 957de7041..0ef5e7e67 100644 --- a/holidays/registry.py +++ b/holidays/registry.py @@ -30,6 +30,7 @@ "azerbaijan": ("Azerbaijan", "AZ", "AZE"), "bahrain": ("Bahrain", "BH", "BAH"), "bangladesh": ("Bangladesh", "BD", "BGD"), + "barbados": ("Barbados", "BB", "BRB"), "belarus": ("Belarus", "BY", "BLR"), "belgium": ("Belgium", "BE", "BEL"), "belize": ("Belize", "BZ", "BLZ"), @@ -77,6 +78,7 @@ "iceland": ("Iceland", "IS", "ISL"), "india": ("India", "IN", "IND"), "indonesia": ("Indonesia", "ID", "IDN"), + "iran": ("Iran", "IR", "IRN"), "ireland": ("Ireland", "IE", "IRL"), "isle_of_man": ("IsleOfMan", "IM", "IMN"), "israel": ("Israel", "IL", "ISR"), @@ -148,6 +150,7 @@ "united_states": ("UnitedStates", "US", "USA"), "uruguay": ("Uruguay", "UY", "URY"), "uzbekistan": ("Uzbekistan", "UZ", "UZB"), + "vanuatu": ("Vanuatu", "VU", "VTU"), "vatican_city": ("VaticanCity", "VA", "VAT"), "venezuela": ("Venezuela", "VE", "VEN"), "vietnam": ("Vietnam", "VN", "VNM"), diff --git a/scripts/calendar/islamic_generator.py b/scripts/calendar/islamic_generator.py index cf1434da0..4b00c1b2b 100644 --- a/scripts/calendar/islamic_generator.py +++ b/scripts/calendar/islamic_generator.py @@ -27,29 +27,42 @@ }} """ -YEAR_TEMPLATE = " {year}: ({dates})," +YEAR_TEMPLATE = " {year}: {dates}," ISLAMIC_HOLIDAYS = ( # BH, DJ, EG, ID, MY, MA, TN, AE (1, 1, "HIJRI_NEW_YEAR"), # Islamic New Year - # BH (days-1), IN, PK + # BH (days-1), IN, IR, PK (1, 10, "ASHURA"), # Ashura # MY (2, 6, "HARI_HOL_JOHOR"), # Hari Hol of Johor # BH, DJ, EG, ET, IN, ID, MY, MA, NG, PK, TN, AE (3, 12, "MAWLID"), # Birthday of Prophet - # DJ, ID, MY, AE + # DJ, ID, IR, MY, AE (7, 27, "ISRA_AND_MIRAJ"), # Isra and Mi'raj # MY (9, 1, "RAMADAN_BEGINNING"), # Beginning of Ramadan # MY (9, 17, "NUZUL_AL_QURAN"), # Nuzul Al-Quran Day - # AL, AZ, BH, BA, BI, DJ, EG, ET, IN, ID, KG, MY, MA, NG, MK, PK, PH, + # AL, AZ, BH, BA, BI, DJ, EG, ET, ID, IN, IR, KG, MY, MA, NG, MK, PK, PH, # SA, SG, ES, TN, TR, AE, UZ (10, 1, "EID_AL_FITR"), # Eid al-Fitr - # AL, AZ, BH, BA, BI, DJ, EG, ET, IN, ID, KZ, KG, MY, MA, NG, PK, PH, + # AL, AZ, BH, BA, BI, DJ, EG, ET, ID, IN, IR, KZ, KG, MY, MA, NG, PK, PH, # SA, SG, ES, TN, TR, AE, UZ (12, 10, "EID_AL_ADHA"), # Eid al-Adha + # IR holidays: + (1, 9, "TASUA"), # Tasua + (2, 20, "ARBAEEN"), # Arbaeen + (2, 28, "PROPHET_DEATH"), # Demise of Prophet Muhammad and Martyrdom of Imam Hassan + (2, -1, "ALI_AL_RIDA_DEATH"), # Martyrdom of Imam Reza (last day of Safar) + (3, 8, "HASAN_AL_ASKARI_DEATH"), # Martyrdom of Imam Hasan al-Askari + (3, 17, "SADIQ_BIRTHDAY"), # Birthday of Prophet Muhammad and Imam Sadeq + (6, 3, "FATIMA_DEATH"), # Martyrdom of Fatima + (7, 13, "ALI_BIRTHDAY"), # Birthday of Imam Ali + (8, 15, "IMAM_MAHDI_BIRTHDAY"), # Birthday of Imam Mahdi + (9, 21, "ALI_DEATH"), # Martyrdom of Imam Ali + (10, 25, "SADIQ_DEATH"), # Martyrdom of Imam Sadeq + (12, 18, "EID_AL_GHADIR"), # Eid al-Ghadir ) @@ -59,6 +72,8 @@ def generate_data(): dates = {} for h_year in range(h_year_min, h_year_max + 1): for h_month, h_day, hol_name in ISLAMIC_HOLIDAYS: + if h_day < 0: # days from end of month + h_day = convert.Hijri(h_year, h_month, 1).month_length() + h_day + 1 g_date = convert.Hijri(h_year, h_month, h_day).to_gregorian() g_year = g_date.year if g_year in dates: @@ -81,7 +96,9 @@ def generate_data(): if not dts: continue dt = (f"({d.strftime('%b').upper()}, {d.day})" for d in dts) - dates_str = ", ".join(dt) + ("," if len(dts) < 2 else "") + dates_str = ", ".join(dt) + if len(dts) > 1: + dates_str = f"({dates_str})" year_dates.append(YEAR_TEMPLATE.format(year=year, dates=dates_str)) year_dates_str = "\n".join(year_dates) holiday_data.append( diff --git a/tests/calendars/test_persian.py b/tests/calendars/test_persian.py new file mode 100644 index 000000000..b0308d9c1 --- /dev/null +++ b/tests/calendars/test_persian.py @@ -0,0 +1,45 @@ +# 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 (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +import unittest +from datetime import date + +from holidays.calendars.persian import _Persian + + +class TestPersianCalendar(unittest.TestCase): + def setUp(self): + super().setUpClass() + self.calendar = _Persian() + + def test_year_bounds(self): + self.assertIsNone(self.calendar.new_year_date(1900)) + self.assertIsNone(self.calendar.new_year_date(2101)) + self.assertIsNone(self.calendar.persian_to_gregorian(1900, 2, 2)) + self.assertIsNone(self.calendar.persian_to_gregorian(2101, 3, 3)) + + def test_new_year_date(self): + for year, day in ( + (2033, 20), + (2066, 20), + (2099, 20), + (1904, 21), + (1930, 21), + (1961, 21), + (1963, 21), + (1992, 21), + (2025, 21), + (2058, 21), + (2091, 21), + (1922, 22), + (1959, 22), + ): + self.assertEqual(self.calendar.new_year_date(year), date(year, 3, day)) diff --git a/tests/countries/test_barbados.py b/tests/countries/test_barbados.py new file mode 100644 index 000000000..6abba5276 --- /dev/null +++ b/tests/countries/test_barbados.py @@ -0,0 +1,221 @@ +# 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 (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from holidays.countries.barbados import Barbados, BB, BRB +from tests.common import TestCase + + +class TestBarbados(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass(Barbados, years=range(1969, 2050), years_non_observed=range(2000, 2024)) + + def test_country_aliases(self): + self.assertCountryAliases(Barbados, BB, BRB) + + def test_no_holidays(self): + self.assertNoHolidays(Barbados(years=1968)) + + def test_special_holidays(self): + self.assertHoliday( + "2021-01-04", + "2021-01-05", + "2023-07-31", + ) + + def test_new_years_day(self): + name = "New Year's Day" + self.assertHolidayName(name, (f"{year}-01-01" for year in range(1969, 2050))) + dt = ( + "2006-01-02", + "2012-01-02", + "2017-01-02", + "2023-01-02", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_errol_barrow_day(self): + name = "Errol Barrow Day" + self.assertHolidayName(name, (f"{year}-01-21" for year in range(1989, 2050))) + self.assertNoHoliday(f"{year}-01-21" for year in range(1969, 1989)) + self.assertNoHolidayName(name, range(1969, 1989)) + dt = ( + "2001-01-22", + "2007-01-22", + "2018-01-22", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_good_friday(self): + name = "Good Friday" + self.assertHolidayName( + name, + "2018-03-30", + "2019-04-19", + "2020-04-10", + "2021-04-02", + "2022-04-15", + "2023-04-07", + ) + self.assertHolidayName(name, range(1969, 2050)) + + def test_easter_monday(self): + name = "Easter Monday" + self.assertHolidayName( + name, + "2018-04-02", + "2019-04-22", + "2020-04-13", + "2021-04-05", + "2022-04-18", + "2023-04-10", + ) + self.assertHolidayName(name, range(1969, 2050)) + + def test_national_heroes_day(self): + name = "National Heroes Day" + self.assertHolidayName(name, (f"{year}-04-28" for year in range(1998, 2050))) + self.assertNoHoliday(f"{year}-04-28" for year in range(1969, 1998)) + self.assertNoHolidayName(name, range(1969, 1998)) + dt = ( + "2002-04-29", + "2013-04-29", + "2019-04-29", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_may_day(self): + name = "May Day" + self.assertHolidayName(name, (f"{year}-05-01" for year in range(1969, 2050))) + dt = ( + "2005-05-02", + "2011-05-02", + "2016-05-02", + "2022-05-02", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_whit_monday(self): + name = "Whit Monday" + self.assertHolidayName( + name, + "2018-05-21", + "2019-06-10", + "2020-06-01", + "2021-05-24", + "2022-06-06", + "2023-05-29", + ) + self.assertHolidayName(name, range(1969, 2050)) + + def test_emancipation_day(self): + name = "Emancipation Day" + self.assertHolidayName(name, (f"{year}-08-01" for year in range(1969, 2050))) + dt = ( + "2004-08-03", + "2005-08-02", + "2010-08-03", + "2011-08-02", + "2016-08-02", + "2021-08-03", + "2022-08-02", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_kadooment_day(self): + name = "Kadooment Day" + self.assertHolidayName( + name, + "2018-08-06", + "2019-08-05", + "2020-08-03", + "2021-08-02", + "2022-08-01", + "2023-08-07", + ) + self.assertHolidayName(name, range(1969, 2050)) + + def test_independence_day(self): + name = "Independence Day" + self.assertHolidayName(name, (f"{year}-11-30" for year in range(1969, 2050))) + dt = ( + "2003-12-01", + "2008-12-01", + "2014-12-01", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_christmas_day(self): + name = "Christmas Day" + self.assertHolidayName(name, (f"{year}-12-25" for year in range(1969, 2050))) + dt = ( + "2005-12-27", + "2011-12-27", + "2016-12-27", + "2022-12-27", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_boxing_day(self): + name = "Boxing Day" + self.assertHolidayName(name, (f"{year}-12-26" for year in range(1969, 2050))) + dt = ( + "2004-12-27", + "2010-12-27", + "2021-12-27", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_2022(self): + self.assertHolidays( + Barbados(years=2022), + ("2022-01-01", "New Year's Day"), + ("2022-01-21", "Errol Barrow Day"), + ("2022-04-15", "Good Friday"), + ("2022-04-18", "Easter Monday"), + ("2022-04-28", "National Heroes Day"), + ("2022-05-01", "May Day"), + ("2022-05-02", "May Day (Observed)"), + ("2022-06-06", "Whit Monday"), + ("2022-08-01", "Emancipation Day; Kadooment Day"), + ("2022-08-02", "Emancipation Day (Observed)"), + ("2022-11-30", "Independence Day"), + ("2022-12-25", "Christmas Day"), + ("2022-12-26", "Boxing Day"), + ("2022-12-27", "Christmas Day (Observed)"), + ) + + def test_2023(self): + self.assertHolidays( + Barbados(years=2023), + ("2023-01-01", "New Year's Day"), + ("2023-01-02", "New Year's Day (Observed)"), + ("2023-01-21", "Errol Barrow Day"), + ("2023-04-07", "Good Friday"), + ("2023-04-10", "Easter Monday"), + ("2023-04-28", "National Heroes Day"), + ("2023-05-01", "May Day"), + ("2023-05-29", "Whit Monday"), + ("2023-07-31", "50th Anniversary of CARICOM Holiday"), + ("2023-08-01", "Emancipation Day"), + ("2023-08-07", "Kadooment Day"), + ("2023-11-30", "Independence Day"), + ("2023-12-25", "Christmas Day"), + ("2023-12-26", "Boxing Day"), + ) diff --git a/tests/countries/test_iran.py b/tests/countries/test_iran.py new file mode 100644 index 000000000..d05db322a --- /dev/null +++ b/tests/countries/test_iran.py @@ -0,0 +1,121 @@ +# 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 (c) 2017-2022 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from holidays.countries.iran import Iran, IR, IRN +from tests.common import TestCase + + +class TestIran(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass(Iran) + + def test_country_aliases(self): + self.assertCountryAliases(Iran, IR, IRN) + + def test_no_holidays(self): + self.assertNoHolidays(Iran(years=1979)) + self.assertNoHolidays(Iran(years=2102)) + + def test_2022(self): + self.assertHolidays( + ("2022-01-06", "(تخمین زده*) *کشته‌شدن فاطمه زهرا"), + ("2022-02-11", "پیروزی انقلاب ۵۷"), + ("2022-02-14", "(تخمین زده*) *زادروز علی بن ابی‌طالب"), + ("2022-02-28", "(تخمین زده*) *مبعث"), + ("2022-03-18", "(تخمین زده*) *زادروز حجت بن الحسن"), + ("2022-03-20", "ملی‌شدن صنعت نفت"), + ("2022-03-21", "نوروز"), + ("2022-03-22", "نوروز"), + ("2022-03-23", "نوروز"), + ("2022-03-24", "نوروز"), + ("2022-04-01", "روز جمهوری اسلامی"), + ("2022-04-02", "روز طبیعت"), + ("2022-04-22", "(تخمین زده*) *کشته‌شدن علی بن ابی‌طالب"), + ("2022-05-02", "(تخمین زده*) *عید فطر"), + ("2022-05-03", "(تخمین زده*) *عید فطر"), + ("2022-05-26", "(تخمین زده*) *کشته‌شدن جعفر صادق"), + ("2022-06-04", "درگذشت سید روح‌الله خمینی"), + ("2022-06-05", "تظاهرات ۱۵ خرداد"), + ("2022-07-09", "(تخمین زده*) *عید قربان"), + ("2022-07-17", "(تخمین زده*) *عید غدیر"), + ("2022-08-07", "(تخمین زده*) *تاسوعا"), + ("2022-08-08", "(تخمین زده*) *کشته‌شدن حسین بن علی، عاشورا"), + ("2022-09-16", "(تخمین زده*) *چهلم حسین بن علی اربعین"), + ("2022-09-24", "(تخمین زده*) *کشته‌شدن حسن مجتبی و درگذشت محمد"), + ("2022-09-26", "(تخمین زده*) *کشته‌شدن علی بن موسی الرضا"), + ("2022-10-04", "(تخمین زده*) *کشته‌شدن حسن عسکری"), + ("2022-10-13", "(تخمین زده*) *زادروز محمد و جعفر صادق"), + ("2022-12-27", "(تخمین زده*) *کشته‌شدن فاطمه زهرا"), + ) + + def test_l10n_default(self): + self.assertLocalizedHolidays( + ("2023-02-04", "(تخمین زده*) *زادروز علی بن ابی‌طالب"), + ("2023-02-11", "پیروزی انقلاب ۵۷"), + ("2023-02-18", "(تخمین زده*) *مبعث"), + ("2023-03-07", "(تخمین زده*) *زادروز حجت بن الحسن"), + ("2023-03-20", "ملی‌شدن صنعت نفت"), + ("2023-03-21", "نوروز"), + ("2023-03-22", "نوروز"), + ("2023-03-23", "نوروز"), + ("2023-03-24", "نوروز"), + ("2023-04-01", "روز جمهوری اسلامی"), + ("2023-04-02", "روز طبیعت"), + ("2023-04-12", "(تخمین زده*) *کشته‌شدن علی بن ابی‌طالب"), + ("2023-04-21", "(تخمین زده*) *عید فطر"), + ("2023-04-22", "(تخمین زده*) *عید فطر"), + ("2023-05-15", "(تخمین زده*) *کشته‌شدن جعفر صادق"), + ("2023-06-04", "درگذشت سید روح‌الله خمینی"), + ("2023-06-05", "تظاهرات ۱۵ خرداد"), + ("2023-06-28", "(تخمین زده*) *عید قربان"), + ("2023-07-06", "(تخمین زده*) *عید غدیر"), + ("2023-07-27", "(تخمین زده*) *تاسوعا"), + ("2023-07-28", "(تخمین زده*) *کشته‌شدن حسین بن علی، عاشورا"), + ("2023-09-05", "(تخمین زده*) *چهلم حسین بن علی اربعین"), + ("2023-09-13", "(تخمین زده*) *کشته‌شدن حسن مجتبی و درگذشت محمد"), + ("2023-09-15", "(تخمین زده*) *کشته‌شدن علی بن موسی الرضا"), + ("2023-09-23", "(تخمین زده*) *کشته‌شدن حسن عسکری"), + ("2023-10-02", "(تخمین زده*) *زادروز محمد و جعفر صادق"), + ("2023-12-16", "(تخمین زده*) *کشته‌شدن فاطمه زهرا"), + ) + + def test_l10n_en_us(self): + self.assertLocalizedHolidays( + "en_US", + ("2023-02-04", "Birthday of Ali* (*estimated)"), + ("2023-02-11", "Islamic Revolution Day"), + ("2023-02-18", "Ascension of Muhammad* (*estimated)"), + ("2023-03-07", "Birthday of Mahdi* (*estimated)"), + ("2023-03-20", "Iranian Oil Industry Nationalization Day"), + ("2023-03-21", "Persian New Year"), + ("2023-03-22", "Persian New Year"), + ("2023-03-23", "Persian New Year"), + ("2023-03-24", "Persian New Year"), + ("2023-04-01", "Islamic Republic Day"), + ("2023-04-02", "Nature's Day"), + ("2023-04-12", "Martyrdom of Ali* (*estimated)"), + ("2023-04-21", "Eid al-Fitr* (*estimated)"), + ("2023-04-22", "Eid al-Fitr* (*estimated)"), + ("2023-05-15", "Martyrdom of Ja'far al-Sadiq* (*estimated)"), + ("2023-06-04", "Death of Khomeini"), + ("2023-06-05", "Khordad National Uprising"), + ("2023-06-28", "Eid al-Adha* (*estimated)"), + ("2023-07-06", "Eid al-Ghadeer* (*estimated)"), + ("2023-07-27", "Tasua* (*estimated)"), + ("2023-07-28", "Ashura* (*estimated)"), + ("2023-09-05", "Arbaeen* (*estimated)"), + ("2023-09-13", "Demise of Prophet Muhammad and Hasan ibn Ali* (*estimated)"), + ("2023-09-15", "Martyrdom of Ali al-Rida* (*estimated)"), + ("2023-09-23", "Martyrdom of Hasan al-Askari* (*estimated)"), + ("2023-10-02", "Birthday of Muhammad and Ja'far al-Sadiq* (*estimated)"), + ("2023-12-16", "Martyrdom of Fatima* (*estimated)"), + ) diff --git a/tests/countries/test_saudi_arabia.py b/tests/countries/test_saudi_arabia.py index b81ab191a..361ebdbc3 100644 --- a/tests/countries/test_saudi_arabia.py +++ b/tests/countries/test_saudi_arabia.py @@ -75,13 +75,13 @@ def test_national_day_observed(self): self.assertNoNonObservedHoliday(dt) def test_national_day_overlaps_hijri_holiday(self): - for dt in ( + self.assertNoHolidayName( + "اليوم الوطني", "2009-09-23", "2015-09-23", "2048-09-23", "2074-09-23", - ): - self.assertNotIn("اليوم الوطني", self.holidays[dt]) + ) def test_founding_day(self): self.assertHoliday(f"{year}-02-22" for year in range(2022, 2050)) @@ -98,7 +98,7 @@ def test_founding_day_observed(self): self.assertNoNonObservedHoliday(dt) def test_founding_day_overlaps_hijri_holiday(self): - self.assertNotIn("اليوم الوطني", self.holidays["2061-02-22"]) + self.assertNoHolidayName("اليوم الوطني", "2061-02-22") def test_hijri_based(self): self.assertHoliday( @@ -129,7 +129,7 @@ def test_hijri_based_observed(self): # observed eid al-fitr "2018-06-19", "2018-06-20", - "2019-06-08", + "2019-06-09", "2021-05-17", "2021-05-18", "2023-04-25", @@ -141,7 +141,7 @@ def test_hijri_based_observed(self): "2020-08-04", "2022-07-12", "2022-07-13", - "2023-07-01", + "2023-07-02", ) self.assertHoliday(dt) self.assertNoNonObservedHoliday(dt) @@ -175,13 +175,13 @@ def test_l10n_default(self): ("2023-04-22", "(تقدير*) *عطلة عيد الفطر"), ("2023-04-23", "(تقدير*) *عطلة عيد الفطر"), ("2023-04-24", "(تقدير*) *عطلة عيد الفطر"), - ("2023-04-25", "(ملاحظة) عطلة عيد الفطر"), - ("2023-04-26", "(ملاحظة) عطلة عيد الفطر"), + ("2023-04-25", "(ملاحظة) (تقدير*) *عطلة عيد الفطر"), + ("2023-04-26", "(ملاحظة) (تقدير*) *عطلة عيد الفطر"), ("2023-06-27", "(تقدير*) *يوم عرفة"), ("2023-06-28", "(تقدير*) *عطلة عيد الأضحى"), ("2023-06-29", "(تقدير*) *عطلة عيد الأضحى"), ("2023-06-30", "(تقدير*) *عطلة عيد الأضحى"), - ("2023-07-01", "(ملاحظة) عطلة عيد الأضحى"), + ("2023-07-02", "(ملاحظة) (تقدير*) *عطلة عيد الأضحى"), ("2023-09-23", "اليوم الوطني"), ("2023-09-24", "(ملاحظة) اليوم الوطني"), ) @@ -194,13 +194,13 @@ def test_l10n_en_us(self): ("2023-04-22", "Eid al-Fitr Holiday* (*estimated)"), ("2023-04-23", "Eid al-Fitr Holiday* (*estimated)"), ("2023-04-24", "Eid al-Fitr Holiday* (*estimated)"), - ("2023-04-25", "Eid al-Fitr Holiday (observed)"), - ("2023-04-26", "Eid al-Fitr Holiday (observed)"), + ("2023-04-25", "Eid al-Fitr Holiday* (*estimated) (observed)"), + ("2023-04-26", "Eid al-Fitr Holiday* (*estimated) (observed)"), ("2023-06-27", "Arafat Day* (*estimated)"), ("2023-06-28", "Eid al-Adha Holiday* (*estimated)"), ("2023-06-29", "Eid al-Adha Holiday* (*estimated)"), ("2023-06-30", "Eid al-Adha Holiday* (*estimated)"), - ("2023-07-01", "Eid al-Adha Holiday (observed)"), + ("2023-07-02", "Eid al-Adha Holiday* (*estimated) (observed)"), ("2023-09-23", "National Day Holiday"), ("2023-09-24", "National Day Holiday (observed)"), ) diff --git a/tests/countries/test_singapore.py b/tests/countries/test_singapore.py index 538d9388f..c37935a72 100644 --- a/tests/countries/test_singapore.py +++ b/tests/countries/test_singapore.py @@ -149,11 +149,12 @@ def test_2023(self): self.assertIn(date(2023, 6, 2), self.holidays) self.assertIn(date(2023, 6, 29), self.holidays) self.assertIn(date(2023, 8, 9), self.holidays) + self.assertIn(date(2023, 9, 1), self.holidays) self.assertIn(date(2023, 11, 12), self.holidays) self.assertIn(date(2023, 11, 13), self.holidays) self.assertIn(date(2023, 12, 25), self.holidays) - # 2023: total holidays (11 + 3 falling on a Sunday) - self.assertEqual(len(Singapore(years=[2023])), 11 + 3) + # 2023: total holidays (11 + 3 falling on a Sunday + Polling Day) + self.assertEqual(len(Singapore(years=[2023])), 11 + 3 + 1) def test_non_observed(self): self.assertNotIn(date(2023, 1, 2), Singapore(observed=False, years=2023)) diff --git a/tests/countries/test_slovenia.py b/tests/countries/test_slovenia.py index e44acf792..482dca026 100644 --- a/tests/countries/test_slovenia.py +++ b/tests/countries/test_slovenia.py @@ -24,6 +24,12 @@ def test_country_aliases(self): def test_no_holidays(self): self.assertNoHolidays(Slovenia(years=1990)) + def test_special_holidays(self): + self.assertHoliday( + # Solidarity Day + "2023-08-14", + ) + def test_new_years_day(self): name = "novo leto" self.assertHolidayName(name, (f"{year}-01-01" for year in range(1991, 2050))) diff --git a/tests/countries/test_vanuatu.py b/tests/countries/test_vanuatu.py new file mode 100644 index 000000000..52395b97c --- /dev/null +++ b/tests/countries/test_vanuatu.py @@ -0,0 +1,218 @@ +# 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 (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +from holidays.countries.vanuatu import Vanuatu, VU, VTU +from tests.common import TestCase + + +class TestVanuatu(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass(Vanuatu, years=range(1981, 2050), years_non_observed=range(2000, 2024)) + + def test_country_aliases(self): + self.assertCountryAliases(Vanuatu, VU, VTU) + + def test_no_holidays(self): + self.assertNoHolidays(Vanuatu(years=1980)) + + def test_special_holidays(self): + self.assertHoliday( + "2020-07-23", + "2020-07-27", + "2020-07-28", + "2020-07-29", + "2020-07-31", + "2022-10-13", + ) + + def test_new_years_day(self): + name = "New Year's Day" + self.assertHolidayName(name, (f"{year}-01-01" for year in range(1981, 2050))) + dt = ( + "2006-01-02", + "2012-01-02", + "2017-01-02", + "2023-01-02", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_father_lini_day(self): + name = "Father Lini Day" + self.assertHolidayName(name, (f"{year}-02-21" for year in range(1999, 2050))) + self.assertNoHolidayName(name, range(1981, 1999)) + self.assertNoHoliday(f"{year}-02-21" for year in range(1981, 1999)) + dt = ( + "2010-02-22", + "2016-02-22", + "2021-02-22", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_custom_chiefs_day(self): + name = "Custom Chief's Day" + self.assertHolidayName(name, (f"{year}-03-05" for year in range(1981, 2050))) + dt = ( + "2000-03-06", + "2006-03-06", + "2017-03-06", + "2023-03-06", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_good_friday(self): + name = "Good Friday" + self.assertHolidayName( + name, + "2018-03-30", + "2019-04-19", + "2020-04-10", + "2021-04-02", + "2022-04-15", + "2023-04-07", + ) + self.assertHolidayName(name, range(1981, 2050)) + + def test_easter_monday(self): + name = "Easter Monday" + self.assertHolidayName( + name, + "2018-04-02", + "2019-04-22", + "2020-04-13", + "2021-04-05", + "2022-04-18", + "2023-04-10", + ) + self.assertHolidayName(name, range(1981, 2050)) + + def test_labour_day(self): + name = "Labour Day" + self.assertHolidayName(name, (f"{year}-05-01" for year in range(1981, 2050))) + dt = ( + "2005-05-02", + "2011-05-02", + "2016-05-02", + "2022-05-02", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_ascension_day(self): + name = "Ascension Day" + self.assertHolidayName( + name, + "2018-05-10", + "2019-05-30", + "2020-05-21", + "2021-05-13", + "2022-05-26", + "2023-05-18", + ) + self.assertHolidayName(name, range(1981, 2050)) + + def test_childrens_day(self): + name = "Children's Day" + self.assertHolidayName(name, (f"{year}-07-24" for year in range(1981, 2050))) + dt = ( + "2005-07-25", + "2011-07-25", + "2016-07-25", + "2022-07-25", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_independence_day(self): + name = "Independence Day" + self.assertHolidayName(name, (f"{year}-07-30" for year in range(1981, 2050))) + dt = ( + "2000-07-31", + "2006-07-31", + "2017-07-31", + "2023-07-31", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_assumption_day(self): + name = "Assumption Day" + self.assertHolidayName(name, (f"{year}-08-15" for year in range(1981, 2050))) + dt = ( + "2004-08-16", + "2010-08-16", + "2021-08-16", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_constitution_day(self): + name = "Constitution Day" + self.assertHolidayName(name, (f"{year}-10-05" for year in range(1981, 2050))) + dt = ( + "2003-10-06", + "2008-10-06", + "2014-10-06", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_unity_day(self): + name = "Unity Day" + self.assertHolidayName(name, (f"{year}-11-29" for year in range(1981, 2050))) + dt = ( + "2009-11-30", + "2015-11-30", + "2020-11-30", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_christmas_day(self): + self.assertHolidayName("Christmas Day", (f"{year}-12-25" for year in range(1981, 2050))) + + def test_family_day(self): + name = "Family Day" + self.assertHolidayName(name, (f"{year}-12-26" for year in range(1981, 2050))) + dt = ( + "2005-12-27", + "2011-12-27", + "2016-12-27", + "2022-12-27", + ) + self.assertHolidayName(f"{name} (Observed)", dt) + self.assertNoNonObservedHoliday(dt) + + def test_2022(self): + self.assertHolidays( + Vanuatu(years=2022), + ("2022-01-01", "New Year's Day"), + ("2022-02-21", "Father Lini Day"), + ("2022-03-05", "Custom Chief's Day"), + ("2022-04-15", "Good Friday"), + ("2022-04-18", "Easter Monday"), + ("2022-05-01", "Labour Day"), + ("2022-05-02", "Labour Day (Observed)"), + ("2022-05-26", "Ascension Day"), + ("2022-07-24", "Children's Day"), + ("2022-07-25", "Children's Day (Observed)"), + ("2022-07-30", "Independence Day"), + ("2022-08-15", "Assumption Day"), + ("2022-10-05", "Constitution Day"), + ("2022-10-13", "Election Day"), + ("2022-11-29", "Unity Day"), + ("2022-12-25", "Christmas Day"), + ("2022-12-26", "Family Day"), + ("2022-12-27", "Family Day (Observed)"), + ) diff --git a/tests/test_holiday_groups.py b/tests/test_holiday_groups.py index 8c6d19749..aad813129 100644 --- a/tests/test_holiday_groups.py +++ b/tests/test_holiday_groups.py @@ -11,8 +11,8 @@ from unittest import TestCase +from holidays.groups import ChristianHolidays, InternationalHolidays from holidays.holiday_base import HolidayBase -from holidays.holiday_groups import ChristianHolidays, InternationalHolidays class TestChristianHolidays(TestCase): diff --git a/tests/test_l10n.py b/tests/test_l10n.py new file mode 100644 index 000000000..8c053f0f6 --- /dev/null +++ b/tests/test_l10n.py @@ -0,0 +1,68 @@ +# 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 (c) 2017-2023 +# ryanss (c) 2014-2017 +# Website: https://github.com/dr-prodigy/python-holidays +# License: MIT (see LICENSE file) + +import re +import unittest +from pathlib import Path + +from polib import pofile as create_po_file + +import holidays + + +class TestLocalization(unittest.TestCase): + def test_localization(self): + tests_dir = Path(__file__).parent + locale_dir = tests_dir.parent / "holidays" / "locale" + + for po_path in sorted(Path(locale_dir).rglob("*.po")): + try: + po_file = create_po_file(po_path, check_for_duplicates=True) + except ValueError as e: + # Make sure no duplicated entries added. + match = re.match(r"Entry (.*) already exists", str(e)) + self.assertEqual( + 0, + len(match.groups()), + f"Entry `{match.group(1)}` already exists in {po_path}. " + "Please remove the duplicate.", + ) + + raise e + + # Collect `` part from + # holidays/locale//LC_MESSAGES/.po. + entity_code = po_path.stem + # Collect `` part from + # holidays/locale//LC_MESSAGES/.po. + language = po_path.parts[-3] + + entity = getattr(holidays, entity_code) + + # Skip original language files. + if entity.default_language == language: + continue + + # Make sure no entries left unlocalized. + coverage = po_file.percent_translated() + self.assertEqual( + 100, + coverage, + f"The {entity_code} {language} localization is incomplete ({coverage}% < 100%)", + ) + + # Make sure no obsolete entries left. + obsolete_entries = po_file.obsolete_entries() + self.assertFalse( + obsolete_entries, + f"The {entity_code} {language} localization contains obsolete entries: " + f"{', '.join((oe.msgid for oe in obsolete_entries))}", + ) diff --git a/tox.ini b/tox.ini index 00044a3ac..c5364d4f5 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ requires = env_list = docs pre-commit - python3.{11, 10, 9, 8, 12.0-beta.4} + python3.{12, 11, 10, 9, 8} skip_missing_interpreters = true [testenv]