python-holidays icon indicating copy to clipboard operation
python-holidays copied to clipboard

Add festival descriptions and info retrieval method

Open yadav-krish opened this issue 3 months ago โ€ข 7 comments

Added descriptions for various Hindu festivals and a method to retrieve festival information.

Proposed change

Your PR description goes here.

Type of change

  • [ ] New country/market holidays support (thank you!)
  • [ ] Supported country/market holidays update (calendar discrepancy fix, localization)
  • [ ] Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • [ ] Dependency update (version deprecation/pin/upgrade)
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] Breaking change (a code change causing existing functionality to break)
  • [x] New feature (new holidays functionality in general)

Checklist

  • [x] I've read and followed the contributing guidelines.
  • [x] I've run make check locally; all checks and tests passed.

yadav-krish avatar Sep 26 '25 10:09 yadav-krish

[!NOTE]

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • New Features
    • Added ability to look up Hindu festival information for India by name and year, returning the observed date and a human-readable description.
    • Name matching is case-insensitive to make searches more forgiving.
    • Includes curated descriptions for major festivals with a sensible fallback when none is available.

Walkthrough

Adds a module-level festival descriptions mapping and a single method _HinduLunisolar.get_festival_info(festival_name: str, year: int) that performs a case-insensitive lookup against the India calendar for the year and returns (date, description) or None.

Changes

Cohort / File(s) Change Summary
Hindu calendar enhancements
holidays/calendars/hindu.py
- Added FESTIVAL_DESCRIPTIONS mapping of festival keys to descriptions
- Added _HinduLunisolar.get_festival_info(festival_name: str, year: int) to build an India calendar for the year, match festival name case-insensitively, and return (date, description) or None

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

Suggested reviewers

  • PPsyrius
  • arkid15r

Pre-merge checks and finishing touches

โœ… Passed checks (3 passed)
Check name Status Explanation
Title Check โœ… Passed The title succinctly captures the primary addition of festival descriptions and the new info retrieval method in the changeset without extraneous details.
Description Check โœ… Passed The description directly relates to the changeset by stating the addition of festival descriptions and the retrieval method, so it is not off-topic despite containing template placeholders.
Docstring Coverage โœ… Passed No functions found in the changes. Docstring coverage check skipped.
โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate Docstrings
๐Ÿงช Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

๐Ÿ“œ Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 1dbbbc630e39a89a92fe3fc2182bb7324f0ebbc7 and f4881392be5d2cff5568a334a11f737f759d5617.

๐Ÿ“’ Files selected for processing (1)
  • holidays/calendars/hindu.py (2 hunks)
๐Ÿงฐ Additional context used
๐Ÿง  Learnings (20)
๐Ÿ““ Common learnings
Learnt from: KJhellico
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:146-179
Timestamp: 2025-06-14T20:12:37.212Z
Learning: The `_CustomHinduHolidays` mechanism works through `_CustomCalendarType` metaclass which renames public attributes (like `DIWALI_INDIA_DATES`) with a postfix, allowing `_HinduLunisolar::_get_holiday` to find and use custom holiday dates. When `_add_diwali_india()` is called, it uses the custom dates if available rather than calculated dates.
Learnt from: KJhellico
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:146-179
Timestamp: 2025-06-14T20:12:37.212Z
Learning: The `_CustomHinduHolidays` mechanism works through `_CustomCalendarType` metaclass which renames public attributes (like `DIWALI_INDIA_DATES`) with a postfix, allowing `_HinduLunisolar::_get_holiday` to find and use custom holiday dates. When `_add_diwali_india()` is called, it uses the custom dates if available rather than calculated dates.
Learnt from: PPsyrius
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.
๐Ÿ“š Learning: 2025-06-14T20:12:37.212Z
Learnt from: KJhellico
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:146-179
Timestamp: 2025-06-14T20:12:37.212Z
Learning: The `_CustomHinduHolidays` mechanism works through `_CustomCalendarType` metaclass which renames public attributes (like `DIWALI_INDIA_DATES`) with a postfix, allowing `_HinduLunisolar::_get_holiday` to find and use custom holiday dates. When `_add_diwali_india()` is called, it uses the custom dates if available rather than calculated dates.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
PR: vacanza/holidays#2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-11T13:48:45.953Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: holidays/calendars/ethiopian.py:13-13
Timestamp: 2025-08-11T13:48:45.953Z
Learning: The holidays library does not use `__all__` declarations in calendar modules (holidays/calendars/). Calendar files follow a standard pattern of defining constants and functions directly without explicit exports, similar to the convention used in country modules.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-06-10T12:43:10.577Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2601
File: holidays/calendars/mongolian.py:1-1
Timestamp: 2025-06-10T12:43:10.577Z
Learning: The holidays project's calendar files (in holidays/calendars/) follow a consistent pattern of NOT having module-level docstrings. They only use class-level docstrings for their main classes. When reviewing calendar files, maintain this consistency and do not suggest adding module docstrings.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-04-03T12:36:41.201Z
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
    # Holiday name
    self._add_holiday_function(tr("Holiday Name"))
```

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-09-18T07:01:12.236Z
Learnt from: PPsyrius
PR: vacanza/holidays#2942
File: holidays/countries/south_africa.py:91-98
Timestamp: 2025-09-18T07:01:12.236Z
Learning: In the holidays library South Africa implementation, inline ternary operators for holiday name selection (like "Republic Day" if self._year >= 1961 else "Union Day") are intentionally kept inline rather than extracted to separate variables, as this structure is designed in preparation for future localization (l10n) support where the contextual relationship between conditions and translatable strings needs to be preserved.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-06-06T14:40:31.932Z
Learnt from: KJhellico
PR: vacanza/holidays#2593
File: holidays/countries/senegal.py:66-110
Timestamp: 2025-06-06T14:40:31.932Z
Learning: In the holidays library, within the _populate_public_holidays method, holidays should be arranged by calendar type (Islamic holidays first, then Gregorian holidays) without additional type grouping comments. The organization by calendar type is sufficient and follows the project's established conventions.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-06-04T10:09:28.732Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2593
File: holidays/calendars/islamic.py:3993-3994
Timestamp: 2025-06-04T10:09:28.732Z
Learning: In the holidays/calendars/islamic.py file, the Islamic calendar date methods in the _IslamicLunar class (like ali_al_rida_death_dates, ashura_dates, etc.) follow a consistent pattern of being single-line methods that return self._get_holiday(CONSTANT, year) without docstrings. New methods should follow this same pattern for consistency.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
PR: vacanza/holidays#2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
PR: vacanza/holidays#2774
File: tests/countries/test_liberia.py:15-16
Timestamp: 2025-08-08T14:37:03.045Z
Learning: In holidays/countries/__init__.py, re-export country classes using absolute imports (e.g., 'from holidays.countries.liberia import Liberia, LR, LBR') and keep alphabetical ordering (e.g., Lesotho, Liberia, Libya). Avoid relative imports in this file.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-20T19:46:15.625Z
Learnt from: KJhellico
PR: vacanza/holidays#2833
File: tests/countries/test_uganda.py:15-0
Timestamp: 2025-08-20T19:46:15.625Z
Learning: In the holidays project, the standard import pattern for country test files is `from holidays.countries.<country> import Country, CODE1, CODE2` (direct module import), used by ~75% of country test files. Only a minority (~25%) use the aggregated public API import `from holidays.countries import Country, CODE1, CODE2`. The direct module import pattern should be used for new country test files to follow the established convention.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-09T18:31:23.218Z
Learnt from: KJhellico
PR: vacanza/holidays#2778
File: tests/countries/test_kiribati.py:15-15
Timestamp: 2025-08-09T18:31:23.218Z
Learning: In the holidays project test files, the standard import pattern is `from holidays.countries.<country> import Country, CODE1, CODE2` (used in ~97% of test files), not `from holidays.countries import Country, CODE1, CODE2`. Only a few exceptions (Suriname, Sierra Leone, Mauritius, Mali, Ivory Coast, Guyana) use the aggregated import pattern.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
PR: vacanza/holidays#2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-26T14:43:53.605Z
Learnt from: KJhellico
PR: vacanza/holidays#2851
File: docs/holiday_categories.md:272-282
Timestamp: 2025-08-26T14:43:53.605Z
Learning: In the holidays library documentation, it's strongly advisable to recommend the use of constants from holidays.constants (e.g., PUBLIC, CATHOLIC) instead of direct string values when specifying holiday categories, as constants provide better type safety, IDE support, and prevent typos.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-09-04T08:54:35.319Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_albania.py:40-42
Timestamp: 2025-09-04T08:54:35.319Z
Learning: In the vacanza/holidays project test files, extract holiday name strings to local variables only when they are reused multiple times within the same test method (e.g., used in both assertHolidayName and assertNoHolidayName calls). When a holiday name is used only once, keep it inline rather than extracting it to a variable for the sake of consistency.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-08-11T10:14:28.517Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: holidays/groups/christian.py:328-343
Timestamp: 2025-08-11T10:14:28.517Z
Learning: For Ethiopian holidays in the `holidays/groups/christian.py` file, docstring wording should maintain source-accurate phrasing (e.g., "in coincidence of" for Ethiopian New Year/Enkutatash), even when it might read awkwardly in English, to ensure consistency with official Ethiopian documentation.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿ“š Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • holidays/calendars/hindu.py
๐Ÿงฌ Code graph analysis (1)
holidays/calendars/hindu.py (2)
holidays/countries/india.py (1)
  • India (28-507)
holidays/holiday_base.py (1)
  • get (949-972)
๐Ÿ”‡ Additional comments (2)
holidays/calendars/hindu.py (2)

49-78: Reference the declared constants

Switch these dict keys over to the constants defined just above so the identifiers stay in lockstep.

-FESTIVAL_DESCRIPTIONS = {
-    "BUDDHA_PURNIMA": "Buddha Purnima marks the birth, enlightenment and death of Lord Buddha.",
-    "CHHATH_PUJA": "Chhath Puja is dedicated to the Sun God and Chhathi Maiya for health and prosperity.",
-    "DIWALI": "Diwali, the festival of lights, celebrates the victory of good over evil and light over darkness.",
-    "DIWALI_INDIA": "Diwali as celebrated in India, symbolizing prosperity and light.",
-    "DUSSEHRA": "Dussehra celebrates the victory of Lord Rama over the demon king Ravana.",
-    "GANESH_CHATURTHI": "Ganesh Chaturthi celebrates the birth of Lord Ganesha.",
-    "GOVARDHAN_PUJA": "Govardhan Puja marks the day Lord Krishna lifted the Govardhan Hill to protect villagers.",
-    "GUDI_PADWA": "Gudi Padwa is the Maharashtrian New Year festival marking the arrival of spring.",
-    "GURU_GOBIND_SINGH_JAYANTI": "Birth anniversary of Guru Gobind Singh Ji, the 10th Sikh Guru.",
-    "GURU_NANAK_JAYANTI": "Birth anniversary of Guru Nanak Dev Ji, founder of Sikhism.",
-    "GYALPO_LOSAR": "Gyalpo Losar is the Tibetan New Year festival celebrated by Sherpa and Tibetan communities.",
-    "HOLI": "Holi, the festival of colours, celebrates the arrival of spring and the triumph of good over evil.",
-    "JANMASHTAMI": "Janmashtami marks the birth of Lord Krishna.",
-    "MAHA_ASHTAMI": "Maha Ashtami is the eighth day of Navratri dedicated to Goddess Durga.",
-    "MAHA_NAVAMI": "Maha Navami is the ninth day of Navratri, honouring Goddess Durga.",
-    "MAHA_SHIVARATRI": "Maha Shivaratri is dedicated to Lord Shiva.",
-    "MAHAVIR_JAYANTI": "Mahavir Jayanti marks the birth of Lord Mahavira, the 24th Tirthankara of Jainism.",
-    "MAKAR_SANKRANTI": "Makar Sankranti marks the sunโ€™s transit into Capricorn, celebrated with kite flying.",
-    "ONAM": "Onam is Keralaโ€™s harvest festival celebrating the homecoming of King Mahabali.",
-    "PONGAL": "Pongal is Tamil Naduโ€™s harvest festival dedicated to the Sun God.",
-    "RAKSHA_BANDHAN": "Raksha Bandhan celebrates the bond between brothers and sisters.",
-    "RAM_NAVAMI": "Ram Navami marks the birth of Lord Rama.",
-    "SHARAD_NAVRATRI": "Sharad Navratri is the nine-day festival dedicated to Goddess Durga.",
-    "SONAM_LOSAR": "Sonam Losar is the Tibetan New Year celebrated by Tamang and Tibetan communities.",
-    "TAMU_LOSAR": "Tamu Losar is the New Year festival of the Gurung community.",
-    "THAIPUSAM": "Thaipusam is a Tamil festival dedicated to Lord Murugan.",
-    "VAISAKHI": "Vaisakhi marks the Sikh New Year and the harvest festival of Punjab.",
-}
+FESTIVAL_DESCRIPTIONS = {
+    BUDDHA_PURNIMA: "Buddha Purnima marks the birth, enlightenment and death of Lord Buddha.",
+    CHHATH_PUJA: "Chhath Puja is dedicated to the Sun God and Chhathi Maiya for health and prosperity.",
+    DIWALI: "Diwali, the festival of lights, celebrates the victory of good over evil and light over darkness.",
+    DIWALI_INDIA: "Diwali as celebrated in India, symbolizing prosperity and light.",
+    DUSSEHRA: "Dussehra celebrates the victory of Lord Rama over the demon king Ravana.",
+    GANESH_CHATURTHI: "Ganesh Chaturthi celebrates the birth of Lord Ganesha.",
+    GOVARDHAN_PUJA: "Govardhan Puja marks the day Lord Krishna lifted the Govardhan Hill to protect villagers.",
+    GUDI_PADWA: "Gudi Padwa is the Maharashtrian New Year festival marking the arrival of spring.",
+    GURU_GOBIND_SINGH_JAYANTI: "Birth anniversary of Guru Gobind Singh Ji, the 10th Sikh Guru.",
+    GURU_NANAK_JAYANTI: "Birth anniversary of Guru Nanak Dev Ji, founder of Sikhism.",
+    GYALPO_LOSAR: "Gyalpo Losar is the Tibetan New Year festival celebrated by Sherpa and Tibetan communities.",
+    HOLI: "Holi, the festival of colours, celebrates the arrival of spring and the triumph of good over evil.",
+    JANMASHTAMI: "Janmashtami marks the birth of Lord Krishna.",
+    MAHA_ASHTAMI: "Maha Ashtami is the eighth day of Navratri dedicated to Goddess Durga.",
+    MAHA_NAVAMI: "Maha Navami is the ninth day of Navratri, honouring Goddess Durga.",
+    MAHA_SHIVARATRI: "Maha Shivaratri is dedicated to Lord Shiva.",
+    MAHAVIR_JAYANTI: "Mahavir Jayanti marks the birth of Lord Mahavira, the 24th Tirthankara of Jainism.",
+    MAKAR_SANKRANTI: "Makar Sankranti marks the sunโ€™s transit into Capricorn, celebrated with kite flying.",
+    ONAM: "Onam is Keralaโ€™s harvest festival celebrating the homecoming of King Mahabali.",
+    PONGAL: "Pongal is Tamil Naduโ€™s harvest festival dedicated to the Sun God.",
+    RAKSHA_BANDHAN: "Raksha Bandhan celebrates the bond between brothers and sisters.",
+    RAM_NAVAMI: "Ram Navami marks the birth of Lord Rama.",
+    SHARAD_NAVRATRI: "Sharad Navratri is the nine-day festival dedicated to Goddess Durga.",
+    SONAM_LOSAR: "Sonam Losar is the Tibetan New Year celebrated by Tamang and Tibetan communities.",
+    TAMU_LOSAR: "Tamu Losar is the New Year festival of the Gurung community.",
+    THAIPUSAM: "Thaipusam is a Tamil festival dedicated to Lord Murugan.",
+    VAISAKHI: "Vaisakhi marks the Sikh New Year and the harvest festival of Punjab.",
+}

1522-1542: Fix festival lookup logic

Right now this never surfaces the descriptions: matching uses the localized name (โ€œBuddha Purnimaโ€), but the dictionary lookup asks for festival_name.upper() โ†’ โ€œBUDDHA PURNIMAโ€ (space), so every hit falls back to โ€œNo description available.โ€ On top of that, instantiating holidays.India with default categories omits most of these festivals (Holi, Ganesh Chaturthi, etc.), so youโ€™ll usually return None even though the calendar data is in this class. Letโ€™s reuse the canonical keys and the existing _get_holiday/_get_holiday_set helpers instead.

-    def get_festival_info(self, festival_name: str, year: int):
-        """
-        Returns the date and description of the festival for the given year.
-
-        Args:
-            festival_name (str): Name of the festival.
-            year (int): Year to look up.
-
-        Returns:
-            tuple: (date, description) if found, else None.
-        """
-        import holidays  # Local import for this method only
-        cal = holidays.India(years=year)
-        # Many holiday classes return 'Diwali' as 'Diwali' not 'DIWALI', so compare case-insensitively:
-        for dt, name in cal.items():
-            if name.lower() == festival_name.lower():
-                desc = FESTIVAL_DESCRIPTIONS.get(festival_name.upper(), "No description available.")
-                return dt, desc
-        return None  # festival not found for that year
+    def get_festival_info(self, festival_name: str, year: int):
+        """
+        Returns the date and description of the festival for the given year.
+
+        Args:
+            festival_name (str): Canonical festival key (e.g. "DIWALI").
+            year (int): Year to look up.
+
+        Returns:
+            tuple: (date, description) if found, else None.
+        """
+        key = festival_name.strip().upper()
+        desc = FESTIVAL_DESCRIPTIONS.get(key)
+        if desc is None:
+            return None
+
+        if key == GURU_GOBIND_SINGH_JAYANTI:
+            dates = [dt for dt, _ in self._get_holiday_set(key, year)]
+            if not dates:
+                return None
+            return min(dates), desc
+
+        dt, _ = self._get_holiday(key, year)
+        if dt is None:
+            return None
+        return dt, desc

[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

๐Ÿ”ง Ruff (0.13.1)
holidays/calendars/hindu.py

[1;31mruff failed[0m [1mCause:[0m Failed to load configuration /ruff.toml [1mCause:[0m Failed to parse /ruff.toml [1mCause:[0m TOML parse error at line 26, column 3 | 26 | "RSE100", # Use of assert detected | ^^^^^^^^ Unknown rule selector: RSE100


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 26 '25 10:09 coderabbitai[bot]

First of all, I doubt the utility of this feature. And even if it's to be implemented, the calendar class is not the right place for it.

KJhellico avatar Sep 26 '25 14:09 KJhellico

As @KJhellico says - I'm not really sure about the current implementation as well.

The concept itself is not that bad, I can see them being utilized by iCal or Home Assistant integration for example - but this could probably use a more standardized approach (i.e. DIWALI and DIWALI_INDIA should've yielded the same output as they're the same festival, just held on different date) and some test cases at the very least.

PPsyrius avatar Sep 27 '25 11:09 PPsyrius

I am thinking about the concept of HOLIDAY_ID as one of the attributes of the Holiday object (within the context of #1712). For example, it will have value NEW_YEARS_DAY for the holiday on January 1 (and, if present, January 2); LUNAR_NEW_YEAR for all days of the Chinese New Year; EID_AL_FITR for all days of Eid al-Fitr; possibly INDEPENDENCE_DAY for the country's independence holiday, regardless of its date; DIWALI for Diwali, regardless of its date, etc. Then, by creating a mapping {HOLIDAY_ID: HOLIDAY_DESCRIPTION}, it will be convenient to obtain a description of the holiday for iCal and other applications.

KJhellico avatar Sep 27 '25 12:09 KJhellico

I have made the changes like removing the line "import holidays" which i had done globally. I have also included self parameter inside the get_festival_info function which I had forgotten earlier.

yadav-krish avatar Sep 27 '25 13:09 yadav-krish

@yadav-krish, can you show a example of using your code?

KJhellico avatar Sep 27 '25 15:09 KJhellico

Abandoned.

arkid15r avatar Dec 18 '25 17:12 arkid15r