diff options
author | Alex Grönholm <alex.gronholm+git@nextday.fi> | 2012-08-07 01:25:39 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm+git@nextday.fi> | 2012-08-07 01:25:39 +0300 |
commit | e16cd9cbcb1eac1c078b79a1e81fb70aec96dc6b (patch) | |
tree | b9b9e68dc6445c3fcb4f51306a98f383ad7a3634 | |
parent | 4f2911456df2e84aee9fb71984a990b9f8f472f5 (diff) | |
download | redis-py-e16cd9cbcb1eac1c078b79a1e81fb70aec96dc6b.tar.gz |
Fixed PEP 8 violations introduced in previous commits
-rw-r--r-- | redis/_compat.py | 6 | ||||
-rw-r--r-- | redis/client.py | 5 | ||||
-rw-r--r-- | redis/connection.py | 3 | ||||
-rw-r--r-- | tests/__init__.py | 3 | ||||
-rw-r--r-- | tests/lock.py | 4 | ||||
-rw-r--r-- | tests/pipeline.py | 3 | ||||
-rw-r--r-- | tests/pubsub.py | 3 | ||||
-rw-r--r-- | tests/server_commands.py | 8 |
8 files changed, 23 insertions, 12 deletions
diff --git a/redis/_compat.py b/redis/_compat.py index ebc5999..d8af484 100644 --- a/redis/_compat.py +++ b/redis/_compat.py @@ -14,7 +14,8 @@ if sys.version_info[0] < 3: iteritems = lambda x: x.iteritems() dictkeys = lambda x: x.keys() dictvalues = lambda x: x.values() - nativestr = lambda x: x if isinstance(x, str) else x.encode('utf-8', 'replace') + nativestr = lambda x: \ + x if isinstance(x, str) else x.encode('utf-8', 'replace') u = lambda x: x.decode() b = lambda x: x next = lambda x: x.next() @@ -34,7 +35,8 @@ else: dictkeys = lambda x: list(x.keys()) dictvalues = lambda x: list(x.values()) byte_to_chr = lambda x: chr(x) - nativestr = lambda x: x if isinstance(x, str) else x.decode('utf-8', 'replace') + nativestr = lambda x: \ + x if isinstance(x, str) else x.decode('utf-8', 'replace') u = lambda x: x b = lambda x: x.encode('iso-8859-1') next = next diff --git a/redis/client.py b/redis/client.py index a4e6854..41aebf7 100644 --- a/redis/client.py +++ b/redis/client.py @@ -4,7 +4,8 @@ import datetime import time import warnings -from redis._compat import b, izip, imap, iteritems, dictkeys, dictvalues, basestring, long, nativestr +from redis._compat import (b, izip, imap, iteritems, dictkeys, dictvalues, + basestring, long, nativestr) from redis.connection import ConnectionPool, UnixDomainSocketConnection from redis.exceptions import ( ConnectionError, @@ -1500,7 +1501,7 @@ class BasePipeline(object): def _execute_transaction(self, connection, commands): all_cmds = b('').join(starmap(connection.pack_command, - [args for args, options in commands])) + [args for args, options in commands])) connection.send_packed_command(all_cmds) # we don't care about the multi/exec any longer commands = commands[1:-1] diff --git a/redis/connection.py b/redis/connection.py index 8aecc54..3574173 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -3,7 +3,8 @@ import os import socket import sys -from redis._compat import b, xrange, imap, byte_to_chr, unicode, bytes, long, BytesIO, nativestr +from redis._compat import (b, xrange, imap, byte_to_chr, unicode, bytes, long, + BytesIO, nativestr) from redis.exceptions import ( RedisError, ConnectionError, diff --git a/tests/__init__.py b/tests/__init__.py index fb73cde..616bdd4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -5,7 +5,8 @@ from tests.connection_pool import ConnectionPoolTestCase from tests.pipeline import PipelineTestCase from tests.lock import LockTestCase from tests.pubsub import PubSubTestCase, PubSubRedisDownTestCase -from tests.encoding import PythonParserEncodingTestCase, HiredisEncodingTestCase +from tests.encoding import (PythonParserEncodingTestCase, + HiredisEncodingTestCase) try: import hiredis diff --git a/tests/lock.py b/tests/lock.py index fc2d336..c328054 100644 --- a/tests/lock.py +++ b/tests/lock.py @@ -51,7 +51,9 @@ class LockTestCase(unittest.TestCase): def test_context_manager(self): with self.client.lock('foo'): - self.assertEquals(self.client['foo'], str(Lock.LOCK_FOREVER).encode()) + self.assertEquals( + self.client['foo'], + str(Lock.LOCK_FOREVER).encode()) self.assertEquals(self.client.get('foo'), None) def test_float_timeout(self): diff --git a/tests/pipeline.py b/tests/pipeline.py index 42ddad6..3c9142b 100644 --- a/tests/pipeline.py +++ b/tests/pipeline.py @@ -6,7 +6,8 @@ import redis class PipelineTestCase(unittest.TestCase): def setUp(self): - self.client = redis.Redis(host='localhost', port=6379, db=9, decode_responses=True) + self.client = redis.Redis(host='localhost', port=6379, db=9, + decode_responses=True) self.client.flushdb() def tearDown(self): diff --git a/tests/pubsub.py b/tests/pubsub.py index 90bf619..da16035 100644 --- a/tests/pubsub.py +++ b/tests/pubsub.py @@ -108,7 +108,8 @@ class PubSubTestCase(unittest.TestCase): class PubSubRedisDownTestCase(unittest.TestCase): def setUp(self): self.connection_pool = redis.ConnectionPool(port=6390) - self.client = redis.Redis(connection_pool=self.connection_pool, decode_responses=True) + self.client = redis.Redis(connection_pool=self.connection_pool, + decode_responses=True) self.pubsub = self.client.pubsub() def tearDown(self): diff --git a/tests/server_commands.py b/tests/server_commands.py index cbc802b..4498d2e 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -3,7 +3,8 @@ import unittest import datetime import time -from redis._compat import unichr, u, b, ascii_letters, iteritems, dictkeys, dictvalues +from redis._compat import (unichr, u, b, ascii_letters, iteritems, dictkeys, + dictvalues) from redis.client import parse_info import redis @@ -1098,7 +1099,7 @@ class ServerCommandsTestCase(unittest.TestCase): self.assertEquals(self.client.hincrby('a', 'a1'), 2) self.assertEquals(self.client.hincrby('a', 'a1', amount=2), 4) # negative values decrement - self.assertEquals(self.client.hincrby('a', 'a1', amount= -3), 1) + self.assertEquals(self.client.hincrby('a', 'a1', amount=-3), 1) # hash that exists, but key that doesn't self.assertEquals(self.client.hincrby('a', 'a2', amount=3), 3) # finally a key that's not an int @@ -1302,7 +1303,8 @@ class ServerCommandsTestCase(unittest.TestCase): self.assertTrue(self.client.rpush(key, c)) # check that KEYS returns all the keys as they are - self.assertEqual(sorted(self.client.keys('*')), sorted(dictkeys(mapping))) + self.assertEqual(sorted(self.client.keys('*')), + sorted(dictkeys(mapping))) # check that it is possible to get list content by key name for key in dictkeys(mapping): |