diff options
| author | Roey Prat <roey.prat@redislabs.com> | 2018-10-17 15:36:04 +0300 |
|---|---|---|
| committer | Roey Prat <roey.prat@redislabs.com> | 2018-10-20 10:33:11 +0300 |
| commit | 12aa0817ec8fa576b5b97a1fcff0aca4af0c85e6 (patch) | |
| tree | 547a1dc2d4a9ed0d332bb296938b64671a4e8e3c | |
| parent | 9edec9eab3b5bc79accaa9740350c5b223a7290f (diff) | |
| download | redis-py-12aa0817ec8fa576b5b97a1fcff0aca4af0c85e6.tar.gz | |
pycodestyle fixes in client
| -rw-r--r-- | redis/_compat.py | 2 | ||||
| -rwxr-xr-x | redis/client.py | 3 | ||||
| -rwxr-xr-x | redis/connection.py | 10 |
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 |
