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

Refactor Burundi holidays #925

Merged
merged 1 commit into from
Feb 7, 2023
Merged

Refactor Burundi holidays #925

merged 1 commit into from
Feb 7, 2023

Conversation

KJhellico
Copy link
Collaborator

No description provided.

@KJhellico KJhellico force-pushed the upd-burundi branch 2 times, most recently from 13dd35c to 303336b Compare February 3, 2023 13:14
@coveralls
Copy link

coveralls commented Feb 3, 2023

Coverage Status

Coverage: 100.0%. Remained the same when pulling 3d9d253 on KJhellico:upd-burundi into 57625d6 on dr-prodigy:beta.

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Marking as ready for beta!
Thank you!

for dt in _islamic_to_gre(year, 12, 10):
self[dt] = "Eid al Adha"

if self.observed:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know we have similar code in other 15+ countries and it may look like a good approach (the code is compact and quite readable). However, that's not the way the observed holidays handling should be implemented.

As python-holidays is a somewhat performance oriented library :) the goal is to focus on compatibility, performance, and code readability (probably, in this specific order).

The problem is in O(m*n) complexity for observed holidays logic. The more years you want to cover the longer it'll take (e.g., Burundi(years=range(1900, 2000) vs Burundi(years=range(0, 2000)). In general we try to avoid such kind of approaches.

I'm going to merge this PR as is as we'll need to tackle the entire problem anyway so one more country won't make a big difference. The main idea is to avoid applying the approach in future PRs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about it. I want to try remake some of such countries with _add_with_observed() mechanism (and individual processing rare cases).

@arkid15r arkid15r added the ready for beta Ready to merge on beta branch label Feb 6, 2023
@arkid15r arkid15r changed the title Burundi holidays refactoring Refactor Burundi holidays Feb 7, 2023
@arkid15r arkid15r merged commit 54e0843 into vacanza:beta Feb 7, 2023
@arkid15r arkid15r removed the ready for beta Ready to merge on beta branch label Feb 7, 2023
@arkid15r
Copy link
Collaborator

arkid15r commented Feb 7, 2023

Merged into beta!
Looking forward to reviewing _add_with_observed() refactoring.

@KJhellico KJhellico deleted the upd-burundi branch February 7, 2023 17:24
This was referenced Feb 20, 2023
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.

3 participants