Skip to content

Commit 04784cb

Browse files
author
Roey Prat
committed
pycodestyle fixes in client
1 parent 07eacf3 commit 04784cb

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

redis/_compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
try:
66
InterruptedError = InterruptedError
7-
except:
7+
except NameError:
88
InterruptedError = OSError
99

1010
# For Python older than 3.5, retry EINTR.

redis/client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def pairs_to_dict_typed(response, type_info):
195195
if key in type_info:
196196
try:
197197
value = type_info[key](value)
198-
except:
198+
except Exception:
199199
# if for some reason the value can't be coerced, just use
200200
# the string value
201201
pass
@@ -326,6 +326,7 @@ def parse_zscan(response, **options):
326326
it = iter(r)
327327
return long(cursor), list(izip(it, imap(score_cast_func, it)))
328328

329+
329330
def parse_slowlog_get(response, **options):
330331
return [{
331332
'id': item[0],

redis/connection.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def close(self):
236236
try:
237237
self.purge()
238238
self._buffer.close()
239-
except:
239+
except Exception:
240240
# issue #633 suggests the purge/close somehow raised a
241241
# BadFileDescriptor error. Perhaps the client ran out of
242242
# memory or something else? It's probably OK to ignore
@@ -602,9 +602,9 @@ def send_packed_command(self, command):
602602
errmsg = e.args[1]
603603
raise ConnectionError("Error %s while writing to socket. %s." %
604604
(errno, errmsg))
605-
except:
605+
except Exception as e:
606606
self.disconnect()
607-
raise
607+
raise e
608608

609609
def send_command(self, *args):
610610
"Pack and send a command to the Redis server"
@@ -623,9 +623,9 @@ def read_response(self):
623623
"Read the response from a previously sent command"
624624
try:
625625
response = self._parser.read_response()
626-
except:
626+
except Exception as e:
627627
self.disconnect()
628-
raise
628+
raise e
629629
if isinstance(response, ResponseError):
630630
raise response
631631
return response

0 commit comments

Comments
 (0)