File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import pickle
4- from datetime import UTC , datetime , timedelta
4+ from datetime import datetime , timedelta , timezone
55from typing import Any
66
77import google .protobuf .any_pb2
@@ -108,7 +108,7 @@ def unmarshal_any(any: google.protobuf.any_pb2.Any) -> Any:
108108 return proto .value
109109
110110 elif isinstance (proto , google .protobuf .timestamp_pb2 .Timestamp ):
111- return proto .ToDatetime (tzinfo = UTC )
111+ return proto .ToDatetime (tzinfo = timezone . utc )
112112
113113 elif isinstance (proto , google .protobuf .duration_pb2 .Duration ):
114114 return proto .ToTimedelta ()
Original file line number Diff line number Diff line change 11import pickle
2- from datetime import UTC , datetime , timedelta
2+ from datetime import datetime , timedelta , timezone
33
44from dispatch .any import INT64_MAX , INT64_MIN , marshal_any , unmarshal_any
55from dispatch .sdk .v1 import error_pb2 as error_pb
@@ -70,7 +70,7 @@ def test_unmarshal_bytes():
7070
7171
7272def test_unmarshal_timestamp ():
73- ts = datetime .fromtimestamp (1719372909.641448 , UTC )
73+ ts = datetime .fromtimestamp (1719372909.641448 , timezone . utc )
7474 boxed = marshal_any (ts )
7575 assert "type.googleapis.com/google.protobuf.Timestamp" == boxed .type_url
7676 assert ts == unmarshal_any (boxed )
You can’t perform that action at this time.
0 commit comments