Skip to content

Commit 57a5cc8

Browse files
dvora-hvladvildanov
authored andcommitted
Update black version to 24.3.0 (#3193)
* Update black version to 24.3.0 * fix black changes
1 parent 34d1867 commit 57a5cc8

File tree

13 files changed

+55
-56
lines changed

13 files changed

+55
-56
lines changed

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ exclude =
1616
ignore =
1717
E126
1818
E203
19+
E701
20+
E704
1921
F405
2022
N801
2123
N802

dev_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
click==8.0.4
2-
black==22.3.0
2+
black==24.3.0
33
flake8==5.0.4
44
flake8-isort==6.0.0
55
flynt~=0.69.0

redis/_parsers/helpers.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -819,30 +819,31 @@ def string_keys_to_dict(key_string, callback):
819819
lambda r, **kwargs: r,
820820
),
821821
**string_keys_to_dict("XREAD XREADGROUP", parse_xread_resp3),
822-
"ACL LOG": lambda r: [
823-
{str_if_bytes(key): str_if_bytes(value) for key, value in x.items()} for x in r
824-
]
825-
if isinstance(r, list)
826-
else bool_ok(r),
822+
"ACL LOG": lambda r: (
823+
[
824+
{str_if_bytes(key): str_if_bytes(value) for key, value in x.items()}
825+
for x in r
826+
]
827+
if isinstance(r, list)
828+
else bool_ok(r)
829+
),
827830
"COMMAND": parse_command_resp3,
828831
"CONFIG GET": lambda r: {
829-
str_if_bytes(key)
830-
if key is not None
831-
else None: str_if_bytes(value)
832-
if value is not None
833-
else None
832+
str_if_bytes(key) if key is not None else None: (
833+
str_if_bytes(value) if value is not None else None
834+
)
834835
for key, value in r.items()
835836
},
836837
"MEMORY STATS": lambda r: {str_if_bytes(key): value for key, value in r.items()},
837838
"SENTINEL MASTER": parse_sentinel_state_resp3,
838839
"SENTINEL MASTERS": parse_sentinel_masters_resp3,
839840
"SENTINEL SENTINELS": parse_sentinel_slaves_and_sentinels_resp3,
840841
"SENTINEL SLAVES": parse_sentinel_slaves_and_sentinels_resp3,
841-
"STRALGO": lambda r, **options: {
842-
str_if_bytes(key): str_if_bytes(value) for key, value in r.items()
843-
}
844-
if isinstance(r, dict)
845-
else str_if_bytes(r),
842+
"STRALGO": lambda r, **options: (
843+
{str_if_bytes(key): str_if_bytes(value) for key, value in r.items()}
844+
if isinstance(r, dict)
845+
else str_if_bytes(r)
846+
),
846847
"XINFO CONSUMERS": lambda r: [
847848
{str_if_bytes(key): value for key, value in x.items()} for x in r
848849
],

redis/asyncio/client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@
8787

8888

8989
class ResponseCallbackProtocol(Protocol):
90-
def __call__(self, response: Any, **kwargs):
91-
...
90+
def __call__(self, response: Any, **kwargs): ...
9291

9392

9493
class AsyncResponseCallbackProtocol(Protocol):
95-
async def __call__(self, response: Any, **kwargs):
96-
...
94+
async def __call__(self, response: Any, **kwargs): ...
9795

9896

9997
ResponseCallbackT = Union[ResponseCallbackProtocol, AsyncResponseCallbackProtocol]
@@ -1216,13 +1214,11 @@ async def run(
12161214

12171215

12181216
class PubsubWorkerExceptionHandler(Protocol):
1219-
def __call__(self, e: BaseException, pubsub: PubSub):
1220-
...
1217+
def __call__(self, e: BaseException, pubsub: PubSub): ...
12211218

12221219

12231220
class AsyncPubsubWorkerExceptionHandler(Protocol):
1224-
async def __call__(self, e: BaseException, pubsub: PubSub):
1225-
...
1221+
async def __call__(self, e: BaseException, pubsub: PubSub): ...
12261222

12271223

12281224
PSWorkerThreadExcHandlerT = Union[

redis/asyncio/cluster.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,10 @@ def __init__(
402402
self.command_flags = self.__class__.COMMAND_FLAGS.copy()
403403
self.response_callbacks = kwargs["response_callbacks"]
404404
self.result_callbacks = self.__class__.RESULT_CALLBACKS.copy()
405-
self.result_callbacks[
406-
"CLUSTER SLOTS"
407-
] = lambda cmd, res, **kwargs: parse_cluster_slots(
408-
list(res.values())[0], **kwargs
405+
self.result_callbacks["CLUSTER SLOTS"] = (
406+
lambda cmd, res, **kwargs: parse_cluster_slots(
407+
list(res.values())[0], **kwargs
408+
)
409409
)
410410

411411
self._initialize = True
@@ -1318,9 +1318,9 @@ async def initialize(self) -> None:
13181318
)
13191319
tmp_slots[i].append(target_replica_node)
13201320
# add this node to the nodes cache
1321-
tmp_nodes_cache[
1322-
target_replica_node.name
1323-
] = target_replica_node
1321+
tmp_nodes_cache[target_replica_node.name] = (
1322+
target_replica_node
1323+
)
13241324
else:
13251325
# Validate that 2 nodes want to use the same slot cache
13261326
# setup

redis/asyncio/connection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,11 @@ class _Sentinel(enum.Enum):
8686

8787

8888
class ConnectCallbackProtocol(Protocol):
89-
def __call__(self, connection: "AbstractConnection"):
90-
...
89+
def __call__(self, connection: "AbstractConnection"): ...
9190

9291

9392
class AsyncConnectCallbackProtocol(Protocol):
94-
async def __call__(self, connection: "AbstractConnection"):
95-
...
93+
async def __call__(self, connection: "AbstractConnection"): ...
9694

9795

9896
ConnectCallbackT = Union[ConnectCallbackProtocol, AsyncConnectCallbackProtocol]
@@ -318,9 +316,11 @@ async def connect(self):
318316
await self.on_connect()
319317
else:
320318
# Use the passed function redis_connect_func
321-
await self.redis_connect_func(self) if asyncio.iscoroutinefunction(
322-
self.redis_connect_func
323-
) else self.redis_connect_func(self)
319+
(
320+
await self.redis_connect_func(self)
321+
if asyncio.iscoroutinefunction(self.redis_connect_func)
322+
else self.redis_connect_func(self)
323+
)
324324
except RedisError:
325325
# clean up after any error in on_connect
326326
await self.disconnect()

redis/asyncio/sentinel.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ class SentinelConnectionPool(ConnectionPool):
105105
def __init__(self, service_name, sentinel_manager, **kwargs):
106106
kwargs["connection_class"] = kwargs.get(
107107
"connection_class",
108-
SentinelManagedSSLConnection
109-
if kwargs.pop("ssl", False)
110-
else SentinelManagedConnection,
108+
(
109+
SentinelManagedSSLConnection
110+
if kwargs.pop("ssl", False)
111+
else SentinelManagedConnection
112+
),
111113
)
112114
self.is_master = kwargs.pop("is_master", True)
113115
self.check_connection = kwargs.pop("check_connection", False)

redis/cluster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,9 +1582,9 @@ def initialize(self):
15821582
)
15831583
tmp_slots[i].append(target_replica_node)
15841584
# add this node to the nodes cache
1585-
tmp_nodes_cache[
1586-
target_replica_node.name
1587-
] = target_replica_node
1585+
tmp_nodes_cache[target_replica_node.name] = (
1586+
target_replica_node
1587+
)
15881588
else:
15891589
# Validate that 2 nodes want to use the same slot cache
15901590
# setup

redis/commands/core.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,9 +3399,7 @@ def smembers(self, name: str) -> Union[Awaitable[Set], Set]:
33993399
"""
34003400
return self.execute_command("SMEMBERS", name, keys=[name])
34013401

3402-
def smismember(
3403-
self, name: str, values: List, *args: List
3404-
) -> Union[
3402+
def smismember(self, name: str, values: List, *args: List) -> Union[
34053403
Awaitable[List[Union[Literal[0], Literal[1]]]],
34063404
List[Union[Literal[0], Literal[1]]],
34073405
]:

redis/exceptions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,5 +217,4 @@ class SlotNotCoveredError(RedisClusterException):
217217
pass
218218

219219

220-
class MaxConnectionsError(ConnectionError):
221-
...
220+
class MaxConnectionsError(ConnectionError): ...

redis/sentinel.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ class SentinelConnectionPool(ConnectionPool):
142142
def __init__(self, service_name, sentinel_manager, **kwargs):
143143
kwargs["connection_class"] = kwargs.get(
144144
"connection_class",
145-
SentinelManagedSSLConnection
146-
if kwargs.pop("ssl", False)
147-
else SentinelManagedConnection,
145+
(
146+
SentinelManagedSSLConnection
147+
if kwargs.pop("ssl", False)
148+
else SentinelManagedConnection
149+
),
148150
)
149151
self.is_master = kwargs.pop("is_master", True)
150152
self.check_connection = kwargs.pop("check_connection", False)

redis/typing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@
5555
class CommandsProtocol(Protocol):
5656
connection_pool: Union["AsyncConnectionPool", "ConnectionPool"]
5757

58-
def execute_command(self, *args, **options):
59-
...
58+
def execute_command(self, *args, **options): ...
6059

6160

6261
class ClusterCommandsProtocol(CommandsProtocol, Protocol):
6362
encoder: "Encoder"
6463

65-
def execute_command(self, *args, **options) -> Union[Any, Awaitable]:
66-
...
64+
def execute_command(self, *args, **options) -> Union[Any, Awaitable]: ...

tests/test_asyncio/test_commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Tests async overrides of commands from their mixins
33
"""
4+
45
import asyncio
56
import binascii
67
import datetime

0 commit comments

Comments
 (0)