Add missing code

This commit is contained in:
Edward Betts 2023-11-07 16:56:47 +01:00
parent ac456ce5be
commit 5c51751111

24
agenda/accommodation.py Normal file
View file

@ -0,0 +1,24 @@
"""Accomodation"""
import yaml
from .types import Event
def get_events(filepath: str) -> list[Event]:
"""Get accomodation 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["operator"] == "airbnb"
else item["name"]
),
url=item.get("url"),
)
for item in yaml.safe_load(f)
]