Skip to content

Commit

Permalink
fix: remove dependency on pytz (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 authored Aug 13, 2021
1 parent 9e9d068 commit 972cc16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions google/cloud/pubsub_v1/subscriber/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import datetime as dt
import json
import math
import pytz
import time

from google.cloud.pubsub_v1.subscriber._protocol import requests
Expand Down Expand Up @@ -110,7 +109,7 @@ def __init__(self, message, ack_id, delivery_attempt, request_queue):
self._data = message.data
self._publish_time = dt.datetime.fromtimestamp(
message.publish_time.seconds + message.publish_time.nanos / 1e9,
tz=pytz.UTC,
tz=dt.timezone.utc,
)
self._ordering_key = message.ordering_key
self._size = message.ByteSize()
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/pubsub_v1/subscriber/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import time

import mock
import pytz

from google.api_core import datetime_helpers
from google.cloud.pubsub_v1.subscriber import message
Expand All @@ -26,7 +25,7 @@
from google.pubsub_v1 import types as gapic_types


RECEIVED = datetime.datetime(2012, 4, 21, 15, 0, tzinfo=pytz.utc)
RECEIVED = datetime.datetime(2012, 4, 21, 15, 0, tzinfo=datetime.timezone.utc)
RECEIVED_SECONDS = datetime_helpers.to_milliseconds(RECEIVED) // 1000
PUBLISHED_MICROS = 123456
PUBLISHED = RECEIVED + datetime.timedelta(days=1, microseconds=PUBLISHED_MICROS)
Expand Down

0 comments on commit 972cc16

Please sign in to comment.