Skip to content

Commit 972cc16

Browse files
authored
fix: remove dependency on pytz (#472)
For googleapis/python-api-core#250 Fixes #468.
1 parent 9e9d068 commit 972cc16

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

google/cloud/pubsub_v1/subscriber/message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import datetime as dt
1818
import json
1919
import math
20-
import pytz
2120
import time
2221

2322
from google.cloud.pubsub_v1.subscriber._protocol import requests
@@ -110,7 +109,7 @@ def __init__(self, message, ack_id, delivery_attempt, request_queue):
110109
self._data = message.data
111110
self._publish_time = dt.datetime.fromtimestamp(
112111
message.publish_time.seconds + message.publish_time.nanos / 1e9,
113-
tz=pytz.UTC,
112+
tz=dt.timezone.utc,
114113
)
115114
self._ordering_key = message.ordering_key
116115
self._size = message.ByteSize()

tests/unit/pubsub_v1/subscriber/test_message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import time
1818

1919
import mock
20-
import pytz
2120

2221
from google.api_core import datetime_helpers
2322
from google.cloud.pubsub_v1.subscriber import message
@@ -26,7 +25,7 @@
2625
from google.pubsub_v1 import types as gapic_types
2726

2827

29-
RECEIVED = datetime.datetime(2012, 4, 21, 15, 0, tzinfo=pytz.utc)
28+
RECEIVED = datetime.datetime(2012, 4, 21, 15, 0, tzinfo=datetime.timezone.utc)
3029
RECEIVED_SECONDS = datetime_helpers.to_milliseconds(RECEIVED) // 1000
3130
PUBLISHED_MICROS = 123456
3231
PUBLISHED = RECEIVED + datetime.timedelta(days=1, microseconds=PUBLISHED_MICROS)

0 commit comments

Comments
 (0)