Skip to content

Commit a0acc62

Browse files
committed
Replace black with ruff format; run it
1 parent c447df5 commit a0acc62

29 files changed

+65
-75
lines changed

benchmarks/basic_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def wrapper(*args, **kwargs):
5454
count = args[1]
5555
print(f"{func.__name__} - {count} Requests")
5656
print(f"Duration = {duration}")
57-
print(f"Rate = {count/duration}")
57+
print(f"Rate = {count / duration}")
5858
print()
5959
return ret
6060

benchmarks/command_packer_benchmark.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def pack_command(self, *args):
7878

7979

8080
class CommandPackerBenchmark(Benchmark):
81-
8281
ARGUMENTS = (
8382
{
8483
"name": "connection_class",

benchmarks/socket_read_size.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class SocketReadBenchmark(Benchmark):
7-
87
ARGUMENTS = (
98
{"name": "parser", "values": [PythonParser, _HiredisParser]},
109
{

redis/_parsers/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
from .encoders import Encoder
3333
from .socket import SERVER_CLOSED_CONNECTION_ERROR, SocketBuffer
3434

35-
MODULE_LOAD_ERROR = "Error loading the extension. " "Please check the server logs."
35+
MODULE_LOAD_ERROR = "Error loading the extension. Please check the server logs."
3636
NO_SUCH_MODULE_ERROR = "Error unloading module: no such module with that name"
37-
MODULE_UNLOAD_NOT_POSSIBLE_ERROR = "Error unloading module: operation not " "possible."
37+
MODULE_UNLOAD_NOT_POSSIBLE_ERROR = "Error unloading module: operation not possible."
3838
MODULE_EXPORTS_DATA_TYPES_ERROR = (
3939
"Error unloading module: the module "
4040
"exports one or more module-side data "

redis/asyncio/cluster.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,9 +1154,7 @@ def get_node(
11541154
return self.nodes_cache.get(node_name)
11551155
else:
11561156
raise DataError(
1157-
"get_node requires one of the following: "
1158-
"1. node name "
1159-
"2. host and port"
1157+
"get_node requires one of the following: 1. node name 2. host and port"
11601158
)
11611159

11621160
def set_nodes(
@@ -1338,7 +1336,7 @@ async def initialize(self) -> None:
13381336
if len(disagreements) > 5:
13391337
raise RedisClusterException(
13401338
f"startup_nodes could not agree on a valid "
1341-
f'slots cache: {", ".join(disagreements)}'
1339+
f"slots cache: {', '.join(disagreements)}"
13421340
)
13431341

13441342
# Validate if all slots are covered or if we should try next startup node

redis/auth/token.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def get_received_at_ms(self) -> float:
7878

7979

8080
class JWToken(TokenInterface):
81-
8281
REQUIRED_FIELDS = {"exp"}
8382

8483
def __init__(self, token: str):

redis/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,8 +1514,7 @@ def raise_first_error(self, commands, response):
15141514
def annotate_exception(self, exception, number, command):
15151515
cmd = " ".join(map(safe_str, command))
15161516
msg = (
1517-
f"Command # {number} ({cmd}) of pipeline "
1518-
f"caused error: {exception.args[0]}"
1517+
f"Command # {number} ({cmd}) of pipeline caused error: {exception.args[0]}"
15191518
)
15201519
exception.args = (msg,) + exception.args[1:]
15211520

redis/cluster.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ def initialize(self):
16281628
if len(disagreements) > 5:
16291629
raise RedisClusterException(
16301630
f"startup_nodes could not agree on a valid "
1631-
f'slots cache: {", ".join(disagreements)}'
1631+
f"slots cache: {', '.join(disagreements)}"
16321632
)
16331633

16341634
fully_covered = self.check_slots_coverage(tmp_slots)
@@ -2047,8 +2047,7 @@ def annotate_exception(self, exception, number, command):
20472047
"""
20482048
cmd = " ".join(map(safe_str, command))
20492049
msg = (
2050-
f"Command # {number} ({cmd}) of pipeline "
2051-
f"caused error: {exception.args[0]}"
2050+
f"Command # {number} ({cmd}) of pipeline caused error: {exception.args[0]}"
20522051
)
20532052
exception.args = (msg,) + exception.args[1:]
20542053

redis/commands/cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def cluster_setslot(
595595
"CLUSTER SETSLOT", slot_id, state, node_id, target_nodes=target_node
596596
)
597597
elif state.upper() == "STABLE":
598-
raise RedisError('For "stable" state please use ' "cluster_setslot_stable")
598+
raise RedisError('For "stable" state please use cluster_setslot_stable')
599599
else:
600600
raise RedisError(f"Invalid slot state: {state}")
601601

redis/commands/core.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,7 +3413,9 @@ def smembers(self, name: str) -> Union[Awaitable[Set], Set]:
34133413
"""
34143414
return self.execute_command("SMEMBERS", name, keys=[name])
34153415

3416-
def smismember(self, name: str, values: List, *args: List) -> Union[
3416+
def smismember(
3417+
self, name: str, values: List, *args: List
3418+
) -> Union[
34173419
Awaitable[List[Union[Literal[0], Literal[1]]]],
34183420
List[Union[Literal[0], Literal[1]]],
34193421
]:
@@ -4160,8 +4162,7 @@ def zadd(
41604162
raise DataError("ZADD allows either 'gt' or 'lt', not both")
41614163
if incr and len(mapping) != 1:
41624164
raise DataError(
4163-
"ZADD option 'incr' only works when passing a "
4164-
"single element/score pair"
4165+
"ZADD option 'incr' only works when passing a single element/score pair"
41654166
)
41664167
if nx and (gt or lt):
41674168
raise DataError("Only one of 'nx', 'lt', or 'gr' may be defined.")

0 commit comments

Comments
 (0)