Skip to content

Commit 08f980e

Browse files
committed
Made linters happy
1 parent a66e857 commit 08f980e

14 files changed

+657
-758
lines changed

docs/conf.py

+10-17
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
#
5656
# The short X.Y version.
5757
import redis
58-
version = '.'.join(redis.__version__.split(".")[0:2])
58+
59+
version = ".".join(redis.__version__.split(".")[0:2])
5960

6061
# The full version, including alpha/beta/rc tags.
6162
release = redis.__version__
@@ -108,13 +109,13 @@
108109
# further. For a list of options available for each theme, see the
109110
# documentation.
110111
html_theme_options = {
111-
'display_version': True,
112-
'prev_next_buttons_location': 'bottom',
113-
'style_external_links': False,
112+
"display_version": True,
113+
"prev_next_buttons_location": "bottom",
114+
"style_external_links": False,
114115
# Toc options
115-
'collapse_navigation': True,
116-
'sticky_navigation': True,
117-
'navigation_depth': 4,
116+
"collapse_navigation": True,
117+
"sticky_navigation": True,
118+
"navigation_depth": 4,
118119
}
119120

120121
# Add any paths that contain custom themes here, relative to this directory.
@@ -201,11 +202,7 @@
201202
# (source start file, target name, title, author, documentclass
202203
# [howto/manual]).
203204
latex_documents = [
204-
("index",
205-
"redis-py.tex",
206-
"redis-py Documentation",
207-
"Redis Inc",
208-
"manual"),
205+
("index", "redis-py.tex", "redis-py Documentation", "Redis Inc", "manual"),
209206
]
210207

211208
# The name of an image file (relative to this directory) to place at the top of
@@ -233,11 +230,7 @@
233230

234231
# One entry per manual page. List of tuples
235232
# (source start file, name, description, authors, manual section).
236-
man_pages = [(
237-
"index",
238-
"redis-py",
239-
"redis-py Documentation",
240-
["Andy McCurdy"], 1)]
233+
man_pages = [("index", "redis-py", "redis-py Documentation", ["Andy McCurdy"], 1)]
241234

242235
# If true, show URL addresses after external links.
243236
# man_show_urls = False

redis/__init__.py

+37-37
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22
from redis.cluster import RedisCluster
33
from redis.connection import (
44
BlockingConnectionPool,
5-
ConnectionPool,
65
Connection,
6+
ConnectionPool,
77
SSLConnection,
8-
UnixDomainSocketConnection
9-
)
10-
from redis.sentinel import (
11-
Sentinel,
12-
SentinelConnectionPool,
13-
SentinelManagedConnection,
14-
SentinelManagedSSLConnection,
8+
UnixDomainSocketConnection,
159
)
16-
from redis.utils import from_url
1710
from redis.exceptions import (
1811
AuthenticationError,
1912
AuthenticationWrongNumberOfArgsError,
@@ -27,8 +20,15 @@
2720
RedisError,
2821
ResponseError,
2922
TimeoutError,
30-
WatchError
23+
WatchError,
24+
)
25+
from redis.sentinel import (
26+
Sentinel,
27+
SentinelConnectionPool,
28+
SentinelManagedConnection,
29+
SentinelManagedSSLConnection,
3130
)
31+
from redis.utils import from_url
3232

3333

3434
def int_or_str(value):
@@ -41,33 +41,33 @@ def int_or_str(value):
4141
__version__ = "4.1.0rc1"
4242

4343

44-
VERSION = tuple(map(int_or_str, __version__.split('.')))
44+
VERSION = tuple(map(int_or_str, __version__.split(".")))
4545

4646
__all__ = [
47-
'AuthenticationError',
48-
'AuthenticationWrongNumberOfArgsError',
49-
'BlockingConnectionPool',
50-
'BusyLoadingError',
51-
'ChildDeadlockedError',
52-
'Connection',
53-
'ConnectionError',
54-
'ConnectionPool',
55-
'DataError',
56-
'from_url',
57-
'InvalidResponse',
58-
'PubSubError',
59-
'ReadOnlyError',
60-
'Redis',
61-
'RedisCluster',
62-
'RedisError',
63-
'ResponseError',
64-
'Sentinel',
65-
'SentinelConnectionPool',
66-
'SentinelManagedConnection',
67-
'SentinelManagedSSLConnection',
68-
'SSLConnection',
69-
'StrictRedis',
70-
'TimeoutError',
71-
'UnixDomainSocketConnection',
72-
'WatchError',
47+
"AuthenticationError",
48+
"AuthenticationWrongNumberOfArgsError",
49+
"BlockingConnectionPool",
50+
"BusyLoadingError",
51+
"ChildDeadlockedError",
52+
"Connection",
53+
"ConnectionError",
54+
"ConnectionPool",
55+
"DataError",
56+
"from_url",
57+
"InvalidResponse",
58+
"PubSubError",
59+
"ReadOnlyError",
60+
"Redis",
61+
"RedisCluster",
62+
"RedisError",
63+
"ResponseError",
64+
"Sentinel",
65+
"SentinelConnectionPool",
66+
"SentinelManagedConnection",
67+
"SentinelManagedSSLConnection",
68+
"SSLConnection",
69+
"StrictRedis",
70+
"TimeoutError",
71+
"UnixDomainSocketConnection",
72+
"WatchError",
7373
]

redis/commands/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
from .sentinel import SentinelCommands
77

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

redis/commands/helpers.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def list_or_args(keys, args):
2222
def nativestr(x):
2323
"""Return the decoded binary string, or a string, depending on type."""
2424
r = x.decode("utf-8", "replace") if isinstance(x, bytes) else x
25-
if r == 'null':
25+
if r == "null":
2626
return
2727
return r
2828

@@ -58,14 +58,14 @@ def parse_list_to_dict(response):
5858
res = {}
5959
for i in range(0, len(response), 2):
6060
if isinstance(response[i], list):
61-
res['Child iterators'].append(parse_list_to_dict(response[i]))
62-
elif isinstance(response[i+1], list):
63-
res['Child iterators'] = [parse_list_to_dict(response[i+1])]
61+
res["Child iterators"].append(parse_list_to_dict(response[i]))
62+
elif isinstance(response[i + 1], list):
63+
res["Child iterators"] = [parse_list_to_dict(response[i + 1])]
6464
else:
6565
try:
66-
res[response[i]] = float(response[i+1])
66+
res[response[i]] = float(response[i + 1])
6767
except (TypeError, ValueError):
68-
res[response[i]] = response[i+1]
68+
res[response[i]] = response[i + 1]
6969
return res
7070

7171

redis/commands/search/commands.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import itertools
22
import time
33

4+
from ..helpers import parse_to_dict
45
from ._util import to_string
56
from .aggregation import AggregateRequest, AggregateResult, Cursor
67
from .document import Document
78
from .query import Query
89
from .result import Result
910
from .suggestion import SuggestionParser
10-
from ..helpers import parse_to_dict
1111

1212
NUMERIC = "NUMERIC"
1313

@@ -453,7 +453,7 @@ def profile(self, query, limited=False):
453453
cmd = [PROFILE_CMD, self.index_name, ""]
454454
if limited:
455455
cmd.append("LIMITED")
456-
cmd.append('QUERY')
456+
cmd.append("QUERY")
457457

458458
if isinstance(query, AggregateRequest):
459459
cmd[2] = "AGGREGATE"
@@ -462,19 +462,20 @@ def profile(self, query, limited=False):
462462
cmd[2] = "SEARCH"
463463
cmd += query.get_args()
464464
else:
465-
raise ValueError("Must provide AggregateRequest object or "
466-
"Query object.")
465+
raise ValueError("Must provide AggregateRequest object or " "Query object.")
467466

468467
res = self.execute_command(*cmd)
469468

470469
if isinstance(query, AggregateRequest):
471470
result = self._get_AggregateResult(res[0], query, query._cursor)
472471
else:
473-
result = Result(res[0],
474-
not query._no_content,
475-
duration=(time.time() - st) * 1000.0,
476-
has_payload=query._with_payloads,
477-
with_scores=query._with_scores,)
472+
result = Result(
473+
res[0],
474+
not query._no_content,
475+
duration=(time.time() - st) * 1000.0,
476+
has_payload=query._with_payloads,
477+
with_scores=query._with_scores,
478+
)
478479

479480
return result, parse_to_dict(res[1])
480481

redis/crc.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
# For more information see: https://github.com/redis/redis/issues/2576
55
REDIS_CLUSTER_HASH_SLOTS = 16384
66

7-
__all__ = [
8-
"key_slot",
9-
"REDIS_CLUSTER_HASH_SLOTS"
10-
]
7+
__all__ = ["key_slot", "REDIS_CLUSTER_HASH_SLOTS"]
118

129

1310
def key_slot(key, bucket=REDIS_CLUSTER_HASH_SLOTS):
@@ -20,5 +17,5 @@ def key_slot(key, bucket=REDIS_CLUSTER_HASH_SLOTS):
2017
if start > -1:
2118
end = key.find(b"}", start + 1)
2219
if end > -1 and end != start + 1:
23-
key = key[start + 1: end]
20+
key = key[start + 1 : end]
2421
return crc_hqx(key, 0) % bucket

redis/exceptions.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class RedisClusterException(Exception):
9191
"""
9292
Base exception for the RedisCluster client
9393
"""
94+
9495
pass
9596

9697

@@ -99,6 +100,7 @@ class ClusterError(RedisError):
99100
Cluster errors occurred multiple times, resulting in an exhaustion of the
100101
command execution TTL
101102
"""
103+
102104
pass
103105

104106

@@ -112,6 +114,7 @@ class ClusterDownError(ClusterError, ResponseError):
112114
unavailable. It automatically returns available as soon as all the slots
113115
are covered again.
114116
"""
117+
115118
def __init__(self, resp):
116119
self.args = (resp,)
117120
self.message = resp
@@ -136,8 +139,8 @@ def __init__(self, resp):
136139
"""should only redirect to master node"""
137140
self.args = (resp,)
138141
self.message = resp
139-
slot_id, new_node = resp.split(' ')
140-
host, port = new_node.rsplit(':', 1)
142+
slot_id, new_node = resp.split(" ")
143+
host, port = new_node.rsplit(":", 1)
141144
self.slot_id = int(slot_id)
142145
self.node_addr = self.host, self.port = host, int(port)
143146

@@ -148,6 +151,7 @@ class TryAgainError(ResponseError):
148151
Operations on keys that don't exist or are - during resharding - split
149152
between the source and destination nodes, will generate a -TRYAGAIN error.
150153
"""
154+
151155
def __init__(self, *args, **kwargs):
152156
pass
153157

@@ -158,6 +162,7 @@ class ClusterCrossSlotError(ResponseError):
158162
A CROSSSLOT error is generated when keys in a request don't hash to the
159163
same slot.
160164
"""
165+
161166
message = "Keys in request don't hash to the same slot"
162167

163168

@@ -167,6 +172,7 @@ class MovedError(AskError):
167172
A request sent to a node that doesn't serve this key will be replayed with
168173
a MOVED error that points to the correct node.
169174
"""
175+
170176
pass
171177

172178

@@ -175,6 +181,7 @@ class MasterDownError(ClusterDownError):
175181
Error indicated MASTERDOWN error received from cluster.
176182
Link with MASTER is down and replica-serve-stale-data is set to 'no'.
177183
"""
184+
178185
pass
179186

180187

@@ -186,4 +193,5 @@ class SlotNotCoveredError(RedisClusterException):
186193
If this error is raised the client should drop the current node layout and
187194
attempt to reconnect and refresh the node layout again
188195
"""
196+
189197
pass

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
2-
from setuptools import setup, find_packages
2+
from setuptools import find_packages, setup
3+
34
import redis
45

56
setup(
@@ -24,8 +25,8 @@
2425
author_email="[email protected]",
2526
python_requires=">=3.6",
2627
install_requires=[
27-
'deprecated==1.2.3',
28-
'packaging==21.3',
28+
"deprecated==1.2.3",
29+
"packaging==21.3",
2930
],
3031
classifiers=[
3132
"Development Status :: 5 - Production/Stable",

0 commit comments

Comments
 (0)