-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract holiday getter helper to single function
- Loading branch information
Showing
3 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import holidays as pyholidays | ||
|
||
from neuralprophet import hdays as hdays_part2 | ||
|
||
|
||
def get_country_holidays(country, years): | ||
try: | ||
holidays_country = getattr(hdays_part2, country)(years=years) | ||
except AttributeError: | ||
try: | ||
holidays_country = getattr(pyholidays, country)(years=years) | ||
except AttributeError: | ||
raise AttributeError(f"Holidays in {country} are not currently supported!") | ||
|
||
return holidays_country |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters