Skip to content

Commit e1e4d02

Browse files
vimallocjpadilla
authored andcommitted
Remove code no longer needed with python2.6 dropped
1 parent dad9a4c commit e1e4d02

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

jwt/api_jwt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from .api_jws import PyJWS
99
from .algorithms import Algorithm, get_default_algorithms # NOQA
10-
from .compat import string_types, timedelta_total_seconds
10+
from .compat import string_types
1111
from .exceptions import (
1212
DecodeError, ExpiredSignatureError, ImmatureSignatureError,
1313
InvalidAudienceError, InvalidIssuedAtError,
@@ -101,7 +101,7 @@ def _validate_claims(self, payload, options, audience=None, issuer=None,
101101
DeprecationWarning)
102102

103103
if isinstance(leeway, timedelta):
104-
leeway = timedelta_total_seconds(leeway)
104+
leeway = leeway.total_seconds()
105105

106106
if not isinstance(audience, (string_types, type(None))):
107107
raise TypeError('audience must be a string or None')

jwt/compat.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@
2121
string_types = (text_type, binary_type)
2222

2323

24-
def timedelta_total_seconds(delta):
25-
try:
26-
delta.total_seconds
27-
except AttributeError:
28-
# On Python 2.6, timedelta instances do not have
29-
# a .total_seconds() method.
30-
total_seconds = delta.days * 24 * 60 * 60 + delta.seconds
31-
else:
32-
total_seconds = delta.total_seconds()
33-
34-
return total_seconds
35-
36-
3724
try:
3825
constant_time_compare = hmac.compare_digest
3926
except AttributeError:

0 commit comments

Comments
 (0)