py39 compatibility

This commit is contained in:
root 2024-12-28 15:59:02 +01:00
parent d4d266e7c5
commit 0ce96c608e

View file

@ -13,6 +13,7 @@ import sys
from argparse import ArgumentParser
from pathlib import Path
from subprocess import check_output
from typing import Optional
import pytz
from icalendar import Calendar, Event
@ -79,7 +80,7 @@ class IcsNow:
return []
return Calendar.from_ical(result, multiple=True)
def pick_most_important(self, events: list[Event]) -> Event | None:
def pick_most_important(self, events: list[Event]) -> Optional[Event]:
if not events:
return None
# FIXME: sort by priority
@ -115,7 +116,7 @@ class IcsNow:
json.dump(ret, sys.stdout, indent=2)
sys.stdout.write("\n")
def serialize(self, event: Event | None):
def serialize(self, event: Optional[Event]):
if event is None:
return None
out = {