Add missing subdivisions aliases #2520
Conversation
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis update reorganizes and enhances subdivision metadata for holiday classes across multiple countries. It introduces or expands subdivision alias dictionaries, adds or repositions Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (6)
🔇 Additional comments (23)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2520 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 215 215
Lines 13650 13663 +13
Branches 1930 1930
=========================================
+ Hits 13650 13663 +13 ☔ 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: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (31)
README.md(11 hunks)holidays/countries/american_samoa.py(1 hunks)holidays/countries/andorra.py(1 hunks)holidays/countries/argentina.py(2 hunks)holidays/countries/australia.py(2 hunks)holidays/countries/austria.py(1 hunks)holidays/countries/bolivia.py(1 hunks)holidays/countries/bosnia_and_herzegovina.py(2 hunks)holidays/countries/brazil.py(1 hunks)holidays/countries/canada.py(1 hunks)holidays/countries/chile.py(1 hunks)holidays/countries/el_salvador.py(2 hunks)holidays/countries/france.py(2 hunks)holidays/countries/germany.py(2 hunks)holidays/countries/guam.py(1 hunks)holidays/countries/india.py(2 hunks)holidays/countries/macau.py(1 hunks)holidays/countries/malaysia.py(2 hunks)holidays/countries/new_zealand.py(1 hunks)holidays/countries/nicaragua.py(2 hunks)holidays/countries/northern_mariana_islands.py(1 hunks)holidays/countries/portugal.py(2 hunks)holidays/countries/puerto_rico.py(1 hunks)holidays/countries/sao_tome_and_principe.py(2 hunks)holidays/countries/spain.py(1 hunks)holidays/countries/switzerland.py(1 hunks)holidays/countries/tuvalu.py(2 hunks)holidays/countries/united_states.py(2 hunks)holidays/countries/united_states_minor_outlying_islands.py(1 hunks)holidays/countries/united_states_virgin_islands.py(1 hunks)tests/test_docs.py(2 hunks)
⏰ Context from checks skipped due to timeout of 300000ms (1)
- GitHub Check: Test build on windows-latest
🔇 Additional comments (73)
holidays/countries/sao_tome_and_principe.py (3)
35-41: Subdivision tuple enriched with inline comments
The tuple now lists each code alongside its human‐readable name, greatly improving clarity.
43-53: Mapping full subdivision names to codes
The newsubdivisions_aliasescovers all districts and the autonomous region, ensuring reliable lookups and avoiding base‐class inheritance gaps.
54-54: Reorderedsupported_languagesfor consistency
Placingsupported_languagesaftersubdivisions_aliasesaligns attribute grouping with other country modules.holidays/countries/brazil.py (1)
35-36: Repositionedstart_yearfor clearer attribute grouping
Placingstart_yearimmediately afterdefault_languagematches the pattern in other country classes and improves readability. The decree comment succinctly documents the historical source.holidays/countries/bosnia_and_herzegovina.py (3)
64-66: Good addition of periods to subdivision comments.The addition of periods at the end of the subdivision comments provides better readability and maintains consistent punctuation style across the codebase.
68-75: Well-structured subdivision aliases dictionary.The addition of the
subdivisions_aliasesdictionary is a solid improvement. It maps both full names and common abbreviations to their corresponding subdivision codes, which enhances API usability by allowing flexibility in how users reference subdivisions.
76-76: Proper attribute reordering.Moving the
supported_languagesattribute after thesubdivisions_aliasesdictionary follows a logical organization pattern. This reordering creates consistency across different country modules and improves code readability.holidays/countries/portugal.py (3)
42-61: Good use of inline region comments
Adding descriptive comments next to each subdivision code greatly improves readability and maintainability. The annotations accurately map codes to their regions.
63-84: Well-defined subdivisions_aliases mapping
The newsubdivisions_aliasesdictionary complements thesubdivisionstuple and ensures lookup flexibility by name. All entries correctly correspond to their codes.
86-86: Attribute reordered for consistency
Moving_deprecated_subdivisionsimmediately aftersupported_languagesaligns with the grouping of class metadata attributes.holidays/countries/guam.py (1)
27-27: Override subdivisions_aliases to empty dict
Adds an explicitsubdivisions_aliases = {}to prevent Guam from inheriting US subdivision aliases. This aligns with other US‐territory classes.holidays/countries/puerto_rico.py (1)
27-27: Override subdivisions_aliases to empty dict
Explicitly settingsubdivisions_aliases = {}ensures Puerto Rico does not inherit US subdivision aliases, matching the pattern in other territories.holidays/countries/northern_mariana_islands.py (1)
27-27: Override subdivisions_aliases to empty dict
Addingsubdivisions_aliases = {}cleanly isolates the Northern Mariana Islands from US subdivisions, consistent with the other territory classes.holidays/countries/macau.py (1)
65-66: Reposition and annotatestart_year
Movingstart_year = 1982immediately afterdefault_languagewith a reference comment improves attribute grouping and consistency across country classes.holidays/countries/el_salvador.py (3)
30-31: Addstart_yearwith reference comment
Introducing# Labor Code 1972.andstart_year = 1973right afterdefault_languagefollows the standardized attribute ordering for clarity.
33-46: Define subdivision codes with comments
Listing all 14 subdivision codes with descriptive inline comments enhances readability and user guidance. Looks complete and well‐formatted.
64-64: Confirm supported language code
You’ve relocatedsupported_languagescorrectly. Please verify that"uk"(Ukrainian) is intended here and follows the project’s locale conventions.holidays/countries/bolivia.py (4)
43-43: Good repositioning ofstart_yearattribute.Moving the
start_yearattribute closer to the beginning of the class attributes improves code organization and makes it more consistent with other country classes.
45-53: Improved subdivision comments with trailing periods.The addition of trailing periods to subdivision comments enhances readability and maintains a consistent style throughout the codebase.
55-65: Appropriate addition ofsubdivisions_aliasesdictionary.This new dictionary mapping full subdivision names to their codes enhances the API by allowing users to reference subdivisions by their full names rather than just codes. This makes the library more user-friendly and intuitive.
66-66: Logical repositioning ofsupported_languages.Moving the
supported_languagestuple after all subdivision-related attributes creates a more consistent attribute ordering pattern across country classes.holidays/countries/france.py (2)
33-33: Good repositioning ofstart_yearattribute.Moving the
start_yearattribute to appear just belowdefault_languageimproves attribute organization and aligns with the standardized pattern being implemented across country classes.
62-62: Proper repositioning ofsupported_languages.Moving the
supported_languagestuple to after thesubdivisions_aliasesdictionary creates a more consistent attribute ordering pattern across country classes.holidays/countries/india.py (3)
49-50: Good improvement with labeled and positionedstart_year.Adding the comment about India's independence provides useful context for the
start_yearvalue, and placing it near the top of the class attributes follows the standardization pattern being implemented across country classes.
146-148: Appropriate repositioning of category and language attributes.Moving the
supported_categoriesandsupported_languagesafter the subdivision-related attributes improves attribute grouping consistency across country classes.
148-151: Good addition of_deprecated_subdivisions.Reintroducing the
_deprecated_subdivisionstuple ensures backwards compatibility while documenting which subdivision codes are no longer current, which is helpful for maintainers and users.holidays/countries/australia.py (3)
56-56: Good repositioning ofstart_yearattribute.Moving the
start_yearattribute to appear early in the class attributes list improves organization and follows the standardization pattern being implemented across country classes.
57-66: Enhanced subdivision documentation with descriptive comments.The reformatted
subdivisionstuple with detailed comments for each subdivision code significantly improves readability and makes the code more self-documenting. This is especially helpful for developers who might not be familiar with Australian state/territory codes.
77-78: Logical repositioning of category and language attributes.Moving the
supported_categoriesandsupported_languagesattributes after subdivision-related attributes creates a more consistent attribute ordering pattern across country classes.holidays/countries/nicaragua.py (2)
31-47: Great addition of inline comments for subdivisions.The detailed comments for each code improve readability and help other contributors quickly identify regions.
65-67: Aliases reordered to match subdivisions tuple.Swapping “Río San Juan” below “Rivas” aligns the alias dictionary order with the subdivisions tuple. The mapping logic remains correct.
holidays/countries/american_samoa.py (1)
26-27: Override subdivision aliases to isolate from US.Explicitly setting
subdivisions_aliases = {}ensures no US aliases bleed into American Samoa. Well aligned with the emptysubdivisionsoverride.holidays/countries/andorra.py (1)
35-43: Nice mapping of full names to codes.Introducing
subdivisions_aliasesenables name-to-code lookups for Andorra’s parishes. The entries mirror the subdivisions tuple perfectly.holidays/countries/united_states_minor_outlying_islands.py (1)
27-27: Consistent override of subdivision aliases.Adding
subdivisions_aliases = {}here matches the pattern in other US territories and correctly prevents inheritance.holidays/countries/austria.py (1)
63-64: Reordered metadata for clarity.Moving
supported_categoriesandsupported_languagesbelowsubdivisions_aliasesgroups related attributes and matches the structure used elsewhere.tests/test_docs.py (2)
104-104: Improved subdivision parsing logicThis change simplifies the parsing of subdivision aliases by directly splitting on semicolons, aligning with the updated README format where subdivision descriptions are more structured and detailed.
124-124: Simplified string strippingRemoved unnecessary characters from strip() to only remove whitespace, making the code cleaner and behavior more predictable.
holidays/countries/united_states_virgin_islands.py (1)
27-27: Good defensive programming practiceExplicitly overriding the US subdivisions_aliases with an empty dictionary prevents unintended inheritance of US subdivision aliases, which is consistent with the approach used in other US territories.
README.md (11)
180-180: Improved subdivision descriptions for AndorraAdded full parish names in parentheses, making the documentation more informative and user-friendly.
292-292: Enhanced Bolivia department namesAdded full department names for better clarity and usability.
362-362: Added bilingual names for Canadian provincesIncluding both English and French names for Canadian provinces and territories improves accessibility for both official language users.
376-376: Expanded Chilean region namesAdded full official names for Chilean regions, enhancing documentation completeness.
558-558: Used more accurate terminology for German subdivisionsChanged "States" to "Lands" which better reflects the German "Länder" concept.
692-692: Comprehensive Italian province listingProvided detailed province names and variants, significantly improving the usability of the documentation.
825-825: Enhanced Malaysian state informationAdded full state names and codes for better clarity and reference.
916-916: Added indigenous names for New Zealand regionsIncluding Māori names for regions shows cultural sensitivity and provides more complete information.
1154-1154: Improved Spanish autonomous community descriptionsAdded alternative names in different languages, reflecting Spain's multilingual character.
1182-1182: Enhanced Swiss canton informationAdded multilingual canton names to reflect Switzerland's linguistic diversity.
1280-1280: Complete US state and territory namesListed full names for all US states and territories, improving documentation clarity.
holidays/countries/new_zealand.py (2)
31-31: Improved attribute organizationMoving the
start_yearattribute closer to the top of the class groups related class-level attributes together, improving code organization and readability.
35-51: Enhanced subdivision documentationReformatted subdivision comments to use parentheses for Māori names instead of slashes, with better capitalization and spacing. This improves readability and cultural sensitivity while maintaining code clarity.
holidays/countries/spain.py (1)
58-76: Clear and consistent subdivisions listing
Thesubdivisionstuple is correctly ordered by ISO code and each entry is annotated with a descriptive comment. This improves readability and maintainability.holidays/countries/chile.py (2)
63-63: Addedstart_yearattribute
Placingstart_year = 1915abovesubdivisionsaligns with the pattern in other country modules and clearly documents the earliest supported year for Chile.
65-81: Descriptive subdivision comments
Each Chile subdivision code is now paired with its full name in a comment, which enhances discoverability and reduces guesswork when browsing the code.holidays/countries/united_states.py (2)
88-88: Introducedstart_yearattribute
Addingstart_year = 1777makes the earliest year explicit. Placement right afterobserved_labelis consistent with other country classes.
207-207: Reorderedsupported_categories
Movingsupported_categoriesbelowsubdivisions_aliasesimproves attribute grouping and readability.holidays/countries/argentina.py (2)
152-153: Repositioned and addedstart_year
Movingstart_year = 1957right after the observed label documents when Argentina’s modern holiday schedule began.
206-207: Reorderedsupported_languagesandsupported_categories
Relocating these attributes to followsubdivisions_aliasesmatches the organizational pattern used across other country modules.holidays/countries/tuvalu.py (2)
42-45: Annotated independence and act dates withstart_year
The comments clarify Tuvalu’s independence (1978) and the Public Holidays Amendment Act (1990). Definingstart_year = 1990immediately after these notes makes the timeline explicit.
68-68: Confirmedsupported_languagesplacement
Keepingsupported_languages = ("en_GB", "en_US", "tvl")aftersubdivisions_aliasesmaintains consistency with other country modules.holidays/countries/switzerland.py (3)
32-32: Explicit start_year attribute added.The addition of
start_year = 1801makes it clear when holidays for Switzerland begin to be calculated. This is a good improvement for consistency and clarity.
34-59: Improved subdivision documentation.Adding descriptive comments to each subdivision code enhances maintainability by making it easier to understand what each code represents without having to consult external documentation. The additional information about alternative names (e.g., "Bern (Berne)") is particularly useful for multilingual contexts.
61-93: Added comprehensive subdivision aliases.The new
subdivisions_aliasesdictionary provides a mapping between full canton names and their respective codes, including multilingual variants. This improves the API's usability by allowing users to reference subdivisions using full names rather than just codes.holidays/countries/germany.py (3)
38-38: Repositioned start_year attribute.Moving the
start_yearattribute to follow directly afterdefault_languageimproves consistency with other country classes and makes this important attribute more prominent.
40-55: Enhanced subdivision documentation.Adding descriptive comments to each German state improves code readability and makes it easier to understand what each subdivision code represents at a glance.
75-76: Repositioned supported categories and languages.Moving
supported_categoriesandsupported_languagesattributes to appear after the subdivisions information creates a more consistent attribute ordering pattern across country classes.holidays/countries/canada.py (4)
54-54: Added explicit start_year attribute.Setting
start_year = 1867makes it clear that Canadian holidays are calculated starting from the year of Confederation. This is a good addition for historical accuracy and consistency.
56-69: Enhanced subdivision documentation.The addition of descriptive comments for each Canadian province and territory, including both English and French names where applicable, significantly improves code readability and maintainability.
70-91: Added comprehensive subdivision aliases.The new
subdivisions_aliasesdictionary provides valuable mappings between full province/territory names and their respective codes, including French variants. This makes the API more user-friendly by allowing references using full names.
92-92: Repositioned supported_categories attribute.Moving the
supported_categoriesattribute to follow after the newsubdivisions_aliasesdictionary maintains a consistent attribute ordering pattern across country classes.holidays/countries/malaysia.py (3)
97-97: Added explicit start_year attribute.Setting
start_year = 1952aligns with when holidays for Malaysia began to be officially recognized after the Holidays Act 1951. This is a good addition for historical accuracy and consistency with other country classes.
99-114: Enhanced subdivision documentation.The addition of descriptive comments for each Malaysian state and federal territory significantly improves code readability and makes it clear what each subdivision code represents.
143-143: Updated federal territory alias names.Replacing abbreviated federal territory keys with their full official names ("Wilayah Persekutuan Kuala Lumpur", "Wilayah Persekutuan Labuan", "Wilayah Persekutuan Putrajaya") improves consistency and makes the aliases more formal and accurate.
Also applies to: 145-145, 147-147
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com> Signed-off-by: ~Jhellico <KJhellico@users.noreply.github.com>
|
Signed-off-by: ~Jhellico <KJhellico@users.noreply.github.com> Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Proposed change
Add subdivisions aliases where missing, reorder class attributes.
Type of change
holidaysfunctionality in general)Checklist
make check, all checks and tests are green