+
Skip to content

Conversation

MRAshaz
Copy link

@MRAshaz MRAshaz commented Apr 6, 2025

Proposed change

Resolves #1203.

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 April 6, 2025 13:52
Copy link
Contributor

coderabbitai bot commented Apr 6, 2025

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive holiday management for Iraq, covering various holiday frameworks and providing multiple alias options.
    • Expanded supported country information to include Iraq, with detailed language and country code support.
    • Added localization entries in both Arabic and English for Iraqi holidays.
  • Documentation

    • Updated contributor credits and the supported countries list.
  • Tests

    • Implemented tests to ensure accurate holiday generation and configuration for Iraq.

Walkthrough

This pull request introduces support for Iraq within the project by adding a new contributor, updating the README to reflect an increase in supported country codes, and implementing a comprehensive holiday management system for Iraq. This includes the addition of new classes, import statements, registry entries, and localization files for both Arabic and English. Additionally, a suite of tests has been created to validate the functionality related to Iraq's holidays.

Changes

File(s) Change Summary
AUTHORS.md Added new author Ashaz Akhtar before Bailey Thompson.
README.md Updated supported country codes count and added Iraq entry with code IQ and languages ar_IQ, en_US.
holidays/countries/__init__.py
holidays/countries/iraq.py
holidays/registry.py
Introduced Iraq holiday support: new Iraq class (with aliases IQ and IRQ), updated import, and registry entry for Iraq.
holidays/locale/ar_IQ/LC_MESSAGES/IQ.po
holidays/locale/en_US/LC_MESSAGES/IQ.po
Added new localization files with translation entries for Iraqi holidays in Arabic and English.
tests/countries/test_iraq.py Added new test suite for validating Iraq holiday functionality.

Suggested labels

script

Suggested reviewers

  • arkid15r

📜 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 73adb91 and 1c45ee9.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • holidays/countries/__init__.py (1 hunks)
  • holidays/registry.py (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
holidays/countries/__init__.py (1)
holidays/countries/iraq.py (3)
  • Iraq (42-166)
  • IQ (169-170)
  • IRQ (173-174)
🔇 Additional comments (3)
holidays/countries/__init__.py (1)

88-88: Nice addition of the Iraq import.

The import statement follows the project's alphabetical ordering convention and correctly imports the main Iraq class along with country code aliases IQ and IRQ. This is consistent with how other countries are imported in this file.

README.md (1)

655-661: Properly added Iraq to the countries table.

The entry is well-formatted and contains all required information:

  • Country name (Iraq)
  • ISO code (IQ)
  • Empty subdivisions field (correct as Iraq has no subdivisions in this implementation)
  • Supported languages with Arabic (ar_IQ) correctly set as default and English (en_US) as alternate
  • Empty supported categories field (using the default PUBLIC category)

The entry is also correctly positioned alphabetically between Iran and Ireland.

holidays/registry.py (1)

97-97: Registry entry for Iraq looks good.

The addition to the COUNTRIES dictionary correctly follows the established pattern:

  • Uses lowercase "iraq" as the key
  • Includes the class name "Iraq" and both country codes "IQ" and "IRQ"
  • Properly positioned alphabetically in the dictionary between Iran and Ireland

This entry will allow the library to correctly identify and instantiate the Iraq holiday class when requested through the API.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • holidays/locale/ar_IQ/LC_MESSAGES/IQ.po: Language not supported
  • holidays/locale/en_US/LC_MESSAGES/IQ.po: Language not supported
Comments suppressed due to low confidence (1)

holidays/countries/iraq.py:62

  • The class name 'IraqIslamicCalender' appears to be misspelled. Consider renaming it to 'IraqIslamicCalendar' for consistency.
IslamicHolidays.__init__(self, cls=IraqIslamicCalender, show_estimated=islamic_show_estimated)

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 19106c6 and 5c7dde7.

📒 Files selected for processing (8)
  • AUTHORS.md (1 hunks)
  • README.md (2 hunks)
  • holidays/countries/__init__.py (1 hunks)
  • holidays/countries/iraq.py (1 hunks)
  • holidays/locale/ar_IQ/LC_MESSAGES/IQ.po (1 hunks)
  • holidays/locale/en_US/LC_MESSAGES/IQ.po (1 hunks)
  • holidays/registry.py (1 hunks)
  • tests/countries/test_iraq.py (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
holidays/countries/__init__.py (1)
holidays/countries/iraq.py (3)
  • Iraq (45-151)
  • IQ (154-155)
  • IRQ (158-159)
🔇 Additional comments (17)
AUTHORS.md (1)

22-22: Well-placed author addition

The author's name "Ashaz Akhtar" has been correctly added in alphabetical order within the list of contributors.

holidays/countries/__init__.py (1)

88-88: Clean import addition

The import for Iraq and its country codes follows the established pattern and maintains alphabetical ordering between Iran and Ireland.

holidays/registry.py (1)

97-97: Proper registry entry

The Iraq entry in the COUNTRIES dictionary maintains consistent formatting with the rest of the registry and is correctly positioned alphabetically.

README.md (2)

102-102: Accurate country count update

The country count has been properly incremented from 164 to 165 to reflect the addition of Iraq.


656-661: Correctly formatted country entry

The Iraq entry follows the established table format and contains all required information including supported languages with proper default designation.

holidays/locale/en_US/LC_MESSAGES/IQ.po (2)

1-16: Metadata looks correct
No issues spotted. The header and license metadata align nicely with .po file conventions.


29-79: Translations appear consistent
All holiday names and translations look coherent, with no placeholder mismatches.

tests/countries/test_iraq.py (3)

27-44: Tests thoroughly verify early years
Confirmed that holiday checks before 1933 are correctly handled, including boundary tests for 1932 and 1933.


50-70: Comprehensive holiday assertions
The range of tested holiday dates (e.g., Army Day, Islamic New Year, multiple-day Eids) shows strong coverage.


110-132: Coverage of special holidays
Easter, Sukkot, and Passover testing under include_special ensures clarity around optional holidays.

holidays/countries/iraq.py (3)

45-59: Robust multi-inheritance approach
Extending multiple holiday groups aligns well with the library’s design. The weekend set correctly reflects local practices.


87-108: Temporal disabling of estimated labels
Toggling _islamic_calendar_show_estimated for 2021 and 2022, then restoring its original value, is a neat solution.


137-145: Good handling of special holidays
Offering these only when include_special is set to True keeps the library flexible for various use cases.

holidays/locale/ar_IQ/LC_MESSAGES/IQ.po (4)

30-32: Format string for estimated holidays.

This format string accommodates holiday dates that may vary each year. No issues with implementation.


34-80: Holiday translations structure looks good.

All Arabic holiday names are correctly set as message IDs. The empty msgstr entries are appropriate when msgid is already in the target language.


18-20: ⚠️ Potential issue

Future dates detected in translation metadata.

The PO file headers contain dates from 2025, which is in the future. These should be updated to the current date.

-"Project-Id-Version: Holidays 0.70\n"
-"POT-Creation-Date: 2025-04-05 12:08+0530\n"
-"PO-Revision-Date: 2025-04-05 12:08+0530\n"
+"Project-Id-Version: Holidays 0.70\n"
+"POT-Creation-Date: 2023-08-01 12:08+0530\n"
+"PO-Revision-Date: 2023-08-01 12:08+0530\n"
⛔ Skipped due to learnings
Learnt from: KJhellico
PR: vacanza/holidays#2385
File: holidays/locale/en_US/LC_MESSAGES/PK.po:17-26
Timestamp: 2025-04-02T17:22:27.207Z
Learning: Always verify the current year before flagging dates in project metadata as "future dates." As of March 2025, dates with year 2025 are current, not future dates.

1-81:

❓ Verification inconclusive

Verify translation completeness.

The file contains key Iraqi holidays. Consider reviewing with a native speaker to confirm all major national and religious holidays are included.


🏁 Script executed:

#!/bin/bash
# Check for similar files in other Arabic locales for comparison
echo "Looking for other Arabic locale files for reference:"
find holidays/locale -name "*.po" | grep -i "ar_" | grep -v "ar_IQ"

Length of output: 180


Action: Manual Verification Required – Confirm Holiday Coverage

The IQ Arabic locale file includes key Iraqi holidays, but our search didn't reveal any other Arabic locale files for additional context. Please verify with a native speaker (or a trusted reference) that the list covers all major national and religious holidays for Iraq.

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.

@MRAshaz, I strongly recommend that you look at other countries code to learn our code style for defining holidays and and writing tests.

):
country = "IQ"
default_language = "ar_IQ"
estimated_label = tr("%s (تقديري)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

All localized strings shoul have localization comment in preceding line.

Copy link
Collaborator

Choose a reason for hiding this comment

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

All localized strings.

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

🔭 Outside diff range comments (1)
holidays/locale/en_US/LC_MESSAGES/IQ.po (1)

35-81: 🛠️ Refactor suggestion

Provide English translations for all Iraqi holidays
Each msgstr is empty. Fill them in with correct English equivalents to ensure users see proper translations.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5c7dde7 and 73adb91.

📒 Files selected for processing (3)
  • holidays/countries/iraq.py (1 hunks)
  • holidays/locale/ar_IQ/LC_MESSAGES/IQ.po (1 hunks)
  • holidays/locale/en_US/LC_MESSAGES/IQ.po (1 hunks)
🔇 Additional comments (1)
holidays/countries/iraq.py (1)

60-60: Add translator comment for the estimated label
This aligns with the feedback from earlier reviews requiring a preceding localization comment for all translated strings.

# Iraqi holidays translation.
# Copyright (C) 2024 Vacanza Team
# This file is distributed under the same license as the holidays package.
#
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove "fuzzy" marker if translations are final
Leaving "fuzzy" suggests incomplete or uncertain translations. Remove the marker if you are confident about the correctness.

Comment on lines +90 to +93
def _add_holiday_july_14(self, name):
"""National Day"""
return self._add_holiday(name, JUL, 14)

Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Clarify docstring usage for _add_holiday_july_14
Currently labeled "National Day," but also used for "Republic Day" in 2022. Update the docstring to reflect both names.

Comment on lines +65 to +71
def __init__(self, islamic_show_estimated: bool = True, *args, **kwargs):
"""
Args:
islamic_show_estimated:
Whether to add "estimated" label to Islamic holidays name
if holiday date is estimated.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Document 'include_special' parameter
While the docstring explains islamic_show_estimated, it omits details for _include_special. Consider adding a brief explanation for clarity.

# License: MIT (see LICENSE file)
# SOME DESCRIPTIVE TITLE
# This file is distributed under the same license as the Holidays package.
# FIRST AUTHOR <ashazsyed105@gmail.com>, 2025.
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Update author attribution
Replace the placeholder with your actual name or remove if not necessary.

"Project-Id-Version: Holidays 0.70\n"
"POT-Creation-Date: 2025-04-05 12:08+0530\n"
"PO-Revision-Date: 2025-04-05 12:08+0530\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fill in translator name
"FULL NAME EMAIL@ADDRESS" should reflect the actual translator’s information.

Copy link

sonarqubecloud bot commented Apr 6, 2025

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@PPsyrius PPsyrius changed the title Added Iraq Added Iraq holidays Apr 6, 2025
@KJhellico KJhellico changed the title Added Iraq holidays Add Iraq holidays Apr 6, 2025
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.

@MRAshaz could you look into fixing the comments?

@arkid15r
Copy link
Collaborator

@MRAshaz tomorrow is the deadline for this task (3 weeks) so I'll have to free this issue up to anyone willing to work on it.

@arkid15r
Copy link
Collaborator

I'm closing this due to a missed deadline. Feel free to reopen if you have a ready for review code.

@coderabbitai coderabbitai bot mentioned this pull request Jul 30, 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 Iraq holidays

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载