diff --git a/RELEASE.md b/RELEASE.md index 6ec1e81..c4e3618 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,6 +2,10 @@ All major changes in each released version of the archfx-cloud plugin are listed here. +## 0.13.0 + +- Removed unneed pytz dependency + ## 0.12.0 - Support `ArchFXFlexibleDictionaryReport` direct upload diff --git a/archfx_cloud/reports/flexible_dictionary.py b/archfx_cloud/reports/flexible_dictionary.py index e5a1d33..9e8dd25 100644 --- a/archfx_cloud/reports/flexible_dictionary.py +++ b/archfx_cloud/reports/flexible_dictionary.py @@ -3,7 +3,6 @@ import datetime from io import BytesIO from typing import List, Union -import pytz import msgpack from ..utils.slugs import ArchFxDeviceSlug from .exceptions import DataError @@ -135,7 +134,7 @@ def _encode_datetime(obj): """Pack a datetime into an isoformat string.""" if isinstance(obj, datetime.datetime): if obj.tzinfo: - obj = obj.astimezone(pytz.timezone('UTC')) + obj = obj.astimezone(datetime.timezone.utc) dt_str = obj.isoformat() if dt_str[-6] in ['-', '+']: return dt_str diff --git a/setup.py b/setup.py index 65e112b..e5e7875 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,6 @@ install_requires=[ 'requests>=2.21.0', 'python-dateutil', - 'pytz', 'msgpack>=1.0.2,<1.1', 'typedargs>=1.1.2,<2', ], diff --git a/tests/test_flexible_report.py b/tests/test_flexible_report.py index d8acaac..270c5a3 100644 --- a/tests/test_flexible_report.py +++ b/tests/test_flexible_report.py @@ -1,7 +1,6 @@ from datetime import datetime, timezone import unittest -import dateutil.parser import msgpack import requests_mock @@ -90,7 +89,7 @@ def test_report_usage(self): events = [] reading = ArchFXDataPoint( - timestamp=dateutil.parser.parse('2021-01-20T00:00:00.100000Z'), + timestamp=datetime(2021, 1, 20, 0, 0, 0, 100000, timezone.utc), stream='0001-5030', value=2.0, summary_data={'foo': 5, 'bar': 'foobar'}, @@ -99,7 +98,7 @@ def test_report_usage(self): ) events.append(reading) reading = ArchFXDataPoint( - timestamp=dateutil.parser.parse('2021-01-20T00:00:00.200000+00:00'), + timestamp=datetime(2021, 1, 20, 0, 0, 0, 200000, timezone.utc), stream=0x15030, value=3.0, summary_data={'foo': 6, 'bar': 'foobar'}, @@ -107,14 +106,14 @@ def test_report_usage(self): ) events.append(reading) reading = ArchFXDataPoint( - timestamp=dateutil.parser.parse('2021-01-20T00:00:00.200000+00:00'), + timestamp=datetime(2021, 1, 20, 0, 0, 0, 200000, timezone.utc), stream='5051', value=1.0, reading_id=1002 ) events.append(reading) - sent_time = dateutil.parser.parse('2021-01-20T00:00:00.300000Z') + sent_time = datetime(2021, 1, 20, 0, 0, 0, 300000, timezone.utc) report = ArchFXFlexibleDictionaryReport.FromReadings( device='d--1234', data=events, diff --git a/version.py b/version.py index 727f82d..af87af8 100644 --- a/version.py +++ b/version.py @@ -1 +1 @@ -version = '0.12.0' +version = '0.13.0'