Skip to content

Commit

Permalink
Remove builtins import to support GAE
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Davis committed Jun 15, 2016
1 parent 080fc36 commit 3dcc942
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions jose/jwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import hmac
import struct
import six

from builtins import int
import sys

import Crypto.Hash.SHA256
import Crypto.Hash.SHA384
Expand All @@ -28,6 +27,11 @@
else:
_RSAKey = RSA.RsaKey

# Deal with integer compatibilities between Python 2 and 3.
# Using `from builtins import int` is not supported on AppEngine.
if sys.version_info > (3,):
long = int


def get_algorithm_object(algorithm):
"""
Expand Down Expand Up @@ -65,7 +69,7 @@ def get_algorithm_object(algorithm):


def int_arr_to_long(arr):
return int(''.join(["%02x" % byte for byte in arr]), 16)
return long(''.join(["%02x" % byte for byte in arr]), 16)


def base64_to_long(data):
Expand Down

0 comments on commit 3dcc942

Please sign in to comment.