File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import pickle
4
- from datetime import UTC , datetime , timedelta
4
+ from datetime import datetime , timedelta , timezone
5
5
from typing import Any
6
6
7
7
import google .protobuf .any_pb2
@@ -108,7 +108,7 @@ def unmarshal_any(any: google.protobuf.any_pb2.Any) -> Any:
108
108
return proto .value
109
109
110
110
elif isinstance (proto , google .protobuf .timestamp_pb2 .Timestamp ):
111
- return proto .ToDatetime (tzinfo = UTC )
111
+ return proto .ToDatetime (tzinfo = timezone . utc )
112
112
113
113
elif isinstance (proto , google .protobuf .duration_pb2 .Duration ):
114
114
return proto .ToTimedelta ()
Original file line number Diff line number Diff line change 1
1
import pickle
2
- from datetime import UTC , datetime , timedelta
2
+ from datetime import datetime , timedelta , timezone
3
3
4
4
from dispatch .any import INT64_MAX , INT64_MIN , marshal_any , unmarshal_any
5
5
from dispatch .sdk .v1 import error_pb2 as error_pb
@@ -70,7 +70,7 @@ def test_unmarshal_bytes():
70
70
71
71
72
72
def test_unmarshal_timestamp ():
73
- ts = datetime .fromtimestamp (1719372909.641448 , UTC )
73
+ ts = datetime .fromtimestamp (1719372909.641448 , timezone . utc )
74
74
boxed = marshal_any (ts )
75
75
assert "type.googleapis.com/google.protobuf.Timestamp" == boxed .type_url
76
76
assert ts == unmarshal_any (boxed )
You can’t perform that action at this time.
0 commit comments