summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@nic.cz>2019-06-17 14:09:38 +0200
committerVlastimil Zíma <vlastimil.zima@nic.cz>2019-06-17 14:09:38 +0200
commit4bd4181e1b6982fb6078d285c94e983a79bc3eb5 (patch)
tree76e6de4ec16988ac5f7c8d3851fd343d951eed38
parentcbd51c1904927e2a3f03cc4c921390d681f0aff8 (diff)
downloadopenid-4bd4181e1b6982fb6078d285c94e983a79bc3eb5.tar.gz
Fix flake8 warnings
-rw-r--r--openid/consumer/consumer.py2
-rw-r--r--openid/fetchers.py2
-rw-r--r--openid/test/test_cryptutil.py14
3 files changed, 6 insertions, 12 deletions
diff --git a/openid/consumer/consumer.py b/openid/consumer/consumer.py
index 86acd8f..275a08a 100644
--- a/openid/consumer/consumer.py
+++ b/openid/consumer/consumer.py
@@ -1185,7 +1185,7 @@ class GenericConsumer(object):
try:
assoc = self._requestAssociation(
endpoint, assoc_type, session_type)
- except ServerError as why:
+ except ServerError:
# Do not keep trying, since it rejected the
# association type that it told us to use.
_LOGGER.error('Server %s refused its suggested association type: session_type=%s, assoc_type=%s',
diff --git a/openid/fetchers.py b/openid/fetchers.py
index f8e6e37..8a10993 100644
--- a/openid/fetchers.py
+++ b/openid/fetchers.py
@@ -289,7 +289,7 @@ class CurlHTTPFetcher(HTTPFetcher):
# and the blank line from the end
empty_line = lines.pop()
if empty_line:
- raise HTTPError("No blank line at end of headers: %r" % (line,))
+ raise HTTPError("No blank line at end of headers: %r" % empty_line)
headers = {}
for line in lines:
diff --git a/openid/test/test_cryptutil.py b/openid/test/test_cryptutil.py
index eae2a1c..106be42 100644
--- a/openid/test/test_cryptutil.py
+++ b/openid/test/test_cryptutil.py
@@ -10,15 +10,9 @@ import six
from openid import cryptutil
+
# Most of the purpose of this test is to make sure that cryptutil can
# find a good source of randomness on this machine.
-if six.PY2:
- long_int = long
-else:
- assert six.PY3
- long_int = int
-
-
class TestLongBinary(unittest.TestCase):
"""Test `longToBinary` and `binaryToLong` functions."""
@@ -27,7 +21,7 @@ class TestLongBinary(unittest.TestCase):
for iteration in range(500):
n = 0
for i in range(10):
- n += long_int(random.randrange(MAX))
+ n += random.randrange(MAX)
s = cryptutil.longToBinary(n)
assert isinstance(s, six.binary_type)
@@ -101,7 +95,7 @@ class TestLongToBase64(unittest.TestCase):
try:
for line in f:
parts = line.strip().split(' ')
- assert parts[0] == cryptutil.longToBase64(long_int(parts[1]))
+ assert parts[0] == cryptutil.longToBase64(int(parts[1]))
finally:
f.close()
@@ -114,6 +108,6 @@ class TestBase64ToLong(unittest.TestCase):
try:
for line in f:
parts = line.strip().split(' ')
- assert long_int(parts[1]) == cryptutil.base64ToLong(parts[0])
+ assert int(parts[1]) == cryptutil.base64ToLong(parts[0])
finally:
f.close()