agenda/agenda/subscription.py

26 lines
528 B
Python

"""Subscriptions."""
import yaml
from .event import Event
def get_events(filepath: str) -> list[Event]:
"""Get subscription renewal dates."""
events = []
with open(filepath) as f:
items = yaml.safe_load(f)
for item in items:
if "renewal_date" not in item:
continue
events.append(
Event(
date=item["renewal_date"],
name="subscription",
title=item["name"] + " renewal",
)
)
return events