Refactor
This commit is contained in:
parent
8df94aaafb
commit
69e10db8ef
3 changed files with 43 additions and 46 deletions
|
|
@ -3,6 +3,7 @@
|
|||
import collections
|
||||
from datetime import date, timedelta
|
||||
|
||||
import agenda.uk_holiday
|
||||
import holidays
|
||||
|
||||
from .types import Event, Holiday
|
||||
|
|
@ -117,3 +118,33 @@ def combine_holidays(holidays: list[Holiday]) -> list[Event]:
|
|||
events.append(e)
|
||||
|
||||
return events
|
||||
|
||||
|
||||
def get_all(last_year: date, next_year: date, data_dir: str) -> list[Holiday]:
|
||||
"""Get holidays for various countries and return as a list."""
|
||||
us_hols = us_holidays(last_year, next_year)
|
||||
|
||||
bank_holidays = agenda.uk_holiday.bank_holiday_list(last_year, next_year, data_dir)
|
||||
|
||||
holiday_list: list[Holiday] = bank_holidays + us_hols
|
||||
for country in (
|
||||
"at",
|
||||
"be",
|
||||
"br",
|
||||
"ch",
|
||||
"cz",
|
||||
"de",
|
||||
"dk",
|
||||
"ee",
|
||||
"es",
|
||||
"fi",
|
||||
"fr",
|
||||
"gr",
|
||||
"it",
|
||||
"ke",
|
||||
"nl",
|
||||
"pl",
|
||||
):
|
||||
holiday_list += get_holidays(country, last_year, next_year)
|
||||
|
||||
return holiday_list
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue