Refactor
This commit is contained in:
parent
8df94aaafb
commit
69e10db8ef
3 changed files with 43 additions and 46 deletions
|
|
@ -36,7 +36,7 @@ from . import (
|
|||
uk_tz,
|
||||
waste_schedule,
|
||||
)
|
||||
from .types import Event, Holiday, StrDict
|
||||
from .types import Event, StrDict
|
||||
|
||||
here = dateutil.tz.tzlocal()
|
||||
|
||||
|
|
@ -274,9 +274,6 @@ async def get_data(
|
|||
result_list = await asyncio.gather(
|
||||
time_function("gbpusd", fx.get_gbpusd, config),
|
||||
time_function("gwr_advance_tickets", gwr.advance_ticket_date, data_dir),
|
||||
time_function(
|
||||
"bank_holiday", uk_holiday.bank_holiday_list, last_year, next_year, data_dir
|
||||
),
|
||||
time_function("rockets", thespacedevs.get_launches, rocket_dir, limit=40),
|
||||
time_function("backwell_bins", waste_collection_events, data_dir),
|
||||
time_function("bristol_bins", bristol_waste_collection_events, data_dir, today),
|
||||
|
|
@ -318,34 +315,13 @@ async def get_data(
|
|||
events.append(Event(name="gwr_advance_tickets", date=gwr_advance_tickets))
|
||||
|
||||
us_hols = holidays.us_holidays(last_year, next_year)
|
||||
|
||||
holiday_list: list[Holiday] = results["bank_holiday"] + us_hols
|
||||
for country in (
|
||||
"at",
|
||||
"be",
|
||||
"br",
|
||||
"ch",
|
||||
"cz",
|
||||
"de",
|
||||
"dk",
|
||||
"ee",
|
||||
"es",
|
||||
"fi",
|
||||
"fr",
|
||||
"gr",
|
||||
"it",
|
||||
"ke",
|
||||
"nl",
|
||||
"pl",
|
||||
):
|
||||
holiday_list += holidays.get_holidays(country, last_year, next_year)
|
||||
|
||||
events += holidays.get_nyse_holidays(last_year, next_year, us_hols)
|
||||
|
||||
accommodation_events = accommodation.get_events(
|
||||
os.path.join(my_data, "accommodation.yaml")
|
||||
)
|
||||
|
||||
holiday_list = holidays.get_all(last_year, next_year, data_dir)
|
||||
events += holidays.combine_holidays(holiday_list)
|
||||
events += birthday.get_birthdays(last_year, os.path.join(my_data, "entities.yaml"))
|
||||
events += accommodation_events
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue