Skip to content

Commit

Permalink
Remove code no longer needed with python2.6 dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
vimalloc committed Oct 19, 2017
1 parent 77f1fcc commit 1d495c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions jwt/api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .api_jws import PyJWS
from .algorithms import Algorithm, get_default_algorithms # NOQA
from .compat import string_types, timedelta_total_seconds
from .compat import string_types
from .exceptions import (
DecodeError, ExpiredSignatureError, ImmatureSignatureError,
InvalidAudienceError, InvalidIssuedAtError,
Expand Down Expand Up @@ -101,7 +101,7 @@ def _validate_claims(self, payload, options, audience=None, issuer=None,
DeprecationWarning)

if isinstance(leeway, timedelta):
leeway = timedelta_total_seconds(leeway)
leeway = leeway.total_seconds()

if not isinstance(audience, (string_types, type(None))):
raise TypeError('audience must be a string or None')
Expand Down
13 changes: 0 additions & 13 deletions jwt/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@
string_types = (text_type, binary_type)


def timedelta_total_seconds(delta):
try:
delta.total_seconds
except AttributeError:
# On Python 2.6, timedelta instances do not have
# a .total_seconds() method.
total_seconds = delta.days * 24 * 60 * 60 + delta.seconds
else:
total_seconds = delta.total_seconds()

return total_seconds


try:
constant_time_compare = hmac.compare_digest
except AttributeError:
Expand Down

0 comments on commit 1d495c9

Please sign in to comment.