Remove method total_seconds in timeuitls
There is no consumer in downstream and in requirments project file upper-constraints shows oslo.utils==3.8.0 for Mitaka branch, so it is safe to remove it now. Change-Id: I44ae4ce59efbfe2fd060aa0ff0e0698470d5ad36
This commit is contained in:
parent
388a15e6c0
commit
8f5e65cae3
@ -231,11 +231,6 @@ class TimeUtilsTest(test_base.BaseTestCase):
|
||||
self.assertAlmostEquals(604859.123456,
|
||||
timeutils.delta_seconds(before, after))
|
||||
|
||||
def test_total_seconds(self):
|
||||
delta = datetime.timedelta(days=1, hours=2, minutes=3, seconds=4.5)
|
||||
self.assertAlmostEquals(93784.5,
|
||||
timeutils.total_seconds(delta))
|
||||
|
||||
def test_iso8601_from_timestamp(self):
|
||||
utcnow = timeutils.utcnow()
|
||||
iso = timeutils.isotime(utcnow)
|
||||
|
@ -298,24 +298,6 @@ def delta_seconds(before, after):
|
||||
return delta.total_seconds()
|
||||
|
||||
|
||||
@removals.remove(
|
||||
message="use datetime.timedelta.total_seconds()",
|
||||
version="3.1",
|
||||
removal_version="?",
|
||||
)
|
||||
def total_seconds(delta):
|
||||
"""Return the total seconds of datetime.timedelta object.
|
||||
|
||||
Compute total seconds of datetime.timedelta, datetime.timedelta
|
||||
doesn't have method total_seconds in Python2.6, calculate it manually.
|
||||
"""
|
||||
try:
|
||||
return delta.total_seconds()
|
||||
except AttributeError:
|
||||
return ((delta.days * 24 * 3600) + delta.seconds +
|
||||
float(delta.microseconds) / (10 ** 6))
|
||||
|
||||
|
||||
def is_soon(dt, window):
|
||||
"""Determines if time is going to happen in the next window seconds.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user