Skip to content

Commit 1bae757

Browse files
committed
Reformatted files with black
1 parent 11ec84b commit 1bae757

File tree

9 files changed

+325
-260
lines changed

9 files changed

+325
-260
lines changed

redis/cluster.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
import time
88
from collections import OrderedDict
99
from redis.client import CaseInsensitiveDict, Redis, PubSub
10-
from redis.commands import (
11-
RedisClusterCommands,
12-
CommandsParser
13-
)
10+
from redis.commands import RedisClusterCommands, CommandsParser
1411
from redis.connection import DefaultParser, ConnectionPool, Encoder, parse_url
1512
from redis.crc import key_slot, REDIS_CLUSTER_HASH_SLOTS
1613
from redis.exceptions import (
@@ -674,8 +671,8 @@ def monitor(self, target_node=None):
674671
target_node = self.get_default_node()
675672
if target_node.redis_connection is None:
676673
raise RedisClusterException(
677-
"Cluster Node {0} has no redis_connection".
678-
format(target_node.name))
674+
"Cluster Node {0} has no redis_connection".format(target_node.name)
675+
)
679676
return target_node.redis_connection.monitor()
680677

681678
def pubsub(self, node=None, host=None, port=None, **kwargs):

redis/commands/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from .sentinel import SentinelCommands
77

88
__all__ = [
9-
'RedisClusterCommands',
10-
'CommandsParser',
11-
'CoreCommands',
12-
'list_or_args',
13-
'RedisModuleCommands',
14-
'SentinelCommands'
9+
"RedisClusterCommands",
10+
"CommandsParser",
11+
"CoreCommands",
12+
"list_or_args",
13+
"RedisModuleCommands",
14+
"SentinelCommands",
1515
]

redis/commands/cluster.py

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
RedisError,
44
)
55
from redis.crc import key_slot
6-
from .core import (
7-
ACLCommands,
8-
DataAccessCommands,
9-
ManagementCommands,
10-
PubSubCommands
11-
)
6+
from .core import ACLCommands, DataAccessCommands, ManagementCommands, PubSubCommands
127
from .helpers import list_or_args
138

149

@@ -158,16 +153,15 @@ class ClusterManagementCommands(ManagementCommands):
158153
The class inherits from Redis's core ManagementCommands class and do the
159154
required adjustments to work with cluster mode
160155
"""
156+
161157
def slaveof(self, *args, **kwargs):
162158
raise RedisClusterException("SLAVEOF is not supported in cluster mode")
163159

164160
def replicaof(self, *args, **kwargs):
165-
raise RedisClusterException("REPLICAOF is not supported in cluster"
166-
" mode")
161+
raise RedisClusterException("REPLICAOF is not supported in cluster" " mode")
167162

168163
def swapdb(self, *args, **kwargs):
169-
raise RedisClusterException("SWAPDB is not supported in cluster"
170-
" mode")
164+
raise RedisClusterException("SWAPDB is not supported in cluster" " mode")
171165

172166

173167
class ClusterDataAccessCommands(DataAccessCommands):
@@ -177,20 +171,43 @@ class ClusterDataAccessCommands(DataAccessCommands):
177171
The class inherits from Redis's core DataAccessCommand class and do the
178172
required adjustments to work with cluster mode
179173
"""
180-
def stralgo(self, algo, value1, value2, specific_argument='strings',
181-
len=False, idx=False, minmatchlen=None, withmatchlen=False,
182-
**kwargs):
183-
target_nodes = kwargs.pop('target_nodes', None)
184-
if specific_argument == 'strings' and target_nodes is None:
185-
target_nodes = 'default-node'
186-
kwargs.update({'target_nodes': target_nodes})
187-
return super().stralgo(algo, value1, value2, specific_argument,
188-
len, idx, minmatchlen, withmatchlen, **kwargs)
189-
190-
191-
class RedisClusterCommands(ClusterMultiKeyCommands, ClusterManagementCommands,
192-
ACLCommands, PubSubCommands,
193-
ClusterDataAccessCommands):
174+
175+
def stralgo(
176+
self,
177+
algo,
178+
value1,
179+
value2,
180+
specific_argument="strings",
181+
len=False,
182+
idx=False,
183+
minmatchlen=None,
184+
withmatchlen=False,
185+
**kwargs,
186+
):
187+
target_nodes = kwargs.pop("target_nodes", None)
188+
if specific_argument == "strings" and target_nodes is None:
189+
target_nodes = "default-node"
190+
kwargs.update({"target_nodes": target_nodes})
191+
return super().stralgo(
192+
algo,
193+
value1,
194+
value2,
195+
specific_argument,
196+
len,
197+
idx,
198+
minmatchlen,
199+
withmatchlen,
200+
**kwargs,
201+
)
202+
203+
204+
class RedisClusterCommands(
205+
ClusterMultiKeyCommands,
206+
ClusterManagementCommands,
207+
ACLCommands,
208+
PubSubCommands,
209+
ClusterDataAccessCommands,
210+
):
194211
"""
195212
A class for all Redis Cluster commands
196213

0 commit comments

Comments
 (0)