Skip to content

Commit 4175251

Browse files
committed
Fixed linters
1 parent 1bae757 commit 4175251

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

redis/cluster.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
import threading
77
import time
88
from collections import OrderedDict
9-
from redis.client import CaseInsensitiveDict, Redis, PubSub
10-
from redis.commands import RedisClusterCommands, CommandsParser
11-
from redis.connection import DefaultParser, ConnectionPool, Encoder, parse_url
12-
from redis.crc import key_slot, REDIS_CLUSTER_HASH_SLOTS
9+
10+
from redis.client import CaseInsensitiveDict, PubSub, Redis
11+
from redis.commands import CommandsParser, RedisClusterCommands
12+
from redis.connection import ConnectionPool, DefaultParser, Encoder, parse_url
13+
from redis.crc import REDIS_CLUSTER_HASH_SLOTS, key_slot
1314
from redis.exceptions import (
1415
AskError,
1516
BusyLoadingError,
@@ -671,7 +672,7 @@ def monitor(self, target_node=None):
671672
target_node = self.get_default_node()
672673
if target_node.redis_connection is None:
673674
raise RedisClusterException(
674-
"Cluster Node {0} has no redis_connection".format(target_node.name)
675+
f"Cluster Node {target_node.name} has no redis_connection"
675676
)
676677
return target_node.redis_connection.monitor()
677678

redis/commands/cluster.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from redis.exceptions import (
2-
RedisClusterException,
3-
RedisError,
4-
)
51
from redis.crc import key_slot
2+
from redis.exceptions import RedisClusterException, RedisError
3+
64
from .core import ACLCommands, DataAccessCommands, ManagementCommands, PubSubCommands
75
from .helpers import list_or_args
86

redis/commands/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def client_reply(self, reply, **kwargs):
458458
"""
459459
replies = ["ON", "OFF", "SKIP"]
460460
if reply not in replies:
461-
raise DataError("CLIENT REPLY must be one of %r" % replies)
461+
raise DataError(f"CLIENT REPLY must be one of {replies!r}")
462462
return self.execute_command("CLIENT REPLY", reply, **kwargs)
463463

464464
def client_id(self, **kwargs):
@@ -4405,7 +4405,7 @@ class ClusterCommands:
44054405
"""
44064406

44074407
def cluster(self, cluster_arg, *args, **kwargs):
4408-
return self.execute_command("CLUSTER %s" % cluster_arg.upper(), *args, **kwargs)
4408+
return self.execute_command(f"CLUSTER {cluster_arg.upper()}", *args, **kwargs)
44094409

44104410
def readwrite(self, **kwargs):
44114411
"""

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ def wait_for_command(client, monitor, command, key=None):
334334
if LooseVersion(redis_version) >= LooseVersion("5.0.0"):
335335
id_str = str(client.client_id())
336336
else:
337-
id_str = "%08x" % random.randrange(2 ** 32)
338-
key = "__REDIS-PY-%s__" % id_str
337+
id_str = f"{random.randrange(2 ** 32):08x}"
338+
key = f"__REDIS-PY-{id_str}__"
339339
client.get(key)
340340
while True:
341341
monitor_response = monitor.next_command()

0 commit comments

Comments
 (0)