Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove dependency on pytz #472

Merged
merged 3 commits into from Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions google/cloud/pubsub_v1/subscriber/message.py
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
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