Fixes typing error identified by a new mypy release
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
+import datetime
from typing import List, Optional, Tuple
from uuid import UUID
@@ -16,7 +17,8 @@ class TaskEvent(BASE_TASK_EVENT, ORMMixin):
@classmethod
def get_summary(cls, task_id: UUID) -> List[TaskEventSummary]:
events = cls.search(query={"task_id": [task_id]})
- events.sort(key=lambda e: e.Timestamp)
+ # handle None case of Optional[e.Timestamp], which shouldn't happen
+ events.sort(key=lambda e: e.Timestamp or datetime.datetime.max)
return [
TaskEventSummary(
