From f28a880c22e5265508e1894b3830cbc05ed8718b Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Fri, 7 Apr 2023 18:42:12 -0400
Subject: [PATCH] Add type annotations

---
 program/services.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/program/services.py b/program/services.py
index 9ec5d4ca..fc323d41 100644
--- a/program/services.py
+++ b/program/services.py
@@ -69,7 +69,7 @@ class ProjectedEntry(TypedDict):
     end: str
     error: str | None
     hash: str
-    solution_choices: set
+    solution_choices: set[str]
     start: str
 
 
@@ -422,9 +422,9 @@ def make_conflicts(data: ScheduleData, schedule_pk: int | None, show_pk: int) ->
 
     # Generate conflicts and add schedule
     conflicts = generate_conflicts(timeslots)
-    conflicts["schedule"] = model_to_dict(new_schedule)
 
-    return conflicts
+    # create a new dictionary by adding "schedule" to conflicts
+    return dict(conflicts, schedule=model_to_dict(new_schedule))
 
 
 def generate_timeslots(schedule: Schedule) -> list[TimeSlot]:
@@ -571,15 +571,14 @@ def generate_timeslots(schedule: Schedule) -> list[TimeSlot]:
     return timeslots
 
 
-# TODO: add type annotations
-def generate_conflicts(timeslots):
+def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
     """
     Tests a list of timeslot objects for colliding timeslots in the database
     Returns a list of conflicts containing dicts of projected timeslots, collisions and
     solutions
     """
 
-    conflicts = {}
+    conflicts: Conflicts = {}
     projected = []
     solutions = {}
 
-- 
GitLab