summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoey Prat <roey.prat@redislabs.com>2018-10-17 15:36:04 +0300
committerRoey Prat <roey.prat@redislabs.com>2018-10-20 10:33:11 +0300
commit12aa0817ec8fa576b5b97a1fcff0aca4af0c85e6 (patch)
tree547a1dc2d4a9ed0d332bb296938b64671a4e8e3c
parent9edec9eab3b5bc79accaa9740350c5b223a7290f (diff)
downloadredis-py-12aa0817ec8fa576b5b97a1fcff0aca4af0c85e6.tar.gz
pycodestyle fixes in client
-rw-r--r--redis/_compat.py2
-rwxr-xr-xredis/client.py3
-rwxr-xr-xredis/connection.py10
3 files changed, 8 insertions, 7 deletions
diff --git a/redis/_compat.py b/redis/_compat.py
index 307f3cc..32063e7 100644
--- a/redis/_compat.py
+++ b/redis/_compat.py
@@ -4,7 +4,7 @@ import sys
try:
InterruptedError = InterruptedError
-except:
+except NameError:
InterruptedError = OSError
# For Python older than 3.5, retry EINTR.
diff --git a/redis/client.py b/redis/client.py
index ed57ffb..a69b847 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -195,7 +195,7 @@ def pairs_to_dict_typed(response, type_info):
if key in type_info:
try:
value = type_info[key](value)
- except:
+ except Exception:
# if for some reason the value can't be coerced, just use
# the string value
pass
@@ -326,6 +326,7 @@ def parse_zscan(response, **options):
it = iter(r)
return long(cursor), list(izip(it, imap(score_cast_func, it)))
+
def parse_slowlog_get(response, **options):
return [{
'id': item[0],
diff --git a/redis/connection.py b/redis/connection.py
index 6ad467a..1190260 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -236,7 +236,7 @@ class SocketBuffer(object):
try:
self.purge()
self._buffer.close()
- except:
+ except Exception:
# issue #633 suggests the purge/close somehow raised a
# BadFileDescriptor error. Perhaps the client ran out of
# memory or something else? It's probably OK to ignore
@@ -602,9 +602,9 @@ class Connection(object):
errmsg = e.args[1]
raise ConnectionError("Error %s while writing to socket. %s." %
(errno, errmsg))
- except:
+ except Exception as e:
self.disconnect()
- raise
+ raise e
def send_command(self, *args):
"Pack and send a command to the Redis server"
@@ -623,9 +623,9 @@ class Connection(object):
"Read the response from a previously sent command"
try:
response = self._parser.read_response()
- except:
+ except Exception as e:
self.disconnect()
- raise
+ raise e
if isinstance(response, ResponseError):
raise response
return response