Fixes typing error identified by a new mypy release (#129)

This commit is contained in:
bmc-msft
2020-10-09 16:44:59 -04:00
committed by GitHub
parent 69832f727c
commit 1398285aea

View File

@ -3,6 +3,7 @@
# Copyright (c) Microsoft Corporation. # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License. # Licensed under the MIT License.
import datetime
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
from uuid import UUID from uuid import UUID
@ -16,7 +17,8 @@ class TaskEvent(BASE_TASK_EVENT, ORMMixin):
@classmethod @classmethod
def get_summary(cls, task_id: UUID) -> List[TaskEventSummary]: def get_summary(cls, task_id: UUID) -> List[TaskEventSummary]:
events = cls.search(query={"task_id": [task_id]}) 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 [ return [
TaskEventSummary( TaskEventSummary(