25 lines
612 B
Python
25 lines
612 B
Python
"""Accommodation."""
|
|
|
|
import yaml
|
|
|
|
from .event import Event
|
|
|
|
|
|
def get_events(filepath: str) -> list[Event]:
|
|
"""Get accommodation from YAML."""
|
|
with open(filepath) as f:
|
|
return [
|
|
Event(
|
|
date=item["from"],
|
|
end_date=item["to"],
|
|
name="accommodation",
|
|
title=(
|
|
f'{item["location"]} Airbnb'
|
|
if item.get("operator") == "airbnb"
|
|
else item["name"]
|
|
),
|
|
url=item.get("url"),
|
|
)
|
|
for item in yaml.safe_load(f)
|
|
]
|