Trip.duration and Trip.real_time_duration are now nullable

This commit is contained in:
Profitroll 2024-09-19 22:03:02 +02:00
parent 19971e6e71
commit 9e12b53c3b
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2

View File

@ -19,8 +19,10 @@ class Trip:
self.index: int = data["idx"]
self.id: str = data["tripId"]
self.ctx_recon: str = data["ctxRecon"]
self.duration: Union[Duration, timedelta] = parse_duration(data["duration"])
self.real_time_duration: Union[Duration, timedelta] = (
self.duration: Union[Duration, timedelta, None] = (
None if "duration" not in data else parse_duration(data["duration"])
)
self.real_time_duration: Union[Duration, timedelta, None] = (
None if "rtDuration" not in data else parse_duration(data["rtDuration"])
)
self.checksum: str = data["checksum"]