From 35a198fc1c389902514182103f42dd911a6e8f40 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Mon, 20 Jan 2025 16:33:52 +0100 Subject: [PATCH] Remove unused method iso8601_from_timestamp The last use of this method has been removed in d8afed9c46721cac6111b75a564d19b45119bbe0 . Change-Id: I2ce0af7efb6c96aef2a6496dee7fe96d447a0787 --- glance/common/timeutils.py | 8 -------- glance/tests/unit/common/test_timeutils.py | 9 --------- 2 files changed, 17 deletions(-) diff --git a/glance/common/timeutils.py b/glance/common/timeutils.py index 090233b25a..f41338927e 100644 --- a/glance/common/timeutils.py +++ b/glance/common/timeutils.py @@ -17,8 +17,6 @@ Time related utilities and helper functions. """ -import datetime - from oslo_utils import timeutils # ISO 8601 extended time format with microseconds @@ -38,9 +36,3 @@ def isotime(at=None, subsecond=False): # Need to handle either iso8601 or python UTC format st += ('Z' if tz in ['UTC', 'UTC+00:00'] else tz) return st - - -def iso8601_from_timestamp(timestamp, microsecond=False): - """Returns an iso8601 formatted date from timestamp.""" - return isotime(datetime.datetime.fromtimestamp( - timestamp, tz=datetime.timezone.utc).replace(tzinfo=None), microsecond) diff --git a/glance/tests/unit/common/test_timeutils.py b/glance/tests/unit/common/test_timeutils.py index 4d39aaabdb..92bfd1874e 100644 --- a/glance/tests/unit/common/test_timeutils.py +++ b/glance/tests/unit/common/test_timeutils.py @@ -13,12 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import calendar import datetime from unittest import mock -from oslo_utils import timeutils as oslo_timeutils - from glance.common import timeutils from glance.tests import utils as test_utils @@ -49,9 +46,3 @@ class TimeUtilsTest(test_utils.BaseTestCase): utcnow_mock.return_value = self.skynet_self_aware_ms_time dt = timeutils.isotime(subsecond=True) self.assertEqual(dt, self.skynet_self_aware_time_ms_str) - - def test_iso8601_from_timestamp(self): - utcnow = oslo_timeutils.utcnow() - iso = timeutils.isotime(utcnow) - ts = calendar.timegm(utcnow.timetuple()) - self.assertEqual(iso, timeutils.iso8601_from_timestamp(ts))