Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for country subdivisions. #105

Merged

Conversation

wolterhv
Copy link

@wolterhv wolterhv commented Aug 8, 2024

This is a PR to implement quick and dirty support for country subdivisions. I've tested this for England (UK) and France, by setting holiday_country in my config.ini file to UnitedKingdom:England,France. As a result, I can see both holidays for England (UK) and for France.

Feel free to make suggestions to better fit this code to the repository style and best practice. I acknowledge my solution is quick and dirty.

To use a subdivision, specify country as COUNTRY:SUBDIVISION
in your configuration file.
try:
import holidays as hl
from holidays import registry

(country, subdivision) = get_country_and_subdivision(country)
Copy link
Author

Choose a reason for hiding this comment

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

Prior to this line, country would be set to either something like UnitedKingdom or UnitedKingdom:England. After this line, country is redefined to UnitedKingdom and subdivision is defined as England.

@anufrievroman
Copy link
Owner

Hi, thank you for the contribution! That looks pretty good.

@anufrievroman anufrievroman merged commit 8ebfd91 into anufrievroman:main Aug 12, 2024
@wolterhv
Copy link
Author

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants