Skip to content

Commit 293be16

Browse files
committed
Fix flake complaints
1 parent 05133ff commit 293be16

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ develop: venv
1515

1616
analysis:
1717
. venv/bin/activate; flake8 --ignore=E123,E126,E128,E501,W391,W291,W293,F401 tests
18-
. venv/bin/activate; flake8 --ignore=F401,W391,W291,W293 twilio --max-line-length=300
18+
. venv/bin/activate; flake8 --ignore=E402,F401,W391,W291,W293 twilio --max-line-length=300
1919

20-
test:
20+
test: analysis
2121
. venv/bin/activate; \
2222
find tests -type d | xargs nosetests
2323

twilio/jwt/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,11 @@
1515
import simplejson as json
1616

1717
import time
18-
import base64
19-
from six import b
2018

2119

2220
__all__ = ['Jwt', 'JwtDecodeError']
2321

2422

25-
def base64url_encode(input):
26-
return base64.urlsafe_b64encode(input).decode('utf-8').replace('=', '')
27-
28-
29-
def base64url_decode(input):
30-
input += b('=') * (4 - (len(input) % 4))
31-
return base64.urlsafe_b64decode(input)
32-
33-
34-
def binary(txt):
35-
return txt.encode('utf-8')
36-
37-
3823
class JwtDecodeError(Exception):
3924
pass
4025

twilio/jwt/compat.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
##
2-
## PyJWT expects hmac.compare_digest to exist for all Python 3.x, however it was added in Python > 3.3
3-
## Copied from: https://github.com/python/cpython/commit/6cea65555caf2716b4633827715004ab0291a282#diff-c49659257ec1b129707ce47a98adc96eL16
4-
##
1+
2+
3+
#
4+
# PyJWT expects hmac.compare_digest to exist for all Python 3.x, however it was added in Python > 3.3
5+
# Copied from: https://github.com/python/cpython/commit/6cea65555caf2716b4633827715004ab0291a282#diff-c49659257ec1b129707ce47a98adc96eL16
6+
#
57
def compare_digest(a, b):
68
"""Returns the equivalent of 'a == b', but avoids content based short
79
circuiting to reduce the vulnerability to timing attacks."""
@@ -20,4 +22,4 @@ def compare_digest(a, b):
2022
result = 0
2123
for x, y in zip(a, b):
2224
result |= x ^ y
23-
return result == 0
25+
return result == 0

0 commit comments

Comments
 (0)