Merge "timeutils: deprecate isotime()"

This commit is contained in:
Jenkins 2015-05-14 11:36:52 +00:00 committed by Gerrit Code Review
commit 3b5d6b7375
2 changed files with 23 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import calendar
import datetime
import time
from debtcollector import removals
import iso8601
from pytz import timezone
import six
@ -48,8 +49,17 @@ except AttributeError:
now = time.time
@removals.remove(
message="use datetime.datetime.isoformat()",
version="1.6",
removal_version="?",
)
def isotime(at=None, subsecond=False):
"""Stringify time in ISO 8601 format."""
"""Stringify time in ISO 8601 format.
.. deprecated:: > 1.5.0
Use :func:`utcnow` and :func:`datetime.datetime.isoformat` instead.
"""
if not at:
at = utcnow()
st = at.strftime(_ISO8601_TIME_FORMAT
@ -147,8 +157,18 @@ def utcnow():
return datetime.datetime.utcnow()
@removals.remove(
message="use datetime.datetime.utcfromtimestamp().isoformat()",
version="1.6",
removal_version="?",
)
def iso8601_from_timestamp(timestamp, microsecond=False):
"""Returns an iso8601 formatted date from timestamp."""
"""Returns an iso8601 formatted date from timestamp.
.. deprecated:: > 1.5.0
Use :func:`datetime.datetime.utcfromtimestamp` and
:func:`datetime.datetime.isoformat` instead.
"""
return isotime(datetime.datetime.utcfromtimestamp(timestamp), microsecond)

View File

@ -14,3 +14,4 @@ iso8601>=0.1.9
oslo.i18n>=1.5.0 # Apache-2.0
netaddr>=0.7.12
netifaces>=0.10.4
debtcollector>=0.3.0 # Apache-2.0