Skip to content

Commit b182920

Browse files
committed
Remove redundant code for Python 2.6
1 parent 6ebc779 commit b182920

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

cachecontrol/caches/redis_cache.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
from cachecontrol.cache import BaseCache
55

66

7-
def total_seconds(td):
8-
"""Python 2.6 compatability"""
9-
if hasattr(td, 'total_seconds'):
10-
return int(td.total_seconds())
11-
12-
ms = td.microseconds
13-
secs = (td.seconds + td.days * 24 * 3600)
14-
return int((ms + secs * 10**6) / 10**6)
15-
16-
177
class RedisCache(BaseCache):
188

199
def __init__(self, conn):
@@ -27,7 +17,7 @@ def set(self, key, value, expires=None):
2717
self.conn.set(key, value)
2818
else:
2919
expires = expires - datetime.utcnow()
30-
self.conn.setex(key, total_seconds(expires), value)
20+
self.conn.setex(key, int(expires.total_seconds()), value)
3121

3222
def delete(self, key):
3323
self.conn.delete(key)

0 commit comments

Comments
 (0)