-
-
Notifications
You must be signed in to change notification settings - Fork 539
Add Niger holidays #2583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Niger holidays #2583
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughA new Niger holidays module was added, including the country class, registry entry, imports, localization files (French and English), and comprehensive tests. Documentation was updated to reflect support for Niger. No changes were made to existing logic for other countries. Changes
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code Graph Analysis (1)holidays/countries/__init__.py (1)
🔇 Additional comments (4)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Niger in the holidays library, including calendar logic, localization, tests, and documentation updates.
- Implements
holidays/countries/niger.py
with public holiday definitions (Christian and Islamic) and observed rules. - Provides Hausa and US English translations and registers the country in the registry and
__init__.py
. - Adds comprehensive tests in
tests/countries/test_niger.py
and updates the README to include Niger.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/countries/test_niger.py | New test suite covering Niger holidays |
holidays/registry.py | Register “niger” entry in country registry |
holidays/locale/ha/LC_MESSAGES/NE.po | Add Hausa (ha) translations for Niger |
holidays/locale/en_US/LC_MESSAGES/NE.po | Add US English (en_US) translations for Niger |
holidays/countries/niger.py | Implement Niger holiday rules and calendar |
holidays/countries/init.py | Import Niger , NE , and NER aliases |
README.md | Increment country count and insert Niger row |
Comments suppressed due to low confidence (3)
holidays/locale/en_US/LC_MESSAGES/NE.po:22
- The PO file under
en_US
still has itsLanguage:
header set toha
; this should be updated toen_US
.
"Language: ha"
tests/countries/test_niger.py:107
- After 1998, Pentecost always falls on Sunday and should be observed the next Monday. Consider adding an assertion for
"Fentikos (lura)"
on a sample observed date (e.g.,2020-06-01
).
self.assertNoHolidayName(f"{name} (lura)", range(1959, 1998))
tests/countries/test_niger.py:328
- The secondary holiday
Hutun Eid al-Adha
isn’t directly tested intest_eid_al_adha
. Add assertions to verify it appears on the correct dates (and its observed form) in this test.
self.assertNoNonObservedHolidayName(name, obs_dt)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
README.md
(2 hunks)holidays/countries/__init__.py
(1 hunks)holidays/countries/niger.py
(1 hunks)holidays/locale/en_US/LC_MESSAGES/NE.po
(1 hunks)holidays/locale/ha/LC_MESSAGES/NE.po
(1 hunks)holidays/registry.py
(1 hunks)tests/countries/test_niger.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
holidays/locale/en_US/LC_MESSAGES/NE.po (1)
Learnt from: KJhellico
PR: vacanza/holidays#2388
File: holidays/locale/en_CI/LC_MESSAGES/CI.po:88-88
Timestamp: 2025-03-30T18:25:07.087Z
Learning: In the holidays library, localization files have a specific structure: message comments are in standard English (en_US) describing the holiday, while actual translations (msgstr) should use the locale-specific terminology (e.g., en_CI for Ivory Coast English). For example, "Night of Power" in standard English is translated as "Lailatou-Kadr" in Ivory Coast English.
🧬 Code Graph Analysis (2)
holidays/countries/__init__.py (1)
holidays/countries/niger.py (3)
Niger
(35-150)NE
(309-310)NER
(313-314)
tests/countries/test_niger.py (2)
tests/common.py (7)
TestCase
(28-338)CommonCountryTests
(356-374)assertAliases
(121-130)assertNoHolidays
(292-294)assertHolidayName
(195-199)assertNoHolidayName
(273-275)assertLocalizedHolidays
(327-338)holidays/countries/niger.py (3)
Niger
(35-150)NE
(309-310)NER
(313-314)
🪛 Pylint (3.3.7)
tests/countries/test_niger.py
[convention] 1-1: Missing module docstring
(C0114)
[convention] 19-19: Missing class docstring
(C0115)
[warning] 21-21: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestNiger.setUpClass' method
(W0221)
[convention] 26-26: Missing function or method docstring
(C0116)
[convention] 29-29: Missing function or method docstring
(C0116)
[convention] 32-32: Missing function or method docstring
(C0116)
[convention] 44-44: Missing function or method docstring
(C0116)
[convention] 57-57: Missing function or method docstring
(C0116)
[convention] 70-70: Missing function or method docstring
(C0116)
[convention] 82-82: Missing function or method docstring
(C0116)
[convention] 95-95: Missing function or method docstring
(C0116)
[convention] 109-109: Missing function or method docstring
(C0116)
[convention] 119-119: Missing function or method docstring
(C0116)
[convention] 141-141: Missing function or method docstring
(C0116)
[convention] 161-161: Missing function or method docstring
(C0116)
[convention] 182-182: Missing function or method docstring
(C0116)
[convention] 203-203: Missing function or method docstring
(C0116)
[convention] 224-224: Missing function or method docstring
(C0116)
[convention] 245-245: Missing function or method docstring
(C0116)
[convention] 266-266: Missing function or method docstring
(C0116)
[convention] 288-288: Missing function or method docstring
(C0116)
[convention] 310-310: Missing function or method docstring
(C0116)
[convention] 330-330: Missing function or method docstring
(C0116)
[convention] 354-354: Missing function or method docstring
(C0116)
[refactor] 19-19: Too many public methods (22/20)
(R0904)
holidays/countries/niger.py
[convention] 39-39: Line too long (136/100)
(C0301)
[convention] 40-40: Line too long (112/100)
(C0301)
[convention] 45-45: Line too long (122/100)
(C0301)
[convention] 46-46: Line too long (122/100)
(C0301)
[convention] 48-48: Line too long (133/100)
(C0301)
[convention] 49-49: Line too long (134/100)
(C0301)
[convention] 50-50: Line too long (141/100)
(C0301)
[convention] 1-1: Missing module docstring
(C0114)
[warning] 71-71: Keyword argument before variable positional arguments list in the definition of init function
(W1113)
[convention] 153-153: Missing class docstring
(C0115)
[convention] 309-309: Missing class docstring
(C0115)
[convention] 313-313: Missing class docstring
(C0115)
🔇 Additional comments (10)
holidays/countries/__init__.py (1)
133-133
: Imported Niger module in alphabetical order.
The linefrom .niger import Niger, NE, NER
correctly follows the existing pattern and is placed between Nicaragua and Nigeria.holidays/registry.py (1)
141-141
: Registered Niger in the country registry.
The entry"niger": ("Niger", "NE", "NER")
is added and alphabetically positioned between Nicaragua and Nigeria, ensuring the loader can discover the new country.README.md (2)
108-108
: Updated supported countries count.
The total has been incremented to 181, matching the newly added Niger entry.
977-982
: Added Niger to the country table.
The<tr>
block for Niger (NE) with English and Hausa support is correctly inserted in alphabetical order and aligns with the module defaults.holidays/locale/ha/LC_MESSAGES/NE.po (1)
22-22
: Hausa localization placeholders.
The headerLanguage: ha
is correct, and leaving themsgstr
entries empty ensures Hausa—being the source language—falls back to the originalmsgid
.tests/countries/test_niger.py (4)
26-28
: Test implementation looks good.The country aliases test correctly verifies NE and NER as valid aliases for Niger.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 26-26: Missing function or method docstring
(C0116)
29-31
: Correctly tests boundary condition.The test properly verifies that no holidays exist before Niger's independence year (1959).
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 29-29: Missing function or method docstring
(C0116)
330-377
: Comprehensive localization tests.Both Hausa and English localization tests thoroughly cover various holiday types including observed holidays. The test data for 2025 is well-chosen.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 330-330: Missing function or method docstring
(C0116)
[convention] 354-354: Missing function or method docstring
(C0116)
324-324
:❓ Verification inconclusive
Verify the commented test date.
There's a commented date for 1985. Was this intentionally excluded or should it be uncommented?
🏁 Script executed:
#!/bin/bash # Check if 1985 is within the valid year range for Eid al-Adha holidays rg -A 2 -B 2 "1985" holidays/countries/niger.pyLength of output: 47
Let’s pull in the surrounding test to see why that 1985 date was commented out.
🏁 Script executed:
#!/bin/bash # Show context around the commented date in the Eid al-Adha test rg -n "test_eid_al_adha" -A5 -B5 tests/countries/test_niger.pyLength of output: 463
Let’s locate that commented date in the test for full context:
🏁 Script executed:
#!/bin/bash # Show the lines around the commented 1985-07-01 in the Eid al-Adha test rg -n '"1985-07-01"' -C3 tests/countries/test_niger.pyLength of output: 346
Confirm the commented “1985-07-01” in test_eid_al_adha
I didn’t find any static entry for 1985 in
holidays/countries/niger.py
, so it appears that year isn’t covered by our dataset. Please verify whether we should include"1985-07-01"
in theobs_dt
list fortest_eid_al_adha
or remove the commented line if it’s intentionally excluded.• File: tests/countries/test_niger.py, lines 323–326
• Context:obs_dt = ( # "1985-07-01", "2014-10-06", )holidays/countries/niger.py (1)
87-151
: Holiday implementation is thorough and correct.The method properly implements all holidays with appropriate year conditions. Christian movable holidays that don't fall on Sunday (Easter Monday, Ascension Thursday) correctly don't use observed rules.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2583 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 226 227 +1
Lines 14409 14470 +61
Branches 2020 2027 +7
=========================================
+ Hits 14409 14470 +61 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (3)
holidays/countries/niger.py (3)
159-159
: 🧹 Nitpick (assertive)Add docstring to NigerIslamicHolidays class.
Consider adding a class docstring explaining the purpose of this custom Islamic holidays class.
class NigerIslamicHolidays(_CustomIslamicHolidays): + """Custom Islamic holiday dates specific to Niger. + + These dates are based on official observations in Niger and may differ + from calculated dates. Some years contain multiple dates when a holiday + occurs twice in the same calendar year. + """ EID_AL_ADHA_DATES = {🧰 Tools
🪛 Pylint (3.3.7)
[convention] 159-159: Missing class docstring
(C0115)
315-316
: 🧹 Nitpick (assertive)Add docstring to alias class NE.
Add a brief docstring for consistency.
class NE(Niger): + """Niger holidays (ISO 3166-1 alpha-2 country code).""" pass
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 315-315: Missing class docstring
(C0115)
319-320
: 🧹 Nitpick (assertive)Add docstring to alias class NER.
Add a brief docstring for consistency.
class NER(Niger): + """Niger holidays (ISO 3166-1 alpha-3 country code).""" pass
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 319-319: Missing class docstring
(C0115)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
README.md
(2 hunks)holidays/countries/niger.py
(1 hunks)holidays/locale/en_US/LC_MESSAGES/NE.po
(1 hunks)holidays/locale/fr/LC_MESSAGES/NE.po
(1 hunks)tests/countries/test_niger.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
tests/countries/test_niger.py (1)
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.
holidays/locale/en_US/LC_MESSAGES/NE.po (1)
Learnt from: KJhellico
PR: vacanza/holidays#2388
File: holidays/locale/en_CI/LC_MESSAGES/CI.po:88-88
Timestamp: 2025-03-30T18:25:07.087Z
Learning: In the holidays library, localization files have a specific structure: message comments are in standard English (en_US) describing the holiday, while actual translations (msgstr) should use the locale-specific terminology (e.g., en_CI for Ivory Coast English). For example, "Night of Power" in standard English is translated as "Lailatou-Kadr" in Ivory Coast English.
holidays/countries/niger.py (1)
Learnt from: PPsyrius
PR: vacanza/holidays#2583
File: holidays/countries/niger.py:71-71
Timestamp: 2025-05-31T03:21:53.248Z
Learning: In the holidays Python library, the standard pattern for country class __init__ methods is to have keyword arguments with defaults before *args and **kwargs, such as `def __init__(self, islamic_show_estimated: bool = True, *args, **kwargs):`. This pattern is used consistently across all country implementations and should not be flagged as an issue.
🧬 Code Graph Analysis (1)
tests/countries/test_niger.py (2)
tests/common.py (9)
TestCase
(28-338)CommonCountryTests
(356-374)assertAliases
(121-130)assertNoHolidays
(292-294)assertHolidayName
(195-199)assertNoNonObservedHoliday
(248-250)assertNoHolidayName
(273-275)assertNoNonObservedHolidayName
(277-279)assertLocalizedHolidays
(327-338)holidays/countries/niger.py (3)
Niger
(36-156)NE
(315-316)NER
(319-320)
🪛 Pylint (3.3.7)
tests/countries/test_niger.py
[convention] 1-1: Missing module docstring
(C0114)
[convention] 20-20: Missing class docstring
(C0115)
[warning] 22-22: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestNiger.setUpClass' method
(W0221)
[convention] 28-28: Missing function or method docstring
(C0116)
[convention] 31-31: Missing function or method docstring
(C0116)
[convention] 34-34: Missing function or method docstring
(C0116)
[convention] 46-46: Missing function or method docstring
(C0116)
[convention] 59-59: Missing function or method docstring
(C0116)
[convention] 72-72: Missing function or method docstring
(C0116)
[convention] 84-84: Missing function or method docstring
(C0116)
[convention] 98-98: Missing function or method docstring
(C0116)
[convention] 112-112: Missing function or method docstring
(C0116)
[convention] 122-122: Missing function or method docstring
(C0116)
[convention] 136-136: Missing function or method docstring
(C0116)
[convention] 149-149: Missing function or method docstring
(C0116)
[convention] 163-163: Missing function or method docstring
(C0116)
[convention] 175-175: Missing function or method docstring
(C0116)
[convention] 187-187: Missing function or method docstring
(C0116)
[convention] 207-207: Missing function or method docstring
(C0116)
[convention] 228-228: Missing function or method docstring
(C0116)
[convention] 250-250: Missing function or method docstring
(C0116)
[convention] 272-272: Missing function or method docstring
(C0116)
[convention] 289-289: Missing function or method docstring
(C0116)
[convention] 313-313: Missing function or method docstring
(C0116)
[refactor] 20-20: Too many public methods (22/20)
(R0904)
holidays/countries/niger.py
[convention] 40-40: Line too long (136/100)
(C0301)
[convention] 41-41: Line too long (112/100)
(C0301)
[convention] 42-42: Line too long (135/100)
(C0301)
[convention] 44-44: Line too long (136/100)
(C0301)
[convention] 46-46: Line too long (122/100)
(C0301)
[convention] 47-47: Line too long (122/100)
(C0301)
[convention] 48-48: Line too long (128/100)
(C0301)
[convention] 49-49: Line too long (133/100)
(C0301)
[convention] 50-50: Line too long (134/100)
(C0301)
[convention] 1-1: Missing module docstring
(C0114)
[warning] 72-72: Keyword argument before variable positional arguments list in the definition of init function
(W1113)
[convention] 159-159: Missing class docstring
(C0115)
[convention] 315-315: Missing class docstring
(C0115)
[convention] 319-319: Missing class docstring
(C0115)
🔇 Additional comments (11)
README.md (2)
108-108
: Documentation correctly updated for new country addition.The count increment from 180 to 181 countries accurately reflects the addition of Niger support.
977-982
: Niger country entry is properly formatted and comprehensive.The table entry follows the established pattern and correctly specifies:
- Code: NE
- Languages: en_US, fr (with French as default)
- Categories: OPTIONAL
- No subdivisions or aliases
This aligns with the implementation in the Niger holidays module.
holidays/locale/fr/LC_MESSAGES/NE.po (1)
31-118
:⚠️ Potential issueCritical issue: All French translations are empty.
The
msgstr
entries are empty throughout the file, which means no French translations will be displayed. Since themsgid
entries contain French text, themsgstr
entries should contain the same French text or appropriate French localizations.Apply this pattern throughout the file:
#. New Year's Day. msgid "Jour de l'An" -msgstr "" +msgstr "Jour de l'An" #. Easter Monday. msgid "Lundi de Pâques" -msgstr "" +msgstr "Lundi de Pâques"Continue this pattern for all holiday translations in the file.
⛔ Skipped due to learnings
Learnt from: KJhellico PR: vacanza/holidays#2394 File: holidays/locale/pt_PT/LC_MESSAGES/CV.po:31-88 Timestamp: 2025-03-31T19:37:57.691Z Learning: In the holidays library, when a locale file matches the country's default language (e.g., pt_PT for Cape Verde), the msgstr fields should be left empty. Only non-default language files should have filled msgstr fields with translations.
Learnt from: PPsyrius PR: vacanza/holidays#2388 File: holidays/locale/fr/LC_MESSAGES/CI.po:28-101 Timestamp: 2025-03-30T13:33:31.598Z Learning: In the holidays library, for localization files of the default language (like French for Ivory Coast in fr/LC_MESSAGES/CI.po), the best practice is to leave the message strings (msgstr) empty to avoid possible typos, since the message IDs (msgid) are already in the target language.
Learnt from: KJhellico PR: vacanza/holidays#2394 File: holidays/locale/pt_PT/LC_MESSAGES/CV.po:31-88 Timestamp: 2025-03-31T19:37:57.691Z Learning: In the holidays library localization pattern, when a locale file matches a country's default language (e.g., pt_PT for Cape Verde), the msgstr fields should be left empty. Only non-default language locale files should have translations in the msgstr fields.
Learnt from: KJhellico PR: vacanza/holidays#2259 File: holidays/locale/en_IN/LC_MESSAGES/IN.po:30-299 Timestamp: 2025-03-05T17:51:00.633Z Learning: In the Holidays project, .po files for a country's default locale use empty msgstr fields as a standard convention.
holidays/locale/en_US/LC_MESSAGES/NE.po (1)
31-118
: English translations are comprehensive and accurate.The translations properly convert French holiday names to standard English equivalents:
- "Jour de l'An" → "New Year's Day"
- "Lundi de Pâques" → "Easter Monday"
- "Korité" → "Eid al-Fitr"
- "Tabaski" → "Eid al-Adha"
The formatting strings for observed and estimated holidays are also correctly translated.
tests/countries/test_niger.py (4)
20-26
: Excellent test setup with comprehensive coverage.The test class properly extends
CommonCountryTests
and sets up multiple holiday instances for different scenarios:
- Standard holidays with observed rules
- Holidays without estimated Islamic dates
- Optional category holidays
This enables thorough testing of all holiday behaviors.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 20-20: Missing class docstring
(C0115)
[warning] 22-22: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestNiger.setUpClass' method
(W0221)
[refactor] 20-20: Too many public methods (22/20)
(R0904)
34-185
: Well-structured individual holiday tests following best practices.Each test method focuses on a specific holiday and properly validates:
- Holiday presence across appropriate year ranges
- Observed date handling when holidays fall on weekends
- Absence of holidays before their introduction dates
- Proper French holiday names
The test structure by individual holidays rather than by years aligns with project conventions.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 34-34: Missing function or method docstring
(C0116)
[convention] 46-46: Missing function or method docstring
(C0116)
[convention] 59-59: Missing function or method docstring
(C0116)
[convention] 72-72: Missing function or method docstring
(C0116)
[convention] 84-84: Missing function or method docstring
(C0116)
[convention] 98-98: Missing function or method docstring
(C0116)
[convention] 112-112: Missing function or method docstring
(C0116)
[convention] 122-122: Missing function or method docstring
(C0116)
[convention] 136-136: Missing function or method docstring
(C0116)
[convention] 149-149: Missing function or method docstring
(C0116)
[convention] 163-163: Missing function or method docstring
(C0116)
[convention] 175-175: Missing function or method docstring
(C0116)
187-287
: Thorough Islamic holiday testing with proper date verification.The Islamic holiday tests appropriately:
- Use
no_estimated_holidays
instance to get precise dates- Verify specific dates across multiple years
- Test observed date handling for weekend holidays
- Cover all Islamic holidays defined in the Niger implementation
The date verification for Islamic holidays demonstrates good understanding of their movable nature.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 187-187: Missing function or method docstring
(C0116)
[convention] 207-207: Missing function or method docstring
(C0116)
[convention] 228-228: Missing function or method docstring
(C0116)
[convention] 250-250: Missing function or method docstring
(C0116)
[convention] 272-272: Missing function or method docstring
(C0116)
289-336
: Comprehensive localization testing validates both French and English translations.The localization tests effectively verify:
- Default French holiday names match the locale file
- English translations are properly applied
- Complex scenarios like multiple holidays on the same date
- Observed holiday naming conventions in both languages
This ensures the locale files work correctly with the holiday implementation.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 289-289: Missing function or method docstring
(C0116)
[convention] 313-313: Missing function or method docstring
(C0116)
holidays/countries/niger.py (3)
36-86
: Well-structured class implementation.The Niger class is properly designed with clear documentation, correct inheritance, and appropriate initialization of p 9E81 arent classes. The observed holiday rules are correctly configured.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 40-40: Line too long (136/100)
(C0301)
[convention] 41-41: Line too long (112/100)
(C0301)
[convention] 42-42: Line too long (135/100)
(C0301)
[convention] 44-44: Line too long (136/100)
(C0301)
[convention] 46-46: Line too long (122/100)
(C0301)
[convention] 47-47: Line too long (122/100)
(C0301)
[convention] 48-48: Line too long (128/100)
(C0301)
[convention] 49-49: Line too long (133/100)
(C0301)
[convention] 50-50: Line too long (134/100)
(C0301)
[warning] 72-72: Keyword argument before variable positional arguments list in the definition of init function
(W1113)
88-144
: Comprehensive public holidays implementation.All public holidays are correctly added with appropriate observed rules applied. The handling of Islamic holidays with multiple occurrences per year is properly implemented.
145-157
:✅ Verification successful
Verify optional holidays are correctly categorized.
Based on past review feedback, these holidays should be classified as OPTIONAL category. Please ensure they appear in the OPTIONAL category when queried.
🏁 Script executed:
#!/bin/bash # Verify that optional holidays are properly categorized ast-grep --pattern $'def _populate_optional_holidays(self): $$$'Length of output: 26671
Confirmation of Optional Category Logic
I checked the implementation: all four holidays in
holidays/countries/niger.py:_populate_optional_holidays()
are indeed added inside the_populate_optional_holidays
hook, so by design they belong to the OPTIONAL category—regardless of whether they’re wrapped with_add_observed
or not.No further changes needed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
holidays/countries/niger.py (2)
313-319
: 🧹 Nitpick (assertive)Add docstrings to alias classes.
Documenting these one-liner subclasses improves readability and consistency across the library.class NE(Niger): - pass + """Niger holidays (ISO 3166-1 alpha-2 country code).""" + pass class NER(Niger): - pass + """Niger holidays (ISO 3166-1 alpha-3 country code).""" + pass🧰 Tools
🪛 Pylint (3.3.7)
[convention] 314-314: Missing class docstring
(C0115)
[convention] 318-318: Missing class docstring
(C0115)
158-158
: 🧹 Nitpick (assertive)Add docstring to
NigerIslamicHolidays
.
Including a brief class-level docstring will clarify that this subclass contains the hard-coded Gregorian mappings for Niger’s Islamic holidays.class NigerIslamicHolidays(_CustomIslamicHolidays): + """Custom mapping of Islamic holiday dates specific to Niger.""" EID_AL_ADHA_DATES = {
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 158-158: Missing class docstring
(C0115)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
README.md
(2 hunks)holidays/countries/niger.py
(1 hunks)holidays/locale/en_US/LC_MESSAGES/NE.po
(1 hunks)holidays/locale/fr_NE/LC_MESSAGES/NE.po
(1 hunks)tests/countries/test_niger.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
holidays/locale/en_US/LC_MESSAGES/NE.po (1)
Learnt from: KJhellico
PR: vacanza/holidays#2388
File: holidays/locale/en_CI/LC_MESSAGES/CI.po:88-88
Timestamp: 2025-03-30T18:25:07.087Z
Learning: In the holidays library, localization files have a specific structure: message comments are in standard English (en_US) describing the holiday, while actual translations (msgstr) should use the locale-specific terminology (e.g., en_CI for Ivory Coast English). For example, "Night of Power" in standard English is translated as "Lailatou-Kadr" in Ivory Coast English.
tests/countries/test_niger.py (1)
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.
holidays/countries/niger.py (1)
Learnt from: PPsyrius
PR: vacanza/holidays#2583
File: holidays/countries/niger.py:71-71
Timestamp: 2025-05-31T03:21:53.248Z
Learning: In the holidays Python library, the standard pattern for country class __init__ methods is to have keyword arguments with defaults before *args and **kwargs, such as `def __init__(self, islamic_show_estimated: bool = True, *args, **kwargs):`. This pattern is used consistently across all country implementations and should not be flagged as an issue.
🧬 Code Graph Analysis (1)
tests/countries/test_niger.py (2)
tests/common.py (8)
TestCase
(28-338)CommonCountryTests
(356-374)assertAliases
(121-130)assertNoHolidays
(292-294)assertHolidayName
(195-199)assertNoNonObservedHoliday
(248-250)assertNoHolidayName
(273-275)assertLocalizedHolidays
(327-338)holidays/countries/niger.py (3)
Niger
(36-155)NE
(314-315)NER
(318-319)
🪛 Pylint (3.3.7)
tests/countries/test_niger.py
[convention] 1-1: Missing module docstring
(C0114)
[convention] 20-20: Missing class docstring
(C0115)
[warning] 22-22: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestNiger.setUpClass' method
(W0221)
[convention] 31-31: Missing function or method docstring
(C0116)
[convention] 34-34: Missing function or method docstring
(C0116)
[convention] 37-37: Missing function or method docstring
(C0116)
[convention] 50-50: Missing function or method docstring
(C0116)
[convention] 63-63: Missing function or method docstring
(C0116)
[convention] 77-77: Missing function or method docstring
(C0116)
[convention] 90-90: Missing function or method docstring
(C0116)
[convention] 105-105: Missing function or method docstring
(C0116)
[convention] 120-120: Missing function or method docstring
(C0116)
[convention] 133-133: Missing function or method docstring
(C0116)
[convention] 148-148: Missing function or method docstring
(C0116)
[convention] 163-163: Missing function or method docstring
(C0116)
[convention] 179-179: Missing function or method docstring
(C0116)
[convention] 192-192: Missing function or method docstring
(C0116)
[convention] 205-205: Missing function or method docstring
(C0116)
[convention] 225-225: Missing function or method docstring
(C0116)
[convention] 246-246: Missing function or method docstring
(C0116)
[convention] 267-267: Missing function or method docstring
(C0116)
[convention] 289-289: Missing function or method docstring
(C0116)
[convention] 303-303: Missing function or method docstring
(C0116)
[convention] 320-320: Missing function or method docstring
(C0116)
[convention] 344-344: Missing function or method docstring
(C0116)
[refactor] 20-20: Too many public methods (23/20)
(R0904)
holidays/countries/niger.py
[convention] 40-40: Line too long (136/100)
(C0301)
[convention] 41-41: Line too long (112/100)
(C0301)
[convention] 42-42: Line too long (135/100)
(C0301)
[convention] 44-44: Line too long (136/100)
(C0301)
[convention] 46-46: Line too long (122/100)
(C0301)
[convention] 47-47: Line too long (122/100)
(C0301)
[convention] 48-48: Line too long (128/100)
(C0301)
[convention] 49-49: Line too long (133/100)
(C0301)
[convention] 50-50: Line too long (134/100)
(C0301)
[convention] 1-1: Missing module docstring
(C0114)
[warning] 72-72: Keyword argument before variable positional arguments list in the definition of init function
(W1113)
[convention] 158-158: Missing class docstring
(C0115)
[convention] 314-314: Missing class docstring
(C0115)
[convention] 318-318: Missing class docstring
(C0115)
🔇 Additional comments (20)
README.md (2)
108-108
: LGTM! Country count updated correctly.The total country count has been properly incremented from 180 to 181 to reflect the addition of Niger.
977-982
: Niger entry looks well-structured and consistent.The entry follows the established format with:
- Correct ISO code (NE)
- No subdivisions listed (appropriate for Niger)
- Proper language support (en_US, fr_NE with fr_NE as default)
- OPTIONAL category specified
This aligns well with the implementation in the Niger holidays module.
holidays/locale/fr_NE/LC_MESSAGES/NE.po (2)
15-28
: Localization headers are properly configured.The PO file headers correctly identify this as the French (fr_NE) localization for Niger holidays. The metadata fields are appropriately set with the right project details and language code.
29-118
: Holiday translations are comprehensive and well-structured.The file covers all necessary Niger holidays including:
- National holidays (New Year's, Independence Day, etc.)
- Christian holidays (Easter Monday, Christmas, etc.)
- Islamic holidays (Eid al-Fitr, Eid al-Adha, etc.)
- Formatting strings for observed and estimated annotations
The French names look accurate and follow proper localization conventions. Empty msgstr fields are correct for the source language file.
holidays/locale/en_US/LC_MESSAGES/NE.po (2)
15-28
: Headers correctly configured for English localization.The PO file headers properly identify this as English (en_US) localization for Niger holidays. Good to see the Language field is correctly set to "en_US" as noted in past review comments.
29-118
: English translations are accurate and complete.The translations provide proper English equivalents for all Niger holidays:
- French holiday names correctly translated to standard English terms
- Islamic holiday names preserved appropriately (e.g., "Laylat al-Qadr")
- Local terms like "Korité" → "Eid al-Fitr" and "Tabaski" → "Eid al-Adha" properly handled
- Formatting strings correctly translated
The translations maintain consistency with other country localizations in the library.
tests/countries/test_niger.py (7)
20-30
: Test setup is comprehensive and well-structured.The test class properly initializes multiple holiday instances to test different scenarios:
- Standard holidays with observed rules
- No estimated Islamic holidays variant
- Optional holidays category
- Optional holidays without observation
This provides thorough coverage for all Niger holiday functionality.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 20-20: Missing class docstring
(C0115)
[warning] 22-22: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestNiger.setUpClass' method
(W0221)
[refactor] 20-20: Too many public methods (23/20)
(R0904)
31-32
: Alias testing follows established pattern.Correctly verifies that NE and NER are proper aliases for the Niger class.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 31-31: Missing function or method docstring
(C0116)
34-35
: Pre-independence year testing is appropriate.Good validation that no holidays exist for 1958, confirming the start_year implementation is working correctly.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 34-34: Missing function or method docstring
(C0116)
37-61
: Holiday tests follow recommended structure.The tests properly focus on individual holidays and test them across multiple years, following the established patterns. The observed holiday testing with specific dates is thorough and the range checks ensure comprehensive coverage.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 37-37: Missing function or method docstring
(C0116)
[convention] 50-50: Missing function or method docstring
(C0116)
90-103
: Optional holiday testing is well-implemented.Correctly verifies that Ascension Day only appears in optional holidays category, not in the default public holidays. The date validation across multiple years is comprehensive.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 90-90: Missing function or method docstring
(C0116)
320-342
: Default localization testing is thorough.The test validates French holiday names (default language) with a comprehensive set of dates from 2025, including observed holidays and multi-holiday dates like "2025-06-09" with both "Lendemain de la Tabaski (observé)" and "Lundi de Pentecôte".
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 320-320: Missing function or method docstring
(C0116)
344-367
: English localization testing mirrors the structure well.Validates all English translations with the same comprehensive date set, ensuring both language variants work correctly. The translations match the expected English names from the localization file.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 344-344: Missing function or method docstring
(C0116)
holidays/countries/niger.py (7)
1-12
: Module header is standard.
The file-level comments and license header align with existing country modules and project conventions.🧰 Tools
🪛 Pylint (3.3.7)
[convention] 1-1: Missing module docstring
(C0114)
13-34
: Imports organization looks comprehensive and consistent with other country modules. The explicit import of month and weekday constants ensures clarity in the holiday definitions.
36-56
: Class docstring provides clear context and authoritative references for Niger’s holiday rules. The list of sources will aid future maintainers in verifying and updating holiday rules.🧰 Tools
🪛 Pylint (3.3.7)
[convention] 40-40: Line too long (136/100)
(C0301)
[convention] 41-41: Line too long (112/100)
(C0301)
[convention] 42-42: Line too long (135/100)
(C0301)
[convention] 44-44: Line too long (136/100)
(C0301)
[convention] 46-46: Line too long (122/100)
(C0301)
[convention] 47-47: Line too long (122/100)
(C0301)
[convention] 48-48: Line too long (128/100)
(C0301)
[convention] 49-49: Line too long (133/100)
(C0301)
[convention] 50-50: Line too long (134/100)
(C0301)
58-71
: Class metadata settings (country code, languages, categories, labels, start year, weekend) are correctly defined and follow the library’s patterns.
72-87
: Constructor initialization properly initializes each holiday group and applies the observed rule defaults. The parameter ordering forislamic_show_estimated
is consistent with the library’s conventions.🧰 Tools
🪛 Pylint (3.3.7)
[warning] 72-72: Keyword argument before variable positional arguments list in the definition of init function
(W1113)
88-136
: Public holidays population implements fixed, movable Christian, and international holidays correctly with appropriate year-gated conditions and observed handling.
144-156
: Optional holidays population correctly adds Ascension, Whit Monday, and applies observed handling for Assumption and All Saints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's final suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more CEB7 a>.
The finishing touches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🇳🇪
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this 👍
LGTM
Proposed change
Added support for Niger.
Closes #1235
Type of change
holidays
functionality in general)Checklist
make check
, all checks and tests are green