Refactor snapshots generator: ProcessPoolExecutor, UTF-8 support#3062
Refactor snapshots generator: ProcessPoolExecutor, UTF-8 support#3062arkid15r merged 13 commits intovacanza:devfrom
Conversation
Summary by CodeRabbitRelease Notes
WalkthroughAdds ProcessPoolExecutor-based parallel snapshot generation and timing to the snapshot script, updates JSON I/O signatures/encoding and CLI parsing, adds a pyproject per-file-ignore, and applies widespread diacritic/capitalization normalizations across many Argentina snapshots and one Andorra snapshot. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (50)📓 Common learnings📚 Learning: 2025-03-26T22:40:52.932ZApplied to files:
📚 Learning: 2025-06-18T10:36:52.263ZApplied to files:
📚 Learning: 2025-06-24T17:26:17.728ZApplied to files:
📚 Learning: 2025-07-05T20:26:31.219ZApplied to files:
📚 Learning: 2025-06-16T15:48:33.931ZApplied to files:
📚 Learning: 2025-06-16T11:17:34.671ZApplied to files:
📚 Learning: 2025-06-05T09:31:22.753ZApplied to files:
📚 Learning: 2025-11-08T04:57:50.267ZApplied to files:
📚 Learning: 2025-11-08T04:57:36.307ZApplied to files:
📚 Learning: 2025-09-02T15:57:35.530ZApplied to files:
📚 Learning: 2025-06-15T15:10:20.360ZApplied to files:
📚 Learning: 2025-04-03T16:58:27.175ZApplied to files:
📚 Learning: 2025-06-08T13:36:16.999ZApplied to files:
📚 Learning: 2025-06-16T12:28:31.641ZApplied to files:
📚 Learning: 2025-09-10T14:35:54.603ZApplied to files:
📚 Learning: 2025-11-08T05:09:56.159ZApplied to files:
📚 Learning: 2025-09-12T21:37:10.710ZApplied to files:
📚 Learning: 2025-10-28T17:26:45.090ZApplied to files:
📚 Learning: 2025-09-20T12:24:28.864ZApplied to files:
📚 Learning: 2025-08-03T12:59:53.286ZApplied to files:
📚 Learning: 2025-09-14T17:17:14.387ZApplied to files:
📚 Learning: 2025-06-15T11:52:39.572ZApplied to files:
📚 Learning: 2025-09-27T05:11:09.476ZApplied to files:
📚 Learning: 2025-09-04T08:55:24.922ZApplied to files:
📚 Learning: 2025-06-18T10:58:28.058ZApplied to files:
📚 Learning: 2025-04-05T04:47:27.213ZApplied to files:
📚 Learning: 2025-06-15T15:10:20.360ZApplied to files:
📚 Learning: 2025-06-07T07:37:55.516ZApplied to files:
📚 Learning: 2025-06-07T07:37:55.516ZApplied to files:
📚 Learning: 2025-06-04T11:06:21.179ZApplied to files:
📚 Learning: 2025-06-05T18:24:26.712ZApplied to files:
📚 Learning: 2025-06-24T18:25:25.165ZApplied to files:
📚 Learning: 2025-04-03T05:59:57.480ZApplied to files:
📚 Learning: 2025-09-14T04:41:10.139ZApplied to files:
📚 Learning: 2025-09-14T16:03:13.558ZApplied to files:
📚 Learning: 2025-04-23T09:59:19.886ZApplied to files:
📚 Learning: 2025-11-08T04:57:32.644ZApplied to files:
📚 Learning: 2025-11-08T05:36:32.788ZApplied to files:
📚 Learning: 2025-08-24T11:55:06.810ZApplied to files:
📚 Learning: 2025-11-17T05:45:27.730ZApplied to files:
📚 Learning: 2025-08-24T13:01:51.370ZApplied to files:
📚 Learning: 2025-08-24T13:01:51.370ZApplied to files:
📚 Learning: 2025-06-16T15:48:48.680ZApplied to files:
📚 Learning: 2025-08-09T18:31:23.218ZApplied to files:
📚 Learning: 2025-08-20T19:46:15.625ZApplied to files:
📚 Learning: 2025-03-13T07:50:10.598ZApplied to files:
📚 Learning: 2025-06-14T20:13:29.536ZApplied to files:
📚 Learning: 2025-07-17T11:07:04.986ZApplied to files:
📚 Learning: 2025-07-15T15:00:32.728ZApplied to files:
🧬 Code graph analysis (1)scripts/generate_snapshots.py (1)
🪛 Ruff (0.14.4)scripts/generate_snapshots.py121-121: Avoid specifying long messages outside the exception class (TRY003) 145-145: Avoid specifying long messages outside the exception class (TRY003) ⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3062 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 306 306
Lines 18015 18015
Branches 2285 2285
=========================================
Hits 18015 18015 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (19)
pyproject.toml(1 hunks)scripts/generate_snapshots.py(3 hunks)snapshots/countries/AD_06.json(101 hunks)snapshots/countries/AR_A.json(93 hunks)snapshots/countries/AR_B.json(94 hunks)snapshots/countries/AR_C.json(94 hunks)snapshots/countries/AR_COMMON.json(94 hunks)snapshots/countries/AR_D.json(94 hunks)snapshots/countries/AR_E.json(94 hunks)snapshots/countries/AR_F.json(94 hunks)snapshots/countries/AR_G.json(94 hunks)snapshots/countries/AR_H.json(94 hunks)snapshots/countries/AR_J.json(94 hunks)snapshots/countries/AR_K.json(93 hunks)snapshots/countries/AR_L.json(94 hunks)snapshots/countries/AR_M.json(94 hunks)snapshots/countries/AR_N.json(94 hunks)snapshots/countries/AR_P.json(94 hunks)snapshots/countries/AR_Q.json(94 hunks)
🧰 Additional context used
🧠 Learnings (29)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.762Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/locale/en_US/LC_MESSAGES/VC.po:76-76
Timestamp: 2025-06-10T05:08:07.939Z
Learning: For the holidays project, localization file formatting issues (like missing terminal periods in .po files) should be automatically fixed by running `make l10n` command (which is included in `make check`). Authors should be directed to use this automated tooling instead of manual formatting fixes.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
📚 Learning: 2025-11-08T04:56:18.061Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:228-229
Timestamp: 2025-11-08T04:56:18.061Z
Learning: Argentina: Good Friday ("Viernes Santo") is established from 1977 by Law 21329. In tests/countries/test_argentina.py, assert presence for range(1977, self.end_year) and absence for range(self.start_year, 1977); do not assert over self.full_range.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AD_06.jsonsnapshots/countries/AR_M.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-08-12T03:21:09.116Z
Learnt from: mbfarah
Repo: vacanza/holidays PR: 2798
File: holidays/countries/chile.py:278-281
Timestamp: 2025-08-12T03:21:09.116Z
Learning: In Chile holidays implementation, the general rule for September 17 (years >= 2007) uses MON_ONLY for years 2007-2016, meaning it only adds the holiday when September 17 falls on a Monday. For years when September 17 falls on other days and was declared a one-off holiday by specific laws, it must be added to the special_public_holidays dictionary.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AD_06.jsonsnapshots/countries/AR_M.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-09-03T17:08:59.893Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:765-766
Timestamp: 2025-09-03T17:08:59.893Z
Learning: The Anniversary of the Battle of Tucumán holiday in Argentina's Tucumán province (subdiv="T") has been in effect since at least 1946 according to official government documentation, which predates AR.start_year (1957). Therefore, using self.full_range for this holiday test is correct.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AR_M.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-09-20T15:37:21.301Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_colombia.py:45-61
Timestamp: 2025-09-20T15:37:21.301Z
Learning: In Colombia's holiday system, movable observed holidays were only introduced from 1984 onwards. Before this date, holidays that later became movable (like Saint Joseph's Day) existed as regular holidays from their introduction year, but had no observed variant system. The years_non_observed parameter in Colombia tests reflects this 1984 start date for the observed holiday system.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AR_M.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-08-12T03:21:09.116Z
Learnt from: mbfarah
Repo: vacanza/holidays PR: 2798
File: holidays/countries/chile.py:278-281
Timestamp: 2025-08-12T03:21:09.116Z
Learning: September 17, 2010 and September 20, 2010 were both one-off holidays in Chile established by Law 20.450, separate from the general September 17 observance rule that only applies to Mondays.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AR_M.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-03-19T16:53:00.375Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:185-188
Timestamp: 2025-03-19T16:53:00.375Z
Learning: In the Fiji holidays implementation, the `special_public_holidays_observed` dictionary in `FijiStaticHolidays` is only used for exceptions to the normal observance rules, not for documenting all holidays. Only 2019's Constitution Day needed a special entry as it didn't follow the standard patterns.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AD_06.jsonsnapshots/countries/AR_M.json
📚 Learning: 2025-09-17T15:16:16.192Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2944
File: holidays/countries/myanmar.py:183-191
Timestamp: 2025-09-17T15:16:16.192Z
Learning: The special_public_holidays formatting pattern in the holidays codebase follows a consistent convention: single entries per year use flat tuple format like `2024: (MONTH, DAY, name)`, while multiple entries per year use tuple-of-tuples format like `2024: ((MONTH, DAY, name), (MONTH, DAY, name))`. This pattern is used consistently across all countries.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_D.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_A.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AD_06.jsonsnapshots/countries/AR_M.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.205Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.
Applied to files:
snapshots/countries/AR_H.jsonsnapshots/countries/AR_COMMON.jsonsnapshots/countries/AR_L.jsonsnapshots/countries/AR_P.jsonsnapshots/countries/AR_Q.jsonsnapshots/countries/AR_C.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_G.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AR_B.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-09-03T17:10:35.672Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/locale/fr/LC_MESSAGES/DZ.po:37-41
Timestamp: 2025-09-03T17:10:35.672Z
Learning: In Algerian French localization (holidays/locale/fr/LC_MESSAGES/DZ.po), capitalization should follow Algerian source-accurate conventions rather than standard French orthographic rules. For example, "Jour de l'An Grégorien" with capital "G" is correct for Algerian usage, even though standard French would typically use lowercase "grégorien".
Applied to files:
snapshots/countries/AR_L.jsonsnapshots/countries/AR_E.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AD_06.json
📚 Learning: 2025-09-26T13:58:49.363Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2960
File: holidays/locale/ca/LC_MESSAGES/ES.po:148-151
Timestamp: 2025-09-26T13:58:49.363Z
Learning: In the holidays project, when translating holiday names in .po files, the msgstr should be a faithful translation of the original msgid (in the country's default language), not influenced by English commentary or common en_US names. For example, "Día de la Pascua Granada" (Spanish) correctly translates to "Dia de la Pasqua Granada" (Catalan), even though the English comment refers to it as "Whit Monday".
Applied to files:
snapshots/countries/AR_E.jsonsnapshots/countries/AR_J.jsonsnapshots/countries/AR_K.jsonsnapshots/countries/AD_06.json
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Applied to files:
snapshots/countries/AR_E.jsonpyproject.tomlsnapshots/countries/AR_J.jsonsnapshots/countries/AR_N.jsonsnapshots/countries/AD_06.json
📚 Learning: 2025-09-14T06:39:08.485Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/south_africa.py:163-170
Timestamp: 2025-09-14T06:39:08.485Z
Learning: In South Africa's holidays implementation (holidays/countries/south_africa.py), the 2021 election uses the literal "Municipal elections" instead of the local_elections constant ("Local Government Elections") - this inconsistency is intentional and should not be flagged as an issue.
Applied to files:
snapshots/countries/AR_E.json
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
pyproject.tomlscripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
Applied to files:
pyproject.toml
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).
Applied to files:
pyproject.toml
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.
Applied to files:
pyproject.toml
📚 Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.
Applied to files:
snapshots/countries/AR_K.jsonsnapshots/countries/AD_06.jsonsnapshots/countries/AR_F.json
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Applied to files:
snapshots/countries/AR_N.jsonscripts/generate_snapshots.pysnapshots/countries/AD_06.json
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-26T13:55:16.266Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2960
File: holidays/locale/ca/LC_MESSAGES/ES.po:116-119
Timestamp: 2025-09-26T13:55:16.266Z
Learning: When reviewing religious holiday names in the holidays library, proper nouns referring to specific churches, sanctuaries, or locations should be preserved rather than converted to generic equivalents. For example, "Santa Maria of Africa" refers to the specific Sanctuary of Saint Mary of Africa in Ceuta and should remain as the proper name rather than being changed to "Our Lady of Africa."
Applied to files:
snapshots/countries/AD_06.json
📚 Learning: 2025-06-18T10:18:59.447Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:178-182
Timestamp: 2025-06-18T10:18:59.447Z
Learning: In the France holidays implementation, deprecated subdivision names like "Alsace-Moselle" and "Saint-Barthélémy" are handled through explicit conditionals in _populate_public_holidays() that map them to their corresponding new subdivision-specific holiday population methods, providing backward compatibility while users transition to the new ISO codes.
Applied to files:
snapshots/countries/AD_06.json
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
Applied to files:
snapshots/countries/AD_06.json
📚 Learning: 2025-06-18T10:26:50.180Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:178-180
Timestamp: 2025-06-18T10:26:50.180Z
Learning: In the France holidays implementation, the _populate_subdiv_57_public_holidays() (Moselle) and _populate_subdiv_6ae_public_holidays() (Alsace) methods are functionally identical, both adding Good Friday (≥1893) and Saint Stephen's Day (≥1892) with the same legal references from August 16th, 1892. Therefore, for the deprecated "Alsace-Moselle" subdivision, calling either method produces the same result.
Applied to files:
snapshots/countries/AD_06.json
📚 Learning: 2025-06-28T10:39:19.185Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2684
File: holidays/locale/it/LC_MESSAGES/SM.po:13-13
Timestamp: 2025-06-28T10:39:19.185Z
Learning: In the holidays project, .po file header comments use the format "# [Country] holidays." for default language files (without trailing hash) and "# [Country] holidays [locale] localization." for non-default language files (also without trailing hash).
Applied to files:
snapshots/countries/AD_06.json
📚 Learning: 2025-08-08T10:33:55.695Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2763
File: README.md:108-110
Timestamp: 2025-08-08T10:33:55.695Z
Learning: When verifying the country total in holidays/registry.py, isolate between '^COUNTRIES:' and '^FINANCIAL:' and count only lines matching the strict key pattern '^\s*"[a-z0-9_ ]+":\s*\(' to avoid overcounting non-entry quoted lines. As of PR vacanza/holidays#2763, this yields 227 entries.
Applied to files:
snapshots/countries/AD_06.json
📚 Learning: 2025-07-10T03:36:16.461Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2706
File: holidays/countries/cayman_islands.py:80-97
Timestamp: 2025-07-10T03:36:16.461Z
Learning: In the holidays library, date dictionaries that map years to specific dates (like queens_birthday_dates, spring_bank_dates, thanksgiving_day_dates, etc.) are typically defined within the _populate_public_holidays method rather than as module-level constants. This is the established library-wide pattern seen across multiple country implementations including United Kingdom, United States, Sri Lanka, and others.
Applied to files:
snapshots/countries/AD_06.json
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
country_holidays(31-227)financial_holidays(230-312)list_supported_countries(410-421)list_supported_financial(425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py
26-26: Unused noqa directive (non-enabled: E402)
Remove unused noqa directive
(RUF100)
119-119: Avoid specifying long messages outside the exception class
(TRY003)
128-128: Consider iterable unpacking instead of concatenation
Replace with iterable unpacking
(RUF005)
141-141: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test docs build
- GitHub Check: Build distribution
🔇 Additional comments (30)
snapshots/countries/AR_P.json (1)
12-12: Generated snapshot sanity: encoding + naming pass; please confirm provenance.Edits are consistent with UTF‑8 and canonical forms. Confirm AR_P.json was produced via the refactored
make snapshot. If yes, all good.Re‑run the verification script shared in AR_J to:
- Validate UTF‑8 across snapshots,
- Flag any remaining non‑canonical name variants,
- Assert deterministic dump behavior.
Also applies to: 978-986, 1207-1215, 1240-1247, 1708-1713, 1995-2000
snapshots/countries/AR_K.json (2)
2000-2000: Minor: guard against nondeterministic write order.If not already in the generator, dump with sort_keys=True and fixed separators to avoid churn under ProcessPoolExecutor.
⛔ Skipped due to learnings
Learnt from: KJhellico Repo: vacanza/holidays PR: 2386 File: holidays/countries/nepal.py:266-284 Timestamp: 2025-04-13T20:41:56.613Z Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.Learnt from: KJhellico Repo: vacanza/holidays PR: 2465 File: holidays/countries/suriname.py:219-251 Timestamp: 2025-04-13T19:10:31.502Z Learning: The `_CustomIslamicHolidays` classes in this project contain only exact verified holiday dates from reliable sources, rather than calculated or estimated future dates. This is by design to ensure accuracy, particularly for religious holidays that may follow lunar calendars or depend on local observations.
12-12: Verification complete—canonicalization and UTF-8 handling confirmed.Confirmed:
- Line 12 and sampled entries (531, 1036, 1214, 1461, 2153) all display proper UTF-8 (no escaped sequences like
\u00e9)- No stale escape variants remain in AR_K.json
- File structure and encoding valid
- Standardized names ("General Don José de San Martín", etc.) applied consistently
snapshots/countries/AR_J.json (2)
2010-2010: Review comment is already addressed in the codebase.The generator script (
scripts/generate_snapshots.py, lines 64-74) already implements proper UTF-8 handling with unescaped characters:
- Uses
encoding="utf-8"inwrite_text()- Uses
ensure_ascii=Falseinjson.dumps()The AR_J.json output confirms diacritics like "Güemes" and "José" are preserved unescaped. The current implementation (using
Path.write_text()+json.dumps()) is functionally equivalent to the suggested approach and correctly maintains UTF-8 with unescaped non-ASCII characters.
12-12: AR_J.json is confirmed as a generated artifact—all validation checks passed.Verification confirms:
- File produced by
make snapshot→scripts/generate_snapshots.py✓- UTF-8 encoding valid across all snapshots ✓
- Canonical name forms enforced; no variants leaked ✓
- Deterministic output (sorted keys, stable formatting) ✓
- Recent commits confirm UTF-8 refactor applied ✓
No hand-edits detected. Safe to merge.
snapshots/countries/AR_COMMON.json (2)
318-324: Good Friday boundary looks correct.Good Friday appears starting in 1977. That matches project guidance; ensure tests continue asserting presence from 1977 onward only. Based on learnings.
12-12: All verification checks passed.The AR snapshots are clean: no unaccented variants, valid UTF-8 across all files, and proper JSON structure with string values. The normalization is correct as shown in the provided snippet.
snapshots/countries/AR_N.json (1)
12-12: Consistent diacritics; keep snapshots generator-owned.Spelling/diacritic normalization is consistent. Confirm this file was regenerated by the new snapshot tool (not hand-edited) and encoded UTF‑8.
Use the same script shared in AR_COMMON to validate across all AR_* files.
Also applies to: 978-985
snapshots/countries/AR_Q.json (1)
12-12: LGTM on name normalization; please confirm deterministic writer settings.With ProcessPoolExecutor, ensure the writer uses ensure_ascii=False and sorted keys to keep stable diffs across runs.
If helpful, I can add a quick check in the generator to enforce sorted keys on save.
Also applies to: 978-985
pyproject.toml (1)
72-72: T201 ignore for generator is appropriate; code already follows all best practices.Verification confirms the generator already implements:
ensure_ascii=Falsein json.dumps() (line 76)encoding="utf-8"in write_text() (line 80)if __name__ == "__main__":guard (line 157)- Centralized I/O through the
save()method called by both worker functionsThe code is well-structured and safe for parallel snapshot generation. The T201 ignore is justified.
snapshots/countries/AR_H.json (1)
12-2009: Diacritics and normalization verified; confirm snapshot reproducibility locally.Good news: diacritics (José, Güemes) are preserved and properly NFC-normalized. However, sandbox limitations prevent us from running the snapshot generator. Please verify in your local environment that regenerating these snapshots produces no diffs—this confirms they're reproducible and match your tooling's output.
snapshots/countries/AR_M.json (1)
12-2083: All verifications passed; content is sound.✓ No ASCII fallbacks — San Martín and Güemes correctly use diacritics throughout
✓ NFC normalization — All AR_*.json files in canonical form
✓ Reproducible — Git diff shows no changes after regeneration attempt (file stable)The snapshot changes span 1957–2050 with consistent holiday data and proper Unicode normalization. No issues detected.
snapshots/countries/AR_L.json (1)
12-2009: Diacritics verified; snapshot reproducible.All checks passed:
- ✓ UTF‑8 diacritics preserved (José, Güemes, Belgrano preserved; no ASCII fallbacks)
- ✓ NFC normalization verified across AR_*.json
- ✓ File reproducible (MD5 hash stable before/after regeneration:
3b48e9d5f8bf2c5cc4ce9b67599da641)The snapshot changes are data‑only, encoding‑safe, and consistent.
snapshots/countries/AR_D.json (2)
12-12: Standardization verified — "José de San Martín" consistently applied across all 94 occurrences.No ASCII fallbacks detected. The canonical accented form is uniformly used throughout snapshots/countries/AR_D.json, including all cited line ranges.
1003-1004: Diacritics verified across all instances—no issues found.All 36 occurrences of "Martín Miguel de Güemes" correctly preserve the ü diacritic with no fallback spellings detected. Formatting is consistent across the date range (2016–2050).
snapshots/countries/AR_E.json (2)
12-12: Verification confirms consistent "San Martín" normalization with no fallbacks detected.All checks passed: JSON valid, 94 canonical entries, zero unaccented variants, separators preserved across multi-holiday dates. No action required.
1043-1044: Accents verified as correct and consistent.Script output confirms 35 occurrences of the correct "Martín Miguel de Güemes" spelling, zero fallback variants without accents, and consistent non-ASCII handling across the file. No issues found.
snapshots/countries/AD_06.json (2)
11-15: UTF-8 diacritics verified across entire file.Verification confirms all technical checks pass:
- JSON valid
- No duplicate keys
- Diacritics ("Canòlich", "Sant Julià de Lòria") consistently present across 1950–2050 range
- No ASCII fallbacks detected
Changes read as systematic and generated (consistent pattern repeats across all years). No issues found.
1597-1600: File encoding verified as correct.The file already uses raw UTF-8 encoding with no Unicode escape sequences. All mentioned line ranges (1597–1600, 1618–1621, 1641–1644, 1663–1666, 1684–1688) contain accented characters in raw form (e.g., "Canòlich", "Julià", "Lòria"). The generator correctly used
ensure_ascii=False, preserving readability as intended.snapshots/countries/AR_G.json (2)
12-12: San Martín diacritics normalized — LGTM.String canonicalization to “Pass to the Immortality of General Don José de San Martín” is consistent and UTF‑8 clean across the file.
Please confirm these lines were snapshot-generated via the new ProcessPoolExecutor path, not hand-edited. Based on learnings.
Also applies to: 804-804, 1015-1015, 1214-1214, 1464-1464, 1890-1890
978-978: Güemes name: correct “ü” and full title.Spelling/diacritics for “Don Martín Miguel de Güemes” look correct; chronology intact.
Confirm these entries stem from the generator with UTF‑8 writes (ensure_ascii=False, encoding='utf-8'). Based on learnings.
Also applies to: 1996-1996
snapshots/countries/AR_A.json (2)
12-12: San Martín string normalization — consistent and correct.Canonical form and diacritics are uniform; good improvement for l10n/UTF‑8.
Also applies to: 832-832, 1104-1105, 1442-1442, 1645-1646, 2031-2032
1163-1164: Duplicate Güemes entries on same date — confirm intent.Seeing both “Day of Memory of … Güemes” (provincial) and “Pass to the Immortality … Güemes” (national) on the same day. Looks intentional for Salta; please confirm this is the desired composite snapshot output from the generator.
This should come solely from generator logic; snapshots should not be manually edited. Based on learnings.
Also applies to: 1199-1200, 1234-1235, 1458-1460, 1496-1498, 1530-1533
snapshots/countries/AR_C.json (2)
324-324: Consistent San Martín normalization — looks good.UTF‑8 diacritics and wording are standardized across years; ordering preserved.
Also applies to: 736-737, 1015-1016, 1246-1247, 1395-1396, 1712-1713
1010-1011: Güemes entries: diacritics and titles OK.Names render correctly (“Martín”, “Güemes”); no JSON structure drift observed.
Also applies to: 1240-1241, 1418-1419
snapshots/countries/AR_B.json (1)
12-1996: Consistent name normalization in AR_B snapshotThe updated entries for San Martín and Martín Miguel de Güemes look uniformly formatted and keep the JSON structure intact; for an auto‑generated snapshot this is fine as‑is.
snapshots/countries/AR_F.json (1)
12-2220: Snapshot text cleanup for La Rioja looks goodName/diacritic normalization for San Martín, Martín Miguel de Güemes, and Ángel Vicente Peñaloza is consistent and leaves the JSON schema untouched; fine for regenerated snapshots.
scripts/generate_snapshots.py (3)
71-81: UTF‑8 JSON output matches the PR’s intentWriting snapshots via
write_text(..., ensure_ascii=False, encoding="utf-8")with a trailing newline gives proper UTF‑8 files and stays friendly to pre‑commit. This aligns neatly with the UTF‑8 support objective.
147-149: Financial snapshot parallelization looks straightforwardThe market work items and their handling in
ProcessPoolExecutorare simple and match the country side; passingyearsandsnapshot_pathis all that’s needed. Nice, minimal parallelization.
159-162: Runtime timer is handy for tracking the speedupUsing
perf_counter()aroundSnapshotGenerator().run()and printing a single summary line gives a cheap sanity check on performance and matches the timings in the PR description. No changes needed here.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
scripts/generate_snapshots.py (1)
26-31: Clean up the unusednoqadirective.The
# noqa: E402comment on the import is flagged by Ruff as unused (RUF100). You can drop it.Based on past review feedback.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/generate_snapshots.py(3 hunks)
🧰 Additional context used
🧠 Learnings (27)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.257Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.257Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.295Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.295Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.141Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.141Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.
Applied to files:
scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
country_holidays(31-227)financial_holidays(230-312)list_supported_countries(410-421)list_supported_financial(425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py
117-117: Avoid specifying long messages outside the exception class
(TRY003)
141-141: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build distribution
- GitHub Check: Test docs build
🔇 Additional comments (8)
scripts/generate_snapshots.py (8)
41-59: Nice fix—mutual exclusivity now enforced at parse time.This directly addresses the prior concern about
--countryand--marketsilently doing nothing when both are supplied. Clean solution.
63-67: LGTM!Type annotations are clear, logic is correct.
70-80: UTF-8 support looks solid.
ensure_ascii=False+ explicitencoding="utf-8"+ trailing newline for pre-commit. Well done.
82-96: Worker implementation is correct for ProcessPoolExecutor.The parent instantiates
country_holidays(line 125) to gather metadata (subdivisions, categories), and the worker instantiates it again to generate the actual snapshot. This is unavoidable—workers run in separate processes and can't share pickledHolidayBaseobjects. The current design is optimal.
97-107: LGTM!Clean worker implementation for financial snapshots.
123-131: Parallel execution and unpacking look great.The iterable unpacking
(None, *country.subdivisions)fixes the RUF005 concern from prior reviews, and theProcessPoolExecutorimplementation is clean. The type annotation onwork_itemsadds clarity.
147-151: LGTM!Financial snapshot generation follows the same clean pattern as country snapshots.
161-164: Good instrumentation.The timing printout aligns with the PR's performance objectives (13s vs 59s). Clean implementation.
KJhellico
left a comment
There was a problem hiding this comment.
Great acceleration! 🚀
Co-authored-by: ~Jhellico <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/generate_snapshots.py(3 hunks)
🧰 Additional context used
🧠 Learnings (27)
📓 Common learnings
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.
Applied to files:
scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (2)
holidays/holiday_base.py (1)
append(940-951)holidays/utils.py (4)
country_holidays(31-227)financial_holidays(230-312)list_supported_countries(410-421)list_supported_financial(425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py
117-117: Avoid specifying long messages outside the exception class
(TRY003)
141-141: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Test build on windows-latest
- GitHub Check: Test build on macos-latest
- GitHub Check: Test build on ubuntu-latest
- GitHub Check: Test docs build
🔇 Additional comments (8)
scripts/generate_snapshots.py (8)
21-31: ProcessPool and holidays helper imports fit the new designBringing in
ProcessPoolExecutor,perf_counter, and thecountry_holidays/financial_holidays/list_supported_*helpers is a clean way to align this script with the core APIs for parallel snapshot generation. No concerns here.
41-59: Mutually exclusive--country/--marketflags fix the earlier no-op trapUsing an argparse mutually exclusive group for the entity selectors matches the run flow and prevents the previous “both flags → no snapshots” behavior, while still allowing repeated
--country/--marketviaaction="extend". The CLI surface looks solid.
63-67: Directory prep logic is safe for full regenerations
shutil.rmtree(..., ignore_errors=True)followed bymkdir(parents=True, exist_ok=True)gives a clean slate for full runs and is tolerant of missing directories, which is exactly what you want for auto-generated snapshots.
69-80: UTF‑8 JSON output with normalized newlines is on point
save()now writes UTF‑8 JSON withensure_ascii=False, sorted date keys, and a final newline usingnewline="\n", which should keep snapshot contents stable across platforms and happy with the pre-commit EOF fixer. Just ensure your minimum Python version includes thenewlineparameter onPath.write_text, but for modern versions this is fine. Based on learnings.
82-107: Worker functions are nicely stateless and en_US-awareBoth workers take simple tuples, reconstruct their holiday objects in the child process, force
language="en_US", and (for countries) honorsupported_categoriesbefore delegating tosave(). That keeps the ProcessPool usage straightforward and avoids write races by mapping one work item to one file. Based on learnings.
109-131: Country snapshot scheduling via work_items + ProcessPool looks correctCountry selection, unknown-country validation, conditional directory cleanup for “all countries” runs, and building
work_itemsover(None, *country.subdivisions)withsupported_categoriesand a sharedyearsrange all line up. The ProcessPool executor over that list should parallelize cleanly while keeping each snapshot confined to its own file undersnapshots/countries.
133-151: Financial snapshot flow mirrors the country path cleanlyThe financial branch follows the same pattern—supported list lookup, unknown-market guard, optional full-dir reset, then a simple
(market_code, years, snapshot_path)work_items list mapped through the financial worker. The symmetry with the country flow makes this easy to reason about and maintain.
161-164: Timing wrapper provides useful feedback without touching core logicWrapping
SnapshotGenerator().run()withperf_counter()and printing a single summary line at the end gives a clear runtime signal for local and CI runs, and the script guard keeps this from affecting library users.
make snapshot: ProcessPoolExecutor, UTF-8 supportThere was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/generate_snapshots.py(3 hunks)
🧰 Additional context used
🧠 Learnings (35)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2349
File: snapshots/countries/TW_COMMON.json:9-12
Timestamp: 2025-03-13T07:50:10.598Z
Learning: JSON files in the `snapshots/` directory (like `snapshots/countries/TW_COMMON.json`) are automatically generated by the `make snapshot` command and not meant to be manually edited.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: In the vacanza/holidays project, ruff configuration allows longer docstring lines than the typical 100-character limit, so docstring reference lines that exceed standard line length limits are acceptable and won't be flagged by ruff format during pre-commit checks.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, coding standards and line length limits should follow what is allowed by the ruff linter configuration used in the pre-commit checks, not arbitrary 100-character limits.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-04T11:06:21.179Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-05T18:24:26.712Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2600
File: holidays/countries/philippines.py:56-56
Timestamp: 2025-06-05T18:24:26.712Z
Learning: In the holidays repository, if code passes `make pre-commit` checks, then it's allowed regardless of individual static analysis tool warnings like Pylint line length violations. The pre-commit hooks are the definitive source of truth for their coding standards.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-24T18:25:25.165Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:25-30
Timestamp: 2025-06-24T18:25:25.165Z
Learning: In the holidays project, reference URLs in docstrings/comments that exceed 100 characters are acceptable if they pass the pre-commit tests, even if Pylint flags them as line length violations.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.
Applied to files:
scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
country_holidays(31-227)financial_holidays(230-312)list_supported_countries(410-421)list_supported_financial(425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py
117-117: Avoid specifying long messages outside the exception class
(TRY003)
141-141: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test Python 3.11 on windows-latest
🔇 Additional comments (5)
scripts/generate_snapshots.py (5)
41-59: Mutually exclusive group properly enforces country/market separation.This cleanly resolves the earlier concern about supplying both
--countryand--marketresulting in silent no-op. Argparse will now reject conflicting flags upfront with a clear error.
68-80: UTF-8 support properly implemented.The
encoding="utf-8",newline="\n", andensure_ascii=Falsecombination correctly handles UTF-8 snapshots across platforms. Trailing newline keeps pre-commit happy.
123-129: Work item construction properly optimized.Instantiating
country_holidaysonce per country and using iterable unpacking(None, *country.subdivisions)addresses the RUF005 violation and eliminates redundant instantiation. Passingsupported_categoriesin the work items is the right approach.
160-160: Warnings suppression doesn't affect worker processes.
warnings.simplefilter("ignore")only affects the main process. Workers spawned byProcessPoolExecutorwill still emit warnings (e.g., from India, Marshall Islands). This is expected behavior—each subprocess has its own warnings configuration. If you need to suppress warnings in workers, you'd need to callwarnings.simplefilter("ignore")inside each worker function.Based on learnings
161-164: Runtime timer cleanly implemented.Using
perf_counter()for timing is the right choice for performance measurement. The formatted output matches the PR's reported improvements (~13s post-refactor vs ~59s pre-refactor).
There was a problem hiding this comment.
Actionable comments posted: 5
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/generate_snapshots.py(3 hunks)
🧰 Additional context used
🧠 Learnings (38)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.788Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.
📚 Learning: 2025-03-26T22:40:52.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2375
File: snapshots/countries/AR_G.json:2-2008
Timestamp: 2025-03-26T22:40:52.932Z
Learning: Snapshot files in the `snapshots/` directory are automatically generated by `scripts/generate_snapshots.py` and are intended for internal use only. There is no point in analyzing or suggesting changes to their contents as they are not meant to be manually edited.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-24T17:26:17.728Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: snapshots/countries/CV_RS.json:471-478
Timestamp: 2025-06-24T17:26:17.728Z
Learning: Snapshot files in the holidays library (like those in snapshots/countries/) are generated automatically and should not be manually edited. Any issues with snapshot content should be addressed in the source code that generates them, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:36:52.263Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: snapshots/countries/FR_MF.json:658-662
Timestamp: 2025-06-18T10:36:52.263Z
Learning: Snapshot files in the `snapshots/` directory are auto-generated by the `make snapshot` command and use `en_US` locale when the countries/markets entities support localization (l10n). The localization happens at the application level, not in the snapshot files themselves.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-07-05T20:26:31.219Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2702
File: holidays/countries/__init__.py:65-69
Timestamp: 2025-07-05T20:26:31.219Z
Learning: The vacanza/holidays project uses ruff as the primary linter for code checking and linting. Flake8 suppression comments are not needed since the project defers to ruff's rules, and existing `ruff: noqa` comments should be sufficient for handling linting warnings.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T15:48:33.931Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:20-24
Timestamp: 2025-06-16T15:48:33.931Z
Learning: The holidays project uses `make pre-commit` test which includes `ruff` as the primary linter. If `ruff` passes, then Pylint warnings that don't appear in `ruff` are considered acceptable and can be ignored.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T11:17:34.671Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2637
File: holidays/countries/singapore.py:49-50
Timestamp: 2025-06-16T11:17:34.671Z
Learning: For the vacanza/holidays project, defer to ruff's line length rules rather than pylint's C0301 warnings. If ruff passes in pre-commit tests, line length is acceptable regardless of pylint warnings about exceeding 100 characters.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-05T09:31:22.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2599
File: holidays/countries/__init__.py:193-193
Timestamp: 2025-06-05T09:31:22.753Z
Learning: For the holidays Python library, when encountering line length or formatting issues, suggest contributors run `make pre-commit` to auto-format their files instead of providing specific manual formatting fixes like line splitting or noqa comments.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:50.267Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cameroon.py:21-23
Timestamp: 2025-11-08T04:57:50.267Z
Learning: In the vacanza/holidays test suite, do not suggest adding return type annotations (such as `-> None`) to `setUpClass` class methods in test files. This is a consistent pattern across the test suite and should be maintained even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:36.307Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cambodia.py:20-22
Timestamp: 2025-11-08T04:57:36.307Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files intentionally do not include return type annotations like `-> None`. This is a consistent pattern across all country test files and should not be changed, even when static analysis tools like Ruff suggest adding them.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-02T15:57:35.530Z
Learnt from: arkid15r
Repo: vacanza/holidays PR: 2880
File: pyproject.toml:0-0
Timestamp: 2025-09-02T15:57:35.530Z
Learning: In the vacanza/holidays project, N802 (function name style) suppression follows a hybrid approach: file-level suppression is used for base test classes like tests/common.py (which contains assertion methods), while inline `# noqa: N802` suppressions are maintained for specific test methods in actual test files to provide better granularity and intent clarity.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: The vacanza/holidays project uses ruff with line-length = 99 characters (configured in pyproject.toml), not the standard 80 or 100 character limits. When pre-commit checks pass, the formatting is compliant with the project's specific ruff configuration.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-08T13:36:16.999Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:1-12
Timestamp: 2025-06-08T13:36:16.999Z
Learning: For the holidays project/repository, module docstrings are not used and should never be suggested, even when pylint flags missing module docstring warnings (C0114).
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-27T05:11:09.476Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2952
File: tests/countries/test_norway.py:25-27
Timestamp: 2025-09-27T05:11:09.476Z
Learning: In the vacanza/holidays project, the standard pattern for handling deprecation warnings in country test files is to use `warnings.simplefilter("ignore", category=DeprecationWarning)` in the setUp() method. This pattern is consistently used across multiple major country test files (USA, UK, Germany, France, Portugal, New Zealand, Norway) that have deprecated subdivisions and test them using `self.assertDeprecatedSubdivisions()`.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-04T08:55:24.922Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:317-318
Timestamp: 2025-09-04T08:55:24.922Z
Learning: In the vacanza/holidays project, composite generator expressions using tuple unpacking across multiple range() calls (like `(*range(AR.start_year, 1988), *range(1992, 1995), *range(2011, 2050))`) have been previously accepted as-is for readability, despite being dense constructions.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-18T10:58:28.058Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:184-206
Timestamp: 2025-06-18T10:58:28.058Z
Learning: In the holidays library France implementation, creating shared private methods between subdivision-specific holiday population methods (like _populate_subdiv_57_public_holidays and _populate_subdiv_6ae_public_holidays) is not supported by the current framework architecture, so duplicate code between functionally identical subdivision methods should be left as-is.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-15T15:10:20.360Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:28-54
Timestamp: 2025-06-15T15:10:20.360Z
Learning: In the vacanza/holidays project, ruff configuration allows longer docstring lines than the typical 100-character limit, so docstring reference lines that exceed standard line length limits are acceptable and won't be flagged by ruff format during pre-commit checks.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, defer to the ruff configuration and pre-commit checks for coding standards rather than making manual suggestions about line length or style issues. If the automated checks pass, the code follows the project's standards.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-07T07:37:55.516Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:30-30
Timestamp: 2025-06-07T07:37:55.516Z
Learning: For the vacanza/holidays repository, coding standards and line length limits should follow what is allowed by the ruff linter configuration used in the pre-commit checks, not arbitrary 100-character limits.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-04T11:06:21.179Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2594
File: holidays/countries/micronesia.py:25-30
Timestamp: 2025-06-04T11:06:21.179Z
Learning: In the holidays repository, line length formatting should defer to pre-commit formatting checks rather than manual suggestions. If pre-commit allows it, the formatting is acceptable per project policy.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-05T18:24:26.712Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2600
File: holidays/countries/philippines.py:56-56
Timestamp: 2025-06-05T18:24:26.712Z
Learning: In the holidays repository, if code passes `make pre-commit` checks, then it's allowed regardless of individual static analysis tool warnings like Pylint line length violations. The pre-commit hooks are the definitive source of truth for their coding standards.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-06-24T18:25:25.165Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:25-30
Timestamp: 2025-06-24T18:25:25.165Z
Learning: In the holidays project, reference URLs in docstrings/comments that exceed 100 characters are acceptable if they pass the pre-commit tests, even if Pylint flags them as line length violations.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.
Applied to files:
scripts/generate_snapshots.py
📚 Learning: 2025-11-08T04:57:32.644Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bosnia_and_herzegovina.py:22-23
Timestamp: 2025-11-08T04:57:32.644Z
Learning: In the vacanza/holidays test suite, `setUpClass` methods in test files (e.g., tests/countries/test_*.py) intentionally do not include return type annotations like `-> None`. The signature should remain as `def setUpClass(cls):` without explicit return type hints, consistent with the project's test conventions and similar to the pattern for `__init__` and `_populate` methods in the main codebase.
Applied to files:
scripts/generate_snapshots.py
🧬 Code graph analysis (1)
scripts/generate_snapshots.py (1)
holidays/utils.py (4)
country_holidays(31-227)financial_holidays(230-312)list_supported_countries(410-421)list_supported_financial(425-436)
🪛 Ruff (0.14.4)
scripts/generate_snapshots.py
116-116: Avoid specifying long messages outside the exception class
(TRY003)
137-137: Avoid specifying long messages outside the exception class
(TRY003)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test docs build
- GitHub Check: Build distribution
🔇 Additional comments (4)
scripts/generate_snapshots.py (4)
21-31: Process pool imports and holidays wiring look solidUsing
ProcessPoolExecutorplusperf_counterand insertingPath.cwd()intosys.pathbefore importingholidaysgives the script what it needs without extra cruft. Also good that the unused# noqa: E402is gone now.
41-59: Mutually exclusive--country/--marketfixes the silent no-opPutting
--countryand--marketinto a mutually exclusive group is a clean way to avoid the previous “both set ⇒ nothing happens” trap. Theextend+nargs="+""pattern withdefault=[]keeps the API flexible.
63-66: Directory prep helper is straightforward and robust
shutil.rmtree(..., ignore_errors=True)followed bymkdir(parents=True, exist_ok=True)is a simple, resilient reset for the snapshot directory and handles missing dirs gracefully.
100-109: Financial worker mirrors the country worker cleanlyThe market worker is a nice parallel to the country worker: it builds a deterministic filename, uses the shared
years/snapshot_path, and pinslanguage="en_US". No issues here.
|



Proposed change
ProcessPoolExecutorto speed up snapshot generation by running eachcountry_subdiv,country_common, ormarketsnapshot each as its own process.Type of change
holidaysfunctionality in general)Checklist
make checklocally; all checks and tests passed.