8000 Add Niger holidays by Abheelash-Mishra · Pull Request #2583 · vacanza/holidays · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 13 commits into from
Jun 3, 2025
Merged

Add Niger holidays #2583

merged 13 commits into from
Jun 3, 2025

Conversation

Abheelash-Mishra
Copy link
Contributor

Proposed change

Added support for Niger.
Closes #1235

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)
  • New feature (new holidays functionality in general)

Checklist

@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 19:48
Copy link
Contributor
coderabbitai bot commented May 30, 2025

Summary by CodeRabbit

  • New Features

    • Added support for Niger public holidays, including both public and optional holiday categories.
    • Introduced localization for Niger holidays in French and English.
    • Niger holiday calendar now available with accurate national, Christian, and Islamic holidays, including observed and estimated date handling.
  • Documentation

    • Updated documentation to include Niger as a supported country with relevant details.
  • Tests

    • Added comprehensive tests to ensure correct holiday dates, observed rules, and localization for Niger.

Summary by CodeRabbit

  • New Features

    • Added support for Niger public holidays, including both public and optional holidays, with accurate observance and localization.
    • Introduced aliases for Niger using country codes NE and NER.
  • Localization

    • Added French (fr_NE) and English (en_US) translations for all Niger holidays.
  • Documentation

    • Updated documentation to reflect Niger as a supported country.
  • Tests

    • Introduced comprehensive tests to ensure correct holiday calculations and localization for Niger.

Walkthrough

A 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

Files/Paths Change Summary
holidays/countries/niger.py New module: Defines Niger holidays, Islamic holiday mappings, and aliases.
holidays/countries/init.py, holidays/registry.py Added Niger imports and registry entry.
holidays/locale/en_US/LC_MESSAGES/NE.po Added English localization for Niger holidays.
holidays/locale/fr_NE/LC_MESSAGES/NE.po Added French localization for Niger holidays.
README.md Updated supported country count and added Niger to the list.
tests/countries/test_niger.py New test suite: Validates Niger holiday definitions, observed rules, aliases, and localization.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Add Niger holidays (#1235)
Add Niger-specific localization (#1235)
Add tests for Niger holidays (#1235)
Update documentation for Niger (#1235)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Possibly related PRs

  • Add Benin holidays #2562: Adds Benin holidays support with a similar structure, making it a parallel addition of a country-specific holiday module.

Suggested reviewers

  • PPsyrius
  • KJhellico

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 128493d and 67428b7.

📒 Files selected for processing (3)
  • README.md (2 hunks)
  • holidays/countries/__init__.py (1 hunks)
  • holidays/registry.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
holidays/countries/__init__.py (1)
holidays/countries/niger.py (3)
  • Niger (36-156)
  • NE (315-316)
  • NER (319-320)
🔇 Additional comments (4)
holidays/countries/__init__.py (1)

135-135: Proper integration of Niger import

Good work maintaining alphabetical order and following the established import pattern. The Niger class and its aliases are correctly imported.

holidays/registry.py (1)

143-143: Registry entry correctly added

The Niger registry entry follows the established pattern perfectly with proper key format and ISO codes.

README.md (2)

108-108: Country count correctly updated

Proper increment from 182 to 183 countries to reflect Niger addition.


990-995: Niger documentation accurately reflects implementation

The table entry correctly documents Niger's supported languages with French as default, proper country code, and OPTIONAL holiday category support.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor
@Copilot Copilot AI left a 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 its Language: header set to ha; this should be updated to en_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 in test_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)

Copy link
Contributor
@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between d7d2f27 and ace38d3.

📒 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 line from .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 header Language: ha is correct, and leaving the msgstr entries empty ensures Hausa—being the source language—falls back to the original msgid.

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.py

Length 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.py

Length 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.py

Length 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 the obs_dt list for test_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.

Copy link
codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (927ce94) to head (67428b7).
Report is 1 commits behind head on dev.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor
@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 449f6b0 and 0e1e24a.

📒 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 issue

Critical issue: All French translations are empty.

The msgstr entries are empty throughout the file, which means no French translations will be displayed. Since the msgid entries contain French text, the msgstr 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.

Copy link
Contributor
@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0e1e24a and 6da82ca.

📒 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 for islamic_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.

Copy link
Collaborator
@KJhellico KJhellico left a 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.

Copy link
Collaborator
@KJhellico KJhellico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The finishing touches.

PPsyrius
PPsyrius previously approved these changes Jun 3, 2025
Copy link
Collaborator
@PPsyrius PPsyrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🇳🇪

KJhellico
KJhellico previously approved these changes Jun 3, 2025
Copy link
Collaborator
@KJhellico KJhellico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@arkid15r arkid15r dismissed stale reviews from KJhellico and PPsyrius via 67428b7 June 3, 2025 18:59
Copy link
sonarqubecloud bot commented Jun 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
9.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@arkid15r arkid15r enabled auto-merge June 3, 2025 19:08
Copy link
Collaborator
@arkid15r arkid15r left a 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

@arkid15r arkid15r added this pull request to the merge queue Jun 3, 2025
Merged via the queue into vacanza:dev with commit 9f5bd55 Jun 3, 2025
32 of 33 checks passed
@Abheelash-Mishra Abheelash-Mishra deleted the add-niger branch June 4, 2025 04:19
@KJhellico KJhellico mentioned this pull request Jun 6, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Niger holidays
4 participants
0