Merge "Use stdlib UTC"
This commit is contained in:
@@ -37,6 +37,7 @@ or https://identity.api.rackspacecloud.com/v1.0
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
from datetime import timezone
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -52,22 +53,6 @@ from keystoneauth1 import loading
|
|||||||
from keystoneauth1.identity import base
|
from keystoneauth1.identity import base
|
||||||
|
|
||||||
|
|
||||||
# stupid stdlib...
|
|
||||||
class _UTC(datetime.tzinfo):
|
|
||||||
def utcoffset(self, dt):
|
|
||||||
return datetime.timedelta(0)
|
|
||||||
|
|
||||||
def tzname(self, dt):
|
|
||||||
return "UTC"
|
|
||||||
|
|
||||||
def dst(self, dt):
|
|
||||||
return datetime.timedelta(0)
|
|
||||||
|
|
||||||
|
|
||||||
UTC = _UTC()
|
|
||||||
del _UTC
|
|
||||||
|
|
||||||
|
|
||||||
class ServiceCatalogV1:
|
class ServiceCatalogV1:
|
||||||
def __init__(self, auth_url, storage_url, account):
|
def __init__(self, auth_url, storage_url, account):
|
||||||
self.auth_url = auth_url
|
self.auth_url = auth_url
|
||||||
@@ -171,11 +156,11 @@ class AccessInfoV1:
|
|||||||
def expires(self):
|
def expires(self):
|
||||||
if self._expires is None:
|
if self._expires is None:
|
||||||
return None
|
return None
|
||||||
return datetime.datetime.fromtimestamp(self._expires, UTC)
|
return datetime.datetime.fromtimestamp(self._expires, timezone.utc)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def issued(self):
|
def issued(self):
|
||||||
return datetime.datetime.fromtimestamp(self._issued, UTC)
|
return datetime.datetime.fromtimestamp(self._issued, timezone.utc)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def user_id(self):
|
def user_id(self):
|
||||||
|
Reference in New Issue
Block a user