Update XNYS holidays: add half-day holidays#3111
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughAdds HALF_DAY support to NYSE and propagates market-supported categories through utilities and snapshot generation; expands NYSE holiday rules and extensive historical/half-day data; updates README/docs/tests and snapshot generation to include supported categories. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 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 (71)📓 Common learnings📚 Learning: 2025-12-07T18:09:57.494ZApplied to files:
📚 Learning: 2025-05-04T10:29:46.780ZApplied to files:
📚 Learning: 2025-09-20T12:24:28.864ZApplied to files:
📚 Learning: 2025-04-03T16:58:27.175ZApplied to files:
📚 Learning: 2025-09-10T14:35:54.603ZApplied to files:
📚 Learning: 2025-08-26T20:10:05.288ZApplied to files:
📚 Learning: 2025-08-28T02:42:52.755ZApplied to files:
📚 Learning: 2025-04-08T14:46:10.656ZApplied to files:
📚 Learning: 2025-07-02T18:17:53.342ZApplied to files:
📚 Learning: 2025-08-26T14:43:53.605ZApplied to files:
📚 Learning: 2025-06-25T10:12:30.448ZApplied to files:
📚 Learning: 2025-10-28T17:26:45.090ZApplied to files:
📚 Learning: 2025-09-04T08:54:35.319ZApplied to files:
📚 Learning: 2025-06-16T12:28:31.641ZApplied to files:
📚 Learning: 2025-07-24T15:21:31.632ZApplied to files:
📚 Learning: 2025-04-23T14:55:35.504ZApplied to files:
📚 Learning: 2025-08-19T20:04:26.215ZApplied to files:
📚 Learning: 2025-05-10T04:32:15.760ZApplied to files:
📚 Learning: 2025-04-23T09:22:41.753ZApplied to files:
📚 Learning: 2025-06-14T20:36:17.239ZApplied to files:
📚 Learning: 2025-05-10T04:02:13.815ZApplied to files:
📚 Learning: 2025-08-19T21:22:13.125ZApplied to files:
📚 Learning: 2025-08-11T10:14:28.517ZApplied to files:
📚 Learning: 2025-11-08T04:57:50.267ZApplied to files:
📚 Learning: 2025-11-08T04:57:36.307ZApplied to files:
📚 Learning: 2025-10-28T17:02:23.997ZApplied to files:
📚 Learning: 2025-04-23T09:59:19.886ZApplied to files:
📚 Learning: 2025-11-08T04:57:32.644ZApplied to files:
📚 Learning: 2025-08-19T14:42:45.111ZApplied to files:
📚 Learning: 2025-07-09T20:27:37.760ZApplied to files:
📚 Learning: 2025-09-14T04:36:25.108ZApplied to files:
📚 Learning: 2025-08-30T12:52:58.539ZApplied to files:
📚 Learning: 2025-04-03T12:36:41.201ZApplied to files:
📚 Learning: 2025-07-09T21:16:35.145ZApplied to files:
📚 Learning: 2025-03-23T10:11:50.465ZApplied to files:
📚 Learning: 2025-07-02T18:21:59.302ZApplied to files:
📚 Learning: 2025-06-14T20:43:15.370ZApplied to files:
📚 Learning: 2025-04-25T20:27:59.086ZApplied to files:
📚 Learning: 2025-09-14T16:03:13.558ZApplied to files:
📚 Learning: 2025-09-03T16:49:35.246ZApplied to files:
📚 Learning: 2025-09-28T05:42:12.777ZApplied to files:
📚 Learning: 2025-11-08T05:09:56.159ZApplied to files:
📚 Learning: 2025-08-03T13:48:11.910ZApplied to files:
📚 Learning: 2025-05-09T18:36:09.607ZApplied to files:
📚 Learning: 2025-09-14T07:26:25.431ZApplied to files:
📚 Learning: 2025-08-26T09:43:38.329ZApplied to files:
📚 Learning: 2025-09-14T04:36:25.108ZApplied to files:
📚 Learning: 2025-06-15T20:39:51.085ZApplied to files:
📚 Learning: 2025-03-19T16:54:58.657ZApplied to files:
📚 Learning: 2025-06-18T10:21:01.376ZApplied to files:
📚 Learning: 2025-03-05T02:35:03.298ZApplied to files:
📚 Learning: 2025-08-21T04:56:03.780ZApplied to files:
📚 Learning: 2025-08-21T04:56:03.780ZApplied to files:
📚 Learning: 2025-09-17T15:53:16.940ZApplied to files:
📚 Learning: 2025-08-28T11:45:56.892ZApplied to files:
📚 Learning: 2025-09-18T07:01:12.236ZApplied to files:
📚 Learning: 2025-05-13T13:23:11.375ZApplied to files:
📚 Learning: 2025-08-12T18:40:16.160ZApplied to files:
📚 Learning: 2025-05-01T19:13:44.664ZApplied to files:
📚 Learning: 2025-06-14T11:04:31.180ZApplied to files:
📚 Learning: 2025-08-19T19:47:21.735ZApplied to files:
📚 Learning: 2025-09-14T04:41:10.139ZApplied to files:
📚 Learning: 2025-04-03T16:58:27.175ZApplied to files:
📚 Learning: 2025-08-21T05:56:33.276ZApplied to files:
📚 Learning: 2025-03-04T11:32:45.095ZApplied to files:
📚 Learning: 2025-03-04T11:32:45.095ZApplied to files:
📚 Learning: 2025-10-27T21:23:12.690ZApplied to files:
📚 Learning: 2025-07-10T03:36:16.461ZApplied to files:
📚 Learning: 2025-06-14T11:05:21.250ZApplied to files:
📚 Learning: 2025-03-19T16:53:00.375ZApplied to files:
🪛 Ruff (0.14.7)holidays/financial/ny_stock_exchange.py63-63: Missing type annotation for (ANN003) 72-72: Missing return type annotation for private function Add return type annotation: (ANN202) 84-84: Missing return type annotation for private function Add return type annotation: (ANN202) 192-192: Missing return type annotation for private function Add return type annotation: (ANN202) 683-789: Mutable class attributes should be annotated with (RUF012) ⏰ 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). (5)
🔇 Additional comments (4)
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 #3111 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 306 306
Lines 18083 18150 +67
Branches 2292 2300 +8
=========================================
+ Hits 18083 18150 +67 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (8)
README.md(2 hunks)holidays/financial/ny_stock_exchange.py(7 hunks)holidays/utils.py(3 hunks)pyproject.toml(1 hunks)scripts/generate_snapshots.py(2 hunks)snapshots/financial/XNYS.json(39 hunks)tests/financial/test_ny_stock_exchange.py(12 hunks)tests/test_docs.py(3 hunks)
🧰 Additional context used
🧠 Learnings (83)
📓 Common learnings
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.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: 2025-08-21T07:46:35.987Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2834
File: README.md:1831-1831
Timestamp: 2025-08-21T07:46:35.987Z
Learning: In the Available Financial Markets table in README.md, market entity names do not include acronyms in parentheses, unlike some other tables in the codebase. The pattern is to use the full entity name only.
Applied to files:
README.md
📚 Learning: 2025-09-07T19:28:19.153Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2888
File: holidays/financial/national_stock_exchange_of_india.py:110-112
Timestamp: 2025-09-07T19:28:19.153Z
Learning: For National Stock Exchange of India (NSE) holidays implementation in holidays/financial/national_stock_exchange_of_india.py, "Mahatma Gandhi Jayanti" is the official name used in NSE source documentation for Gandhi Jayanti (October 2nd), even though snapshots and localization files may use the shorter "Gandhi Jayanti" form. Source accuracy takes precedence over standardization.
Applied to files:
README.md
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2834
File: holidays/financial/national_stock_exchange_of_india.py:38-44
Timestamp: 2025-08-26T20:10:05.288Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, only `estimated_label = tr("%s (estimated)")` is needed for localization support. The `observed_label` and `observed_estimated_label` are not required for this financial market holidays implementation.
Applied to files:
README.mdholidays/utils.pyholidays/financial/ny_stock_exchange.pysnapshots/financial/XNYS.json
📚 Learning: 2025-08-25T10:51:08.068Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:21-30
Timestamp: 2025-08-25T10:51:08.068Z
Learning: In the holidays library, references in country/market holiday implementations should be ordered as follows: Wikipedia links for the country/market holidays first, then country-specific official sources for newer implementations, then Wikipedia links for each individual non-standard holiday if any are required. Official government sources should not be placed first ahead of Wikipedia links.
Applied to files:
README.mdholidays/financial/ny_stock_exchange.pysnapshots/financial/XNYS.json
📚 Learning: 2025-09-06T20:47:29.638Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2888
File: holidays/financial/national_stock_exchange_of_india.py:153-155
Timestamp: 2025-09-06T20:47:29.638Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, Buddha Purnima was officially observed as a trading holiday from 2006-2009 according to official NSE circulars, as confirmed by maintainer review of comprehensive official sources.
Applied to files:
README.md
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.755Z
Learning: In the holidays framework, when no categories parameter is specified in a country class instantiation (e.g., `Georgia(years=2025)`), the PUBLIC category is used by default. There's no need to explicitly specify `categories=PUBLIC` or import the PUBLIC constant for such test cases.
Applied to files:
holidays/utils.pyholidays/financial/ny_stock_exchange.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:
holidays/utils.pyholidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-04T10:29:46.780Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2525
File: holidays/countries/togo.py:0-0
Timestamp: 2025-05-04T10:29:46.780Z
Learning: When a country class in the holidays library uses additional categories beyond PUBLIC, the `supported_categories` tuple should contain all categories, including PUBLIC. Only when PUBLIC is the only category being used should it be omitted from `supported_categories`.
Applied to files:
holidays/utils.pyholidays/financial/ny_stock_exchange.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:
holidays/utils.pytests/test_docs.py
📚 Learning: 2025-09-14T16:02:15.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahamas.py:27-29
Timestamp: 2025-09-14T16:02:15.480Z
Learning: For Bahamas in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahamas.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
holidays/utils.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:
holidays/utils.pytests/test_docs.py
📚 Learning: 2025-09-14T16:19:23.651Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_antigua_and_barbuda.py:27-29
Timestamp: 2025-09-14T16:19:23.651Z
Learning: For Antigua and Barbuda in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=AntiguaAndBarbuda.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and AntiguaAndBarbuda doesn't define supported_categories.
Applied to files:
holidays/utils.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (`government`, `mandatory`, and `public`), which are utilized by syntactic sugar methods.
Applied to files:
holidays/utils.pyholidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (like `special_government_holidays`, `special_mandatory_holidays`, and `special_public_holidays`), which are utilized by syntactic sugar methods to pick up the appropriate holidays based on the selected category.
Applied to files:
holidays/utils.pyholidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-05T06:49:06.217Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.
Applied to files:
tests/financial/test_ny_stock_exchange.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:
tests/financial/test_ny_stock_exchange.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:
tests/financial/test_ny_stock_exchange.pyholidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-28T05:42:12.777Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.777Z
Learning: In tests/countries/test_indonesia.py, the manual set inclusion checks using get_named and years_found for Lunar New Year (test_lunar_new_year) and Vesak Day (test_vesak_day) are intentional and should remain until both holidays get their own `{insert}_no_estimated` flags implemented, rather than using standard harness assertions like assertHolidayName/assertNoHolidayName.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/financial/test_ny_stock_exchange.pyholidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: tests/countries/test_christmas_island.py:136-146
Timestamp: 2025-07-09T21:16:35.145Z
Learning: In Christmas Island's holiday implementation, the test_christmas_day method cannot use assertNoNonObservedHoliday because in some years observed Christmas Day overlaps with Boxing Day when both holidays are moved due to weekend conflicts, causing the standard non-observed holiday check to fail inappropriately.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
tests/financial/test_ny_stock_exchange.pyholidays/financial/ny_stock_exchange.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:
tests/financial/test_ny_stock_exchange.pyholidays/financial/ny_stock_exchange.pysnapshots/financial/XNYS.json
📚 Learning: 2025-05-06T21:07:11.577Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-04-05T04:29:38.042Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:85-86
Timestamp: 2025-04-05T04:29:38.042Z
Learning: For testing holiday implementations in the vacanza/holidays repository, recommend using `from tests.common import CommonCountryTests` as the base class instead of directly using `unittest.TestCase` to maintain consistency with project conventions and leverage common test utilities.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-04-05T04:50:40.752Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:31-49
Timestamp: 2025-04-05T04:50:40.752Z
Learning: For Turkmenistan holiday tests, use this class structure: `class TestTurkmenistan(CommonCountryTests, TestCase)` with imports `from unittest import TestCase`, `from holidays.countries import Turkmenistan, TM, TKM`, and `from tests.common import CommonCountryTests`. Ensure to call `super().setUp()` in the setUp method.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-09-18T03:19:23.722Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_algeria.py:28-30
Timestamp: 2025-09-18T03:19:23.722Z
Learning: In the vacanza/holidays project, tests now use self.start_year and self.end_year from the TestCase class instead of country-specific aliases (like DZ.start_year) for start_year and end_year references. This approach provides the test framework with better control over test year ranges rather than being tied to specific country start years.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-05-12T15:31:58.079Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2532
File: tests/countries/test_cocos_islands.py:78-89
Timestamp: 2025-05-12T15:31:58.079Z
Learning: In the holidays project, tests for movable holidays (like Easter Monday) should always use static date sets only, not calculation functions.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
tests/financial/test_ny_stock_exchange.pyholidays/financial/ny_stock_exchange.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:
tests/financial/test_ny_stock_exchange.pysnapshots/financial/XNYS.json
📚 Learning: 2025-09-03T18:29:09.398Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2820
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:76-76
Timestamp: 2025-09-03T18:29:09.398Z
Learning: The assertNoNonObservedHoliday method in tests/common.py accepts a holidays object as its first parameter, followed by the dates to check. Usage like assertNoNonObservedHoliday(self.government_holidays_non_observed, obs_dt) is correct and intended behavior.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-09-14T16:23:46.707Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_botswana.py:59-59
Timestamp: 2025-09-14T16:23:46.707Z
Learning: In Botswana's holiday tests, assertNonObservedHoliday(dt) is used to verify that certain holidays (like Easter holidays) stay on their original dates regardless of the observed holiday system, which is different from assertNoNonObservedHoliday that checks for absence of non-observed holidays.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-09-14T16:23:46.707Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_botswana.py:59-59
Timestamp: 2025-09-14T16:23:46.707Z
Learning: The method assertNonObservedHoliday(dt) is a valid assertion method in the holidays test framework that verifies holidays occur on their original (non-observed) dates, which is different from assertNoNonObservedHoliday that checks for absence of non-observed holidays. It's used to test that certain holidays stay on fixed dates regardless of observed holiday rules.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-11-27T13:47:31.850Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3088
File: tests/countries/test_dr_congo.py:55-65
Timestamp: 2025-11-27T13:47:31.850Z
Learning: In DR Congo's holiday implementation (tests/countries/test_dr_congo.py), the test_national_hero_patrice_emery_lumumba_day method cannot use assertNoNonObservedHoliday because when Jan 17 is observed on Jan 16 (in years 2016, 2021), that date already has another holiday: "Journée du héros national Laurent Désiré Kabila" (Jan 16). The observed holiday overlaps with an existing non-observed holiday, making the standard non-observed holiday check inappropriate.
<!--
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-11-27T13:48:37.538Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3088
File: tests/countries/test_dr_congo.py:162-168
Timestamp: 2025-11-27T13:48:37.538Z
Learning: In DR Congo's holiday implementation (tests/countries/test_dr_congo.py), the test_congolese_genocide_memorial_day method cannot use assertNoNonObservedHoliday because when Aug 2 is observed on Aug 1 (in year 2026), that date already has another holiday: "Fête des parents" (Aug 1). The observed holiday overlaps with an existing non-observed holiday, making the standard non-observed holiday check inappropriate.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, when testing holidays that start from a specific year (not the country's start_year), the standard pattern is to use `range(specific_year, self.end_year)` for the holiday dates and `assertNoHolidayName(name, range(self.start_year, specific_year))` for the gap period. Using `self.full_range` with year conditions like `if year >= specific_year` is not the established pattern and would be inconsistent with the codebase.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-09-03T14:05:10.592Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_aruba.py:77-79
Timestamp: 2025-09-03T14:05:10.592Z
Learning: The assertNoHolidayName helper method in the vacanza/holidays test framework accepts both individual years (scalars) and iterables of years, making calls like assertNoHolidayName(name, AW.start_year, range(2023, 2050)) valid where AW.start_year is a single integer year.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 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:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-11-28T02:24:17.418Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3088
File: tests/countries/test_gabon.py:88-110
Timestamp: 2025-11-28T02:24:17.418Z
Learning: For Gabon's holiday implementation (tests/countries/test_gabon.py), all Islamic holiday dates are currently estimates. Therefore, the correct test pattern is to use assertIslamicNoEstimatedHolidayName for both specific known dates and the full range (e.g., test_eid_al_fitr and test_eid_al_adha), rather than using assertHolidayName for specific dates followed by assertIslamicNoEstimatedHolidayName for the range.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2750
File: tests/countries/test_germany.py:46-46
Timestamp: 2025-07-24T15:21:31.632Z
Learning: In the holidays project test files, the standard method name for testing the absence of holidays is `test_no_holidays`, not more descriptive names like `test_no_holidays_before_1990`. This is a consistent naming convention across country test files like France and Germany.
Applied to files:
tests/financial/test_ny_stock_exchange.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:
tests/financial/test_ny_stock_exchange.pyholidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2829
File: tests/countries/test_canada.py:291-296
Timestamp: 2025-08-19T19:47:21.735Z
Learning: In the holidays library, HolidayBase objects automatically populate years on-demand when expand=True (the default). When checking dates from years not initially in the years range, those years are automatically populated via the logic at line 646 in holiday_base.py: "if self.expand and dt.year not in self.years:". This means tests can check dates outside the initial year range without needing separate holiday instances.
Applied to files:
tests/financial/test_ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.pypyproject.toml
📚 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:
holidays/financial/ny_stock_exchange.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 like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-26T14:43:53.605Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2851
File: docs/holiday_categories.md:272-282
Timestamp: 2025-08-26T14:43:53.605Z
Learning: In the holidays library documentation, it's strongly advisable to recommend the use of constants from holidays.constants (e.g., PUBLIC, CATHOLIC) instead of direct string values when specifying holiday categories, as constants provide better type safety, IDE support, and prevent typos.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-10-27T21:23:12.690Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3008
File: holidays/financial/_sifma.py:146-150
Timestamp: 2025-10-27T21:23:12.690Z
Learning: In the holidays library, `_christmas_day` is a property defined in the `ChristianHolidays` mixin class and is always available to any class that inherits from `ChristianHolidays`, regardless of whether `_populate_public_holidays` is called or which categories are requested. It does not depend on populating public holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.pysnapshots/financial/XNYS.json
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T18:17:24.626Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/algeria.py:46-49
Timestamp: 2025-09-03T18:17:24.626Z
Learning: In the holidays library, supported_categories tuples are ordered alphabetically rather than having PUBLIC listed first. For example, in Algeria's implementation, (CHRISTIAN, HEBREW, PUBLIC) follows alphabetical order and should not be reordered to put PUBLIC first.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-07T11:19:38.945Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:39-44
Timestamp: 2025-06-07T11:19:38.945Z
Learning: In the holidays library, it's standard practice to explicitly call ChristianHolidays.__init__(self) and InternationalHolidays.__init__(self) in country class __init__ methods, even when these mixins don't define their own __init__ methods. This follows the established codebase convention across all country implementations.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-14T04:36:25.108Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/chile.py:121-123
Timestamp: 2025-09-14T04:36:25.108Z
Learning: In the Chile holidays implementation, the MON_ONLY observance rule correctly implements Law 20.983 for January 2. MON_ONLY is defined as ObservedRule({TUE: None, WED: None, THU: None, FRI: None, SAT: None, SUN: None}), which means when _add_observed() is called with MON_ONLY, it removes holidays that fall on Tuesday through Sunday (via self.pop(dt)) and only keeps holidays that fall on Monday. This perfectly implements the law that January 2 is only a holiday when January 1 falls on Sunday.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.pysnapshots/financial/XNYS.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:
holidays/financial/ny_stock_exchange.pysnapshots/financial/XNYS.json
📚 Learning: 2025-06-21T16:30:12.749Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: holidays/countries/cape_verde.py:1-12
Timestamp: 2025-06-21T16:30:12.749Z
Learning: The holidays project does not use module docstrings in country holiday files. All country files start directly with the copyright header comment block without module docstrings, maintaining a consistent coding style across the project.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-01T17:58:53.279Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2583
File: holidays/countries/niger.py:1-1
Timestamp: 2025-06-01T17:58:53.279Z
Learning: In the holidays project, module-level docstrings are not required or needed for country holiday files in the holidays/countries/ directory.
Applied to files:
pyproject.toml
📚 Learning: 2025-04-26T19:55:09.581Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2501
File: scripts/docs/gen_index.py:1-12
Timestamp: 2025-04-26T19:55:09.581Z
Learning: The holidays project uses a standard header for all Python (.py) files in the repository that describes the overall holidays library, including authors, website and license information, regardless of the specific purpose of individual script files.
Applied to files:
pyproject.toml
📚 Learning: 2025-08-11T13:48:45.953Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/calendars/ethiopian.py:13-13
Timestamp: 2025-08-11T13:48:45.953Z
Learning: The holidays library does not use `__all__` declarations in calendar modules (holidays/calendars/). Calendar files follow a standard pattern of defining constants and functions directly without explicit exports, similar to the convention used in country modules.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-18T15:34:18.326Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/saint_pierre_and_miquelon.py:39-48
Timestamp: 2025-06-18T15:34:18.326Z
Learning: The holidays library does not use `__all__` declarations in country modules. Country files follow a standard pattern without explicit exports, and suggesting `__all__` goes against the established library-wide convention.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-10T12:43:10.577Z
Learnt from: ankushhKapoor
Repo: vacanza/holidays PR: 2601
File: holidays/calendars/mongolian.py:1-1
Timestamp: 2025-06-10T12:43:10.577Z
Learning: The holidays project's calendar files (in holidays/calendars/) follow a consistent pattern of NOT having module-level docstrings. They only use class-level docstrings for their main classes. When reviewing calendar files, maintain this consistency and do not suggest adding module docstrings.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-16T11:42:28.293Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2638
File: holidays/countries/svalbard_and_jan_mayen.py:1-12
Timestamp: 2025-06-16T11:42:28.293Z
Learning: In the holidays library codebase, country implementation files in holidays/countries/ follow a standard convention of NOT having module-level docstrings. They start with the license header comment block, followed by imports, then class definitions. This is consistent across all country implementations like austria.py, belgium.py, canada.py, etc.
Applied to files:
pyproject.toml
📚 Learning: 2025-08-09T18:31:23.218Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2778
File: tests/countries/test_kiribati.py:15-15
Timestamp: 2025-08-09T18:31:23.218Z
Learning: In the holidays project test files, the standard import pattern is `from holidays.countries.<country> import Country, CODE1, CODE2` (used in ~97% of test files), not `from holidays.countries import Country, CODE1, CODE2`. Only a few exceptions (Suriname, Sierra Leone, Mauritius, Mali, Ivory Coast, Guyana) use the aggregated import pattern.
Applied to files:
pyproject.toml
📚 Learning: 2025-08-20T19:46:15.625Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2833
File: tests/countries/test_uganda.py:15-0
Timestamp: 2025-08-20T19:46:15.625Z
Learning: In the holidays project, the standard import pattern for country test files is `from holidays.countries.<country> import Country, CODE1, CODE2` (direct module import), used by ~75% of country test files. Only a minority (~25%) use the aggregated public API import `from holidays.countries import Country, CODE1, CODE2`. The direct module import pattern should be used for new country test files to follow the established convention.
Applied to files:
pyproject.toml
📚 Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2774
File: tests/countries/test_liberia.py:15-16
Timestamp: 2025-08-08T14:37:03.045Z
Learning: In holidays/countries/__init__.py, re-export country classes using absolute imports (e.g., 'from holidays.countries.liberia import Liberia, LR, LBR') and keep alphabetical ordering (e.g., Lesotho, Liberia, Libya). Avoid relative imports in this file.
Applied to files:
pyproject.toml
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
pyproject.tomltests/test_docs.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:
snapshots/financial/XNYS.json
📚 Learning: 2025-03-06T12:36:48.071Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2297
File: holidays/countries/united_states.py:528-534
Timestamp: 2025-03-06T12:36:48.071Z
Learning: Georgia and Indiana commemorate Washington's Birthday on December 24, not in February like the federal holiday. This is why the code uses Christmas Day as a reference point with the GA_IN_WASHINGTON_BIRTHDAY rule.
Applied to files:
snapshots/financial/XNYS.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/financial/XNYS.json
📚 Learning: 2025-09-17T15:15:24.269Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2944
File: holidays/countries/myanmar.py:112-121
Timestamp: 2025-09-17T15:15:24.269Z
Learning: The Myanmar government's "continuous public days for 2024-2025" policy specifically covers Tabaung and Tazaungmon full moon days by bridging gaps with weekends, but does not apply to Myanmar New Year (Thingyan) extra days, which follow a separate policy that correctly uses `self._year >= 2024`.
Applied to files:
snapshots/financial/XNYS.json
📚 Learning: 2025-04-23T09:22:41.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2489
File: holidays/countries/sao_tome_and_principe.py:86-88
Timestamp: 2025-04-23T09:22:41.753Z
Learning: For holiday definitions in the holidays package, keep comments simple with just the holiday name (e.g., "# Independence Day.") rather than including dates or historical context, as the function names already encode the date information.
Applied to files:
snapshots/financial/XNYS.json
📚 Learning: 2025-11-08T05:36:32.788Z
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`.
Applied to files:
tests/test_docs.py
📚 Learning: 2025-09-14T16:10:02.766Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_djibouti.py:27-29
Timestamp: 2025-09-14T16:10:02.766Z
Learning: For Djibouti in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Djibouti.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Djibouti doesn't define supported_categories.
Applied to files:
tests/test_docs.py
📚 Learning: 2025-09-14T16:12:41.385Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_central_african_republic.py:27-29
Timestamp: 2025-09-14T16:12:41.385Z
Learning: For Central African Republic in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=CentralAfricanRepublic.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior and CentralAfricanRepublic doesn't define supported_categories.
Applied to files:
tests/test_docs.py
📚 Learning: 2025-05-09T18:33:25.676Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:39-39
Timestamp: 2025-05-09T18:33:25.676Z
Learning: The supported_languages tuples in country classes are intentionally sorted alphabetically, not by placing the default language first.
Applied to files:
tests/test_docs.py
🧬 Code graph analysis (4)
tests/financial/test_ny_stock_exchange.py (2)
holidays/calendars/gregorian.py (1)
_timedelta(37-42)holidays/holiday_base.py (1)
_is_weekday(894-899)
holidays/financial/ny_stock_exchange.py (3)
holidays/calendars/gregorian.py (1)
_timedelta(37-42)holidays/observed_holiday_base.py (1)
_add_observed(143-197)holidays/holiday_base.py (4)
_get_weekend(870-871)_is_weekend(901-908)_add_holiday(792-804)get(982-1005)
tests/test_docs.py (1)
holidays/holiday_base.py (2)
append(965-976)get(982-1005)
scripts/generate_snapshots.py (1)
holidays/utils.py (1)
financial_holidays(230-321)
🪛 Ruff (0.14.7)
tests/financial/test_ny_stock_exchange.py
348-348: Missing return type annotation for private function _make_special_holiday_list
(ANN202)
holidays/financial/ny_stock_exchange.py
63-63: Missing type annotation for **kwargs
(ANN003)
72-72: Missing return type annotation for private function _populate_ranged_holidays
Add return type annotation: None
(ANN202)
84-84: Missing return type annotation for private function _populate_public_holidays
Add return type annotation: None
(ANN202)
186-186: Missing return type annotation for private function _populate_half_day_holidays
Add return type annotation: None
(ANN202)
671-671: Comment contains ambiguous – (EN DASH). Did you mean - (HYPHEN-MINUS)?
(RUF003)
674-780: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
tests/test_docs.py
348-348: Use a regular assert instead of unittest-style assertEqual
Replace assertEqual(...) with assert ...
(PT009)
⏰ 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 Python 3.13 on windows-latest
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
- GitHub Check: Test Python 3.10 on windows-latest
🔇 Additional comments (16)
pyproject.toml (1)
111-113: Mypy override configuration aligns with existing patterns.The new override for
holidays.financial.*mirrors the established pattern forholidays.countries.*and appropriately disables the "override" error code to permit method overrides in the financial module hierarchy.Confirm that the
holidays.financial.*module path exists and contains classes with inherited method overrides that warrant this configuration.holidays/financial/ny_stock_exchange.py (3)
779-779: Potential duplicate entry for 2013-07-03.This special half-day entry duplicates the dynamic logic in
_populate_half_day_holidayswhich already handles "Day before Independence Day" from 1993 onwards. If intentional (e.g., for specific labeling), consider adding a comment.
54-70: Solid implementation of historical weekend and observed rules.The
supported_categories,_add_observedoverride, and_get_weekendimplementation correctly handle the NYSE's historical transition from Saturday trading to full weekend closure on September 29, 1952.
229-232: Potential issue: Verify 2-tuple argument handling in_is_weekday.
dt = (JUL, 4)is a 2-tuple being passed to_is_weekday(dt)and_is_monday(dt). Confirm whether these methods accept 2-tuples or require 3-tuples(year, month, day)with the year component.tests/test_docs.py (2)
287-293: Categories parsing logic follows established pattern.The implementation mirrors the country categories validation correctly - prepending PUBLIC and normalizing to lowercase.
345-355: Market categories validation properly added.Consistent with the existing country categories validation pattern. Good addition.
README.md (1)
1902-1956: Documentation properly updated for market categories.The new "Supported Categories" column is correctly structured and shows HALF_DAY for NYSE while leaving others empty. Consistent with implementation.
holidays/utils.py (1)
237-319: Clean addition of categories parameter.The implementation follows the existing
country_holidayspattern exactly - parameter addition, docstring, and forwarding to constructor. Well done.tests/financial/test_ny_stock_exchange.py (6)
16-35: LGTM!Imports and class setup follow project conventions. All imported constants and helpers are used appropriately in the test methods.
37-59: LGTM!Good coverage of New Year's Day with both observed dates and the negative cases for years when the Fri-before-Sat-holiday rule didn't apply.
355-574: LGTM!Comprehensive coverage of historical special closures. The helper method usage for date ranges (WWI, bank holidays, paperwork crisis) is clean and the Wednesday filter for paperwork crisis closures is historically accurate.
576-637: LGTM!Half-day tests are well structured. Good boundary testing for when rules started (1993/1995) and exception handling for years like 1996 and 2002 when July 3rd was used as observed Independence Day instead.
639-742: LGTM!Thorough coverage of historical half-day closures. The segmentation of paperwork crisis periods with appropriate day filters (Thursdays for early 1969, all weekdays after) reflects the actual NYSE schedule changes.
744-811: LGTM!Year-specific tests are well organized. Good separation of PUBLIC and HALF_DAY categories. Note that 2023 correctly omits Christmas Eve half-day since Dec 24, 2023 was a Sunday.
scripts/generate_snapshots.py (2)
100-112: LGTM!Worker correctly unpacks the new tuple structure and propagates
supported_categoriestofinancial_holidays(). Pattern aligns with the country snapshot worker.
152-159: LGTM!Work item construction correctly follows the country snapshot pattern - instantiates the market object to retrieve
supported_categoriesand passes it through to the worker.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
holidays/financial/ny_stock_exchange.py (1)
186-197: Duplicate label definitions noted in prior review.Acknowledged from previous feedback. Consider reusing constants from
NewYorkStockExchangeStaticHolidaysto reduce duplication.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
holidays/financial/ny_stock_exchange.py(7 hunks)
🧰 Additional context used
🧠 Learnings (40)
📓 Common learnings
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.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahamas.py:27-29
Timestamp: 2025-09-14T16:02:15.480Z
Learning: For Bahamas in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahamas.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahamas.py:27-29
Timestamp: 2025-09-14T16:02:15.480Z
Learning: For Bahamas in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahamas.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cuba.py:28-29
Timestamp: 2025-09-14T16:10:43.541Z
Learning: For Cuba in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=Cuba.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior.
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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Bahrain doesn't even define supported_categories.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
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.
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.
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.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2834
File: holidays/financial/national_stock_exchange_of_india.py:38-44
Timestamp: 2025-08-26T20:10:05.288Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, only `estimated_label = tr("%s (estimated)")` is needed for localization support. The `observed_label` and `observed_estimated_label` are not required for this financial market holidays implementation.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (`government`, `mandatory`, and `public`), which are utilized by syntactic sugar methods.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-25T10:12:30.448Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2676
File: holidays/countries/tunisia.py:25-25
Timestamp: 2025-06-25T10:12:30.448Z
Learning: The holidays library intentionally duplicates label strings like `estimated_label` across country modules rather than centralizing them. This duplication is the established library-wide approach and should not be suggested for refactoring.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T20:04:26.215Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:28-31
Timestamp: 2025-08-19T20:04:26.215Z
Learning: In the holidays library, message comments (comments describing message format templates like "%s (estimated)." and "%s (observed, estimated).") always end with a period, even when the corresponding string values do not include the period.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-10T04:32:15.760Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-23T09:22:41.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2489
File: holidays/countries/sao_tome_and_principe.py:86-88
Timestamp: 2025-04-23T09:22:41.753Z
Learning: For holiday definitions in the holidays package, keep comments simple with just the holiday name (e.g., "# Independence Day.") rather than including dates or historical context, as the function names already encode the date information.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T20:36:17.239Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2614
File: holidays/countries/guyana.py:114-116
Timestamp: 2025-06-14T20:36:17.239Z
Learning: In the holidays codebase, message comments should always use en_US spelling conventions, while translatable strings can use appropriate local spellings for the target country/region.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-10T04:02:13.815Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:249-253
Timestamp: 2025-05-10T04:02:13.815Z
Learning: Holiday name comments directly above tr() function calls in the holidays package should only contain the holiday name itself (e.g., "# Independence Day.") without any additional context, dates, or historical information.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T21:22:13.125Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:22:13.125Z
Learning: In the holidays library, message comments directly above holiday addition methods must match the holiday name exactly without any additions, modifications, or explanatory text. For example, if the holiday name is "Eid al-Fitr Holiday", the comment should be "# Eid al-Fitr Holiday." with no extra context.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-11T10:14:28.517Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/groups/christian.py:328-343
Timestamp: 2025-08-11T10:14:28.517Z
Learning: For Ethiopian holidays in the `holidays/groups/christian.py` file, docstring wording should maintain source-accurate phrasing (e.g., "in coincidence of" for Ethiopian New Year/Enkutatash), even when it might read awkwardly in English, to ensure consistency with official Ethiopian documentation.
Applied to files:
holidays/financial/ny_stock_exchange.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 like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-26T14:43:53.605Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2851
File: docs/holiday_categories.md:272-282
Timestamp: 2025-08-26T14:43:53.605Z
Learning: In the holidays library documentation, it's strongly advisable to recommend the use of constants from holidays.constants (e.g., PUBLIC, CATHOLIC) instead of direct string values when specifying holiday categories, as constants provide better type safety, IDE support, and prevent typos.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (like `special_government_holidays`, `special_mandatory_holidays`, and `special_public_holidays`), which are utilized by syntactic sugar methods to pick up the appropriate holidays based on the selected category.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-10-27T21:23:12.690Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3008
File: holidays/financial/_sifma.py:146-150
Timestamp: 2025-10-27T21:23:12.690Z
Learning: In the holidays library, `_christmas_day` is a property defined in the `ChristianHolidays` mixin class and is always available to any class that inherits from `ChristianHolidays`, regardless of whether `_populate_public_holidays` is called or which categories are requested. It does not depend on populating public holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.755Z
Learning: In the holidays framework, when no categories parameter is specified in a country class instantiation (e.g., `Georgia(years=2025)`), the PUBLIC category is used by default. There's no need to explicitly specify `categories=PUBLIC` or import the PUBLIC constant for such test cases.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T18:17:24.626Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/algeria.py:46-49
Timestamp: 2025-09-03T18:17:24.626Z
Learning: In the holidays library, supported_categories tuples are ordered alphabetically rather than having PUBLIC listed first. For example, in Algeria's implementation, (CHRISTIAN, HEBREW, PUBLIC) follows alphabetical order and should not be reordered to put PUBLIC first.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-07T11:19:38.945Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:39-44
Timestamp: 2025-06-07T11:19:38.945Z
Learning: In the holidays library, it's standard practice to explicitly call ChristianHolidays.__init__(self) and InternationalHolidays.__init__(self) in country class __init__ methods, even when these mixins don't define their own __init__ methods. This follows the established codebase convention across all country implementations.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-04T10:29:46.780Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2525
File: holidays/countries/togo.py:0-0
Timestamp: 2025-05-04T10:29:46.780Z
Learning: When a country class in the holidays library uses additional categories beyond PUBLIC, the `supported_categories` tuple should contain all categories, including PUBLIC. Only when PUBLIC is the only category being used should it be omitted from `supported_categories`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-14T04:36:25.108Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/chile.py:121-123
Timestamp: 2025-09-14T04:36:25.108Z
Learning: In the Chile holidays implementation, the MON_ONLY observance rule correctly implements Law 20.983 for January 2. MON_ONLY is defined as ObservedRule({TUE: None, WED: None, THU: None, FRI: None, SAT: None, SUN: None}), which means when _add_observed() is called with MON_ONLY, it removes holidays that fall on Tuesday through Sunday (via self.pop(dt)) and only keeps holidays that fall on Monday. This perfectly implements the law that January 2 is only a holiday when January 1 falls on Sunday.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-25T10:51:08.068Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:21-30
Timestamp: 2025-08-25T10:51:08.068Z
Learning: In the holidays library, references in country/market holiday implementations should be ordered as follows: Wikipedia links for the country/market holidays first, then country-specific official sources for newer implementations, then Wikipedia links for each individual non-standard holiday if any are required. Official government sources should not be placed first ahead of Wikipedia links.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
holidays/financial/ny_stock_exchange.py
🪛 Ruff (0.14.7)
holidays/financial/ny_stock_exchange.py
63-63: Missing type annotation for **kwargs
(ANN003)
72-72: Missing return type annotation for private function _populate_ranged_holidays
Add return type annotation: None
(ANN202)
84-84: Missing return type annotation for private function _populate_public_holidays
Add return type annotation: None
(ANN202)
186-186: Missing return type annotation for private function _populate_half_day_holidays
Add return type annotation: None
(ANN202)
674-780: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
🔇 Additional comments (7)
holidays/financial/ny_stock_exchange.py (7)
28-32: LGTM!Imports and
supported_categoriesare correctly set up. Categories follow alphabetical ordering as per codebase convention.Also applies to: 54-54
143-156: LGTM!Thanksgiving handling with year-specific dates is well-structured. The historical special dates (1865, 1869, 1939-1941) are properly handled before falling back to standard rules.
169-184: LGTM!The Saturday closure date ranges for 1944-1952 are cleanly implemented with the ranged holiday helper.
228-241: LGTM!The half-day holiday conditions are sound: July 3 is skipped when July 4 is Monday (no early close needed before a day off) or in years covered by
special_half_day_holidays. Christmas Eve follows the same pattern.
260-282: LGTM!Close time labels as class attributes enable consistent formatting across both static and dynamic half-day holidays.
659-672: Helpful documentation.The comments about non-implemented late opens and partial suspensions provide useful context for future maintainers.
67-82: Verify_get_weekendintegration with_is_weekend.The
_get_weekendmethod returns year-appropriate weekend days, but_populate_ranged_holidayscalls_is_weekend(dt)on line 80. Confirm the base class's_is_weekendactually invokes_get_weekendto ensure pre-1952 Saturday closures are handled correctly.
arkid15r
left a comment
There was a problem hiding this comment.
It's a tremendous work @KJhellico 👏
LGTM
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)
holidays/financial/ny_stock_exchange.py(7 hunks)
🧰 Additional context used
🧠 Learnings (47)
📓 Common learnings
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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/south_africa.py:69-75
Timestamp: 2025-09-14T07:26:25.431Z
Learning: When reviewing historical holiday implementations in the vacanza/holidays repository, trust the maintainers' research and implementation decisions for specific historical edge cases, especially when they can provide sources like Wikipedia or other historical documentation that supports unusual or complex date calculation rules during specific time periods.
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.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahamas.py:27-29
Timestamp: 2025-09-14T16:02:15.480Z
Learning: For Bahamas in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahamas.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahamas.py:27-29
Timestamp: 2025-09-14T16:02:15.480Z
Learning: For Bahamas in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahamas.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_cuba.py:28-29
Timestamp: 2025-09-14T16:10:43.541Z
Learning: For Cuba in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=Cuba.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Bahrain doesn't even define supported_categories.
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.
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.
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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-04T10:29:46.780Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2525
File: holidays/countries/togo.py:0-0
Timestamp: 2025-05-04T10:29:46.780Z
Learning: When a country class in the holidays library uses additional categories beyond PUBLIC, the `supported_categories` tuple should contain all categories, including PUBLIC. Only when PUBLIC is the only category being used should it be omitted from `supported_categories`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2834
File: holidays/financial/national_stock_exchange_of_india.py:38-44
Timestamp: 2025-08-26T20:10:05.288Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, only `estimated_label = tr("%s (estimated)")` is needed for localization support. The `observed_label` and `observed_estimated_label` are not required for this financial market holidays implementation.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-26T14:43:53.605Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2851
File: docs/holiday_categories.md:272-282
Timestamp: 2025-08-26T14:43:53.605Z
Learning: In the holidays library documentation, it's strongly advisable to recommend the use of constants from holidays.constants (e.g., PUBLIC, CATHOLIC) instead of direct string values when specifying holiday categories, as constants provide better type safety, IDE support, and prevent typos.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (`government`, `mandatory`, and `public`), which are utilized by syntactic sugar methods.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-25T10:12:30.448Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2676
File: holidays/countries/tunisia.py:25-25
Timestamp: 2025-06-25T10:12:30.448Z
Learning: The holidays library intentionally duplicates label strings like `estimated_label` across country modules rather than centralizing them. This duplication is the established library-wide approach and should not be suggested for refactoring.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-04T08:54:35.319Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_albania.py:40-42
Timestamp: 2025-09-04T08:54:35.319Z
Learning: In the vacanza/holidays project test files, extract holiday name strings to local variables only when they are reused multiple times within the same test method (e.g., used in both assertHolidayName and assertNoHolidayName calls). When a holiday name is used only once, keep it inline rather than extracting it to a variable for the sake of consistency.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2750
File: tests/countries/test_germany.py:46-46
Timestamp: 2025-07-24T15:21:31.632Z
Learning: In the holidays project test files, the standard method name for testing the absence of holidays is `test_no_holidays`, not more descriptive names like `test_no_holidays_before_1990`. This is a consistent naming convention across country test files like France and Germany.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-23T14:55:35.504Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T20:04:26.215Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:28-31
Timestamp: 2025-08-19T20:04:26.215Z
Learning: In the holidays library, message comments (comments describing message format templates like "%s (estimated)." and "%s (observed, estimated).") always end with a period, even when the corresponding string values do not include the period.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-10T04:32:15.760Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-23T09:22:41.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2489
File: holidays/countries/sao_tome_and_principe.py:86-88
Timestamp: 2025-04-23T09:22:41.753Z
Learning: For holiday definitions in the holidays package, keep comments simple with just the holiday name (e.g., "# Independence Day.") rather than including dates or historical context, as the function names already encode the date information.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T20:36:17.239Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2614
File: holidays/countries/guyana.py:114-116
Timestamp: 2025-06-14T20:36:17.239Z
Learning: In the holidays codebase, message comments should always use en_US spelling conventions, while translatable strings can use appropriate local spellings for the target country/region.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T21:22:13.125Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:22:13.125Z
Learning: In the holidays library, message comments directly above holiday addition methods must match the holiday name exactly without any additions, modifications, or explanatory text. For example, if the holiday name is "Eid al-Fitr Holiday", the comment should be "# Eid al-Fitr Holiday." with no extra context.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-10T04:02:13.815Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:249-253
Timestamp: 2025-05-10T04:02:13.815Z
Learning: Holiday name comments directly above tr() function calls in the holidays package should only contain the holiday name itself (e.g., "# Independence Day.") without any additional context, dates, or historical information.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-11T10:14:28.517Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/groups/christian.py:328-343
Timestamp: 2025-08-11T10:14:28.517Z
Learning: For Ethiopian holidays in the `holidays/groups/christian.py` file, docstring wording should maintain source-accurate phrasing (e.g., "in coincidence of" for Ethiopian New Year/Enkutatash), even when it might read awkwardly in English, to ensure consistency with official Ethiopian documentation.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-10-28T17:02:23.997Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3025
File: holidays/exceptions.py:14-25
Timestamp: 2025-10-28T17:02:23.997Z
Learning: Do not suggest adding return type annotations (such as `-> None` for `__init__` methods) in the vacanza/holidays codebase.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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 like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (like `special_government_holidays`, `special_mandatory_holidays`, and `special_public_holidays`), which are utilized by syntactic sugar methods to pick up the appropriate holidays based on the selected category.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-10-27T21:23:12.690Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3008
File: holidays/financial/_sifma.py:146-150
Timestamp: 2025-10-27T21:23:12.690Z
Learning: In the holidays library, `_christmas_day` is a property defined in the `ChristianHolidays` mixin class and is always available to any class that inherits from `ChristianHolidays`, regardless of whether `_populate_public_holidays` is called or which categories are requested. It does not depend on populating public holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.755Z
Learning: In the holidays framework, when no categories parameter is specified in a country class instantiation (e.g., `Georgia(years=2025)`), the PUBLIC category is used by default. There's no need to explicitly specify `categories=PUBLIC` or import the PUBLIC constant for such test cases.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T18:17:24.626Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/algeria.py:46-49
Timestamp: 2025-09-03T18:17:24.626Z
Learning: In the holidays library, supported_categories tuples are ordered alphabetically rather than having PUBLIC listed first. For example, in Algeria's implementation, (CHRISTIAN, HEBREW, PUBLIC) follows alphabetical order and should not be reordered to put PUBLIC first.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-07T11:19:38.945Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:39-44
Timestamp: 2025-06-07T11:19:38.945Z
Learning: In the holidays library, it's standard practice to explicitly call ChristianHolidays.__init__(self) and InternationalHolidays.__init__(self) in country class __init__ methods, even when these mixins don't define their own __init__ methods. This follows the established codebase convention across all country implementations.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
🧬 Code graph analysis (1)
holidays/financial/ny_stock_exchange.py (5)
holidays/calendars/gregorian.py (1)
_timedelta(37-42)holidays/observed_holiday_base.py (1)
_add_observed(143-197)holidays/holiday_base.py (2)
_add_holiday(792-804)get(982-1005)holidays/countries/south_africa.py (1)
_populate_public_holidays(44-151)holidays/countries/chile.py (1)
_populate_public_holidays(117-227)
🪛 Ruff (0.14.7)
holidays/financial/ny_stock_exchange.py
63-63: Missing type annotation for **kwargs
(ANN003)
72-72: Missing return type annotation for private function _populate_ranged_holidays
Add return type annotation: None
(ANN202)
84-84: Missing return type annotation for private function _populate_public_holidays
Add return type annotation: None
(ANN202)
186-186: Missing return type annotation for private function _populate_half_day_holidays
Add return type annotation: None
(ANN202)
677-783: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
⏰ 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). (5)
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.12 on windows-latest
- GitHub Check: Test Python 3.10 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
- GitHub Check: Test Python 3.13 on windows-latest
🔇 Additional comments (6)
holidays/financial/ny_stock_exchange.py (6)
28-32: LGTM!Imports and
supported_categoriestuple are correctly structured. The alphabetical ordering (HALF_DAY, PUBLIC) aligns with project conventions.Also applies to: 54-54
142-156: LGTM!Thanksgiving logic correctly handles the historical "Franksgiving" period (1939-1941) with explicit dates, uses 4th Thursday rule from 1942 onward, and falls back to last Thursday for earlier years.
231-236: LGTM!The exclusion of years 1996 and 2002 for the "Day before Independence Day" half-day is correct - these are handled as special cases in
special_half_day_holidays(lines 777, 780) with "Day after Independence Day" entries on July 5th.
663-675: Good documentation.The comment block clearly explains which late opens and partial suspensions are intentionally not implemented, with specific historical references. This helps future maintainers understand the scope boundaries.
720-722: LGTM!The unique close time formats for extraordinary events (JFK assassination at 2:07pm, Reagan attempt at 3:17pm, Con Edison failure at 3:28pm) appropriately reflect the actual historical times rather than normalized labels.
67-82:_get_weekendis defined but may not be utilized by_populate_ranged_holidays.The
_get_weekendmethod correctly encodes NYSE's historical Saturday closure change (trading Sunday-only pre-1952, Saturday-Sunday post-1952), but_populate_ranged_holidaysat line 80 calls_is_weekendrather than this custom logic. Verify whether_get_weekendis called elsewhere or should be integrated into the ranged holiday population logic; otherwise, it may be dead code.
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
holidays/financial/ny_stock_exchange.py (1)
186-197: Duplicate label definitions remain.These label definitions duplicate the class constants at lines 273-283. A past review (commit 942bb31) claimed this was addressed, but the duplication persists. Reuse the class constants:
def _populate_half_day_holidays(self): - # %s (markets close at 1:00pm). - close_1pm_label = "%s (markets close at 1:00pm)" - - # %s (markets close at 2:00pm). - close_2pm_label = "%s (markets close at 2:00pm)" - - # %s (markets close at 2:30pm). - close_2_30pm_label = "%s (markets close at 2:30pm)" - - # %s (markets close at 3:00pm). - close_3pm_label = "%s (markets close at 3:00pm)" + close_1pm_label = NewYorkStockExchangeStaticHolidays.close_1pm_label + close_2pm_label = NewYorkStockExchangeStaticHolidays.close_2pm_label + close_2_30pm_label = NewYorkStockExchangeStaticHolidays.close_2_30pm_label + close_3pm_label = NewYorkStockExchangeStaticHolidays.close_3pm_label
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
holidays/financial/ny_stock_exchange.py(7 hunks)
🧰 Additional context used
🧠 Learnings (55)
📓 Common learnings
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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: 2025-05-04T10:29:46.780Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2525
File: holidays/countries/togo.py:0-0
Timestamp: 2025-05-04T10:29:46.780Z
Learning: When a country class in the holidays library uses additional categories beyond PUBLIC, the `supported_categories` tuple should contain all categories, including PUBLIC. Only when PUBLIC is the only category being used should it be omitted from `supported_categories`.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2834
File: holidays/financial/national_stock_exchange_of_india.py:38-44
Timestamp: 2025-08-26T20:10:05.288Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, only `estimated_label = tr("%s (estimated)")` is needed for localization support. The `observed_label` and `observed_estimated_label` are not required for this financial market holidays implementation.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-26T14:43:53.605Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2851
File: docs/holiday_categories.md:272-282
Timestamp: 2025-08-26T14:43:53.605Z
Learning: In the holidays library documentation, it's strongly advisable to recommend the use of constants from holidays.constants (e.g., PUBLIC, CATHOLIC) instead of direct string values when specifying holiday categories, as constants provide better type safety, IDE support, and prevent typos.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.755Z
Learning: In the holidays framework, when no categories parameter is specified in a country class instantiation (e.g., `Georgia(years=2025)`), the PUBLIC category is used by default. There's no need to explicitly specify `categories=PUBLIC` or import the PUBLIC constant for such test cases.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (`government`, `mandatory`, and `public`), which are utilized by syntactic sugar methods.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-25T10:12:30.448Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2676
File: holidays/countries/tunisia.py:25-25
Timestamp: 2025-06-25T10:12:30.448Z
Learning: The holidays library intentionally duplicates label strings like `estimated_label` across country modules rather than centralizing them. This duplication is the established library-wide approach and should not be suggested for refactoring.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-04T08:54:35.319Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_albania.py:40-42
Timestamp: 2025-09-04T08:54:35.319Z
Learning: In the vacanza/holidays project test files, extract holiday name strings to local variables only when they are reused multiple times within the same test method (e.g., used in both assertHolidayName and assertNoHolidayName calls). When a holiday name is used only once, keep it inline rather than extracting it to a variable for the sake of consistency.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2750
File: tests/countries/test_germany.py:46-46
Timestamp: 2025-07-24T15:21:31.632Z
Learning: In the holidays project test files, the standard method name for testing the absence of holidays is `test_no_holidays`, not more descriptive names like `test_no_holidays_before_1990`. This is a consistent naming convention across country test files like France and Germany.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-23T14:55:35.504Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T20:04:26.215Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:28-31
Timestamp: 2025-08-19T20:04:26.215Z
Learning: In the holidays library, message comments (comments describing message format templates like "%s (estimated)." and "%s (observed, estimated).") always end with a period, even when the corresponding string values do not include the period.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-10T04:32:15.760Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-23T09:22:41.753Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2489
File: holidays/countries/sao_tome_and_principe.py:86-88
Timestamp: 2025-04-23T09:22:41.753Z
Learning: For holiday definitions in the holidays package, keep comments simple with just the holiday name (e.g., "# Independence Day.") rather than including dates or historical context, as the function names already encode the date information.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T20:36:17.239Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2614
File: holidays/countries/guyana.py:114-116
Timestamp: 2025-06-14T20:36:17.239Z
Learning: In the holidays codebase, message comments should always use en_US spelling conventions, while translatable strings can use appropriate local spellings for the target country/region.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-05-10T04:02:13.815Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:249-253
Timestamp: 2025-05-10T04:02:13.815Z
Learning: Holiday name comments directly above tr() function calls in the holidays package should only contain the holiday name itself (e.g., "# Independence Day.") without any additional context, dates, or historical information.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T21:22:13.125Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:22:13.125Z
Learning: In the holidays library, message comments directly above holiday addition methods must match the holiday name exactly without any additions, modifications, or explanatory text. For example, if the holiday name is "Eid al-Fitr Holiday", the comment should be "# Eid al-Fitr Holiday." with no extra context.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-11T10:14:28.517Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/groups/christian.py:328-343
Timestamp: 2025-08-11T10:14:28.517Z
Learning: For Ethiopian holidays in the `holidays/groups/christian.py` file, docstring wording should maintain source-accurate phrasing (e.g., "in coincidence of" for Ethiopian New Year/Enkutatash), even when it might read awkwardly in English, to ensure consistency with official Ethiopian documentation.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-10-28T17:02:23.997Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3025
File: holidays/exceptions.py:14-25
Timestamp: 2025-10-28T17:02:23.997Z
Learning: Do not suggest adding return type annotations (such as `-> None` for `__init__` methods) in the vacanza/holidays codebase.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-03T12:36:41.201Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
# Holiday name
self._add_holiday_function(tr("Holiday Name"))
```
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-12T18:40:16.160Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/countries/ethiopia.py:63-63
Timestamp: 2025-08-12T18:40:16.160Z
Learning: Ethiopian Epiphany (Timkat) date calculation correctly uses `is_ethiopian_leap_year(self._year - 1)` in the `_add_epiphany_day` helper in `holidays/groups/christian.py`. Since Epiphany occurs in January and belongs to the Ethiopian year that started in the previous Gregorian year, it checks Ethiopian leap year rules for `self._year - 1`. This is the proper approach, not using Gregorian leap year rules.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, when testing holidays that start from a specific year (not the country's start_year), the standard pattern is to use `range(specific_year, self.end_year)` for the holiday dates and `assertNoHolidayName(name, range(self.start_year, specific_year))` for the gap period. Using `self.full_range` with year conditions like `if year >= specific_year` is not the established pattern and would be inconsistent with the codebase.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-12T17:39:49.804Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/groups/international.py:0-0
Timestamp: 2025-08-12T17:39:49.804Z
Learning: Ethiopian New Year (Enkutatash) calculation correctly uses `is_ethiopian_leap_year(self._year)` instead of `isleap(self._year + 1)` to properly handle century edge cases. The Ethiopian function `(year + 1) % 4 == 0` checks if the next year is divisible by 4 using Julian/Ethiopian rules (no century exceptions), while `isleap()` applies Gregorian century rules. This difference is crucial around years like 2100 where the two calendar systems diverge.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, for holidays that start from a specific year (not the country's start_year), the standard pattern is to use `range(specific_year, self.end_year)` rather than `self.full_range` with year conditions. This maintains consistency across the codebase and clearly separates the holiday period from the pre-holiday period using `assertNoHolidayName(name, range(self.start_year, specific_year))`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-19T14:42:45.111Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2828
File: holidays/countries/australia.py:813-816
Timestamp: 2025-08-19T14:42:45.111Z
Learning: In the holidays library, when using _add_observed() method calls, there's no need to explicitly pass the rule parameter if it matches the class's default observed_rule. The default rule is set in __init__ specifically to avoid redundant explicit declarations, and should only be overridden when a different rule is needed.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-12T17:39:49.804Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/groups/international.py:0-0
Timestamp: 2025-08-12T17:39:49.804Z
Learning: Ethiopian New Year (Enkutatash) calculation uses `is_ethiopian_leap_year(self._year)` instead of `isleap(self._year + 1)` to properly handle century edge cases. Ethiopian leap years follow Julian rules (every 4 years without exception) while Gregorian leap years have century exceptions, causing different results around years like 2100.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/financial/ny_stock_exchange.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 like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-10-27T21:23:12.690Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 3008
File: holidays/financial/_sifma.py:146-150
Timestamp: 2025-10-27T21:23:12.690Z
Learning: In the holidays library, `_christmas_day` is a property defined in the `ChristianHolidays` mixin class and is always available to any class that inherits from `ChristianHolidays`, regardless of whether `_populate_public_holidays` is called or which categories are requested. It does not depend on populating public holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (like `special_government_holidays`, `special_mandatory_holidays`, and `special_public_holidays`), which are utilized by syntactic sugar methods to pick up the appropriate holidays based on the selected category.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T18:17:24.626Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/algeria.py:46-49
Timestamp: 2025-09-03T18:17:24.626Z
Learning: In the holidays library, supported_categories tuples are ordered alphabetically rather than having PUBLIC listed first. For example, in Algeria's implementation, (CHRISTIAN, HEBREW, PUBLIC) follows alphabetical order and should not be reordered to put PUBLIC first.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-07T11:19:38.945Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: holidays/countries/saint_vincent_and_the_grenadines.py:39-44
Timestamp: 2025-06-07T11:19:38.945Z
Learning: In the holidays library, it's standard practice to explicitly call ChristianHolidays.__init__(self) and InternationalHolidays.__init__(self) in country class __init__ methods, even when these mixins don't define their own __init__ methods. This follows the established codebase convention across all country implementations.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.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:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 Learning: 2025-09-14T04:36:25.108Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/chile.py:121-123
Timestamp: 2025-09-14T04:36:25.108Z
Learning: In the Chile holidays implementation, the MON_ONLY observance rule correctly implements Law 20.983 for January 2. MON_ONLY is defined as ObservedRule({TUE: None, WED: None, THU: None, FRI: None, SAT: None, SUN: None}), which means when _add_observed() is called with MON_ONLY, it removes holidays that fall on Tuesday through Sunday (via self.pop(dt)) and only keeps holidays that fall on Monday. This perfectly implements the law that January 2 is only a holiday when January 1 falls on Sunday.
Applied to files:
holidays/financial/ny_stock_exchange.py
📚 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:
holidays/financial/ny_stock_exchange.py
🧬 Code graph analysis (1)
holidays/financial/ny_stock_exchange.py (4)
holidays/calendars/gregorian.py (1)
_timedelta(37-42)tests/test_holiday_base.py (1)
_add_observed(43-50)holidays/observed_holiday_base.py (1)
_add_observed(143-197)holidays/holiday_base.py (3)
_get_weekend(870-871)_add_holiday(792-804)get(982-1005)
🪛 Ruff (0.14.7)
holidays/financial/ny_stock_exchange.py
63-63: Missing type annotation for **kwargs
(ANN003)
72-72: Missing return type annotation for private function _populate_ranged_holidays
Add return type annotation: None
(ANN202)
84-84: Missing return type annotation for private function _populate_public_holidays
Add return type annotation: None
(ANN202)
186-186: Missing return type annotation for private function _populate_half_day_holidays
Add return type annotation: None
(ANN202)
677-783: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
⏰ 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.14 on windows-latest
🔇 Additional comments (10)
holidays/financial/ny_stock_exchange.py (10)
67-70: Well-implemented historical weekend logic.Correctly handles the NYSE's transition from Sunday-only closures to Saturday-Sunday closures on September 29, 1952. The date-based check ensures accurate weekend determination across historical data.
72-82: Good abstraction for ranged holiday population.The helper cleanly handles date ranges with proper weekend and duplicate checking. Useful for the Paperwork Crisis closures and Saturday patterns.
143-157: Accurate Thanksgiving Day historical logic.Correctly implements the historical progression: special presidential declarations for specific years, the modern 4th Thursday rule starting in 1942, and the earlier last-Thursday pattern. Clean use of dictionary lookup with walrus operator.
163-184: Special closure patterns look accurate.The WWI closure, 1968 Paperwork Crisis (Wednesdays), and summer Saturday closures (1944-1952) are correctly implemented using the
_populate_ranged_holidayshelper with appropriate step values.
199-226: Paperwork Crisis periods correctly implemented.The phased early closures during the Paperwork Crisis (1968-1970) are well-structured with appropriate frequency (weekly Thursdays in early 1969, then daily) and progressively later close times as the backlog was addressed.
228-245: Regular half-day holidays correctly implemented.The logic for the three modern half-day holidays is sound:
- July 3: Early close when July 4 is Tue-Fri, with appropriate exceptions for 1996 and 2002 when July 5 was used instead (see lines 777, 780).
- Day after Thanksgiving: Always a half-day from 1993 onwards.
- Christmas Eve: Early close when Christmas is Tue-Fri, avoiding redundant closures when it's already a weekend or Monday.
288-380: Comprehensive set of holiday name constants.The expanded constants support the extensive historical data and follow consistent naming conventions. The renamings (
name_national_banking_holiday,name_vj_day) are improvements over the previous names.
384-661: Comprehensive historical holiday data.The expanded special public holidays cover nearly 150 years of NYSE history with well-documented special closures, Saturday trading cessation, and notable events. The data aligns with known historical events (Blizzard of 1888, V-J Day 1945, 9/11 closures, etc.).
663-675: Good documentation of scope limitations.Clearly documents that late opens and partial mid-day suspensions are not implemented, with helpful examples. This manages expectations for users reviewing historical data.
677-783: Detailed half-day closure history.The special half-day holidays provide rich historical context with specific close times for emergency events (JFK assassination at 2:07pm, Reagan attempt at 3:17pm) and graduated recovery periods (1987 market crash, Paperwork Crisis). The data structure follows the established pattern and supports the HALF_DAY category requirement.
|



Proposed change
Update XNYS (NYSE) holidays:
utils::financial_holidaysCloses #2976.
Type of change
holidaysfunctionality in general)Checklist
make checklocally; all checks and tests passed.