3
3
RedisError ,
4
4
)
5
5
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
12
7
from .helpers import list_or_args
13
8
14
9
@@ -158,16 +153,15 @@ class ClusterManagementCommands(ManagementCommands):
158
153
The class inherits from Redis's core ManagementCommands class and do the
159
154
required adjustments to work with cluster mode
160
155
"""
156
+
161
157
def slaveof (self , * args , ** kwargs ):
162
158
raise RedisClusterException ("SLAVEOF is not supported in cluster mode" )
163
159
164
160
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" )
167
162
168
163
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" )
171
165
172
166
173
167
class ClusterDataAccessCommands (DataAccessCommands ):
@@ -177,20 +171,43 @@ class ClusterDataAccessCommands(DataAccessCommands):
177
171
The class inherits from Redis's core DataAccessCommand class and do the
178
172
required adjustments to work with cluster mode
179
173
"""
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
+ ):
194
211
"""
195
212
A class for all Redis Cluster commands
196
213
0 commit comments