Skip to content

Commit 0ee8de5

Browse files
authored
Merge branch 'master' into ps_remove_deprecated_argument_for_pytest_asyncio_issue_3339
2 parents 2922f19 + 4122f7c commit 0ee8de5

36 files changed

+123
-120
lines changed

.flake8

Lines changed: 0 additions & 28 deletions
This file was deleted.

.isort.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

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
{

dev_requirements.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
build
2-
black==24.3.0
32
click==8.0.4
4-
flake8-isort
5-
flake8
6-
flynt~=0.69.0
73
invoke==2.2.0
84
mock
95
packaging>=20.4
@@ -12,6 +8,7 @@ pytest-asyncio>=0.23.0
128
pytest-cov
139
pytest-profiling==1.8.1
1410
pytest-timeout
11+
ruff==0.9.6
1512
ujson>=4.2.0
1613
uvloop
1714
vulture>=2.3.0

doctests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ pip uninstall -y redis # uninstall Redis package installed via redis-entraid
2121
pip install -r doctests/requirements.txt
2222
```
2323

24-
Note - the CI process, runs the basic ```black``` and ```isort``` linters against the examples. Assuming
25-
the requirements above have been installed you can run ```black yourfile.py``` and ```isort yourfile.py```
24+
Note - the CI process, runs linters against the examples. Assuming
25+
the requirements above have been installed you can run ```ruff check yourfile.py``` and ```ruff format yourfile.py```
2626
locally to validate the linting, prior to CI.
2727

2828
Just include necessary assertions in the example file and run

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,53 @@ filterwarnings = [
9797
# Ignore a coverage warning when COVERAGE_CORE=sysmon for Pythons < 3.12.
9898
"ignore:sys.monitoring isn't available:coverage.exceptions.CoverageWarning",
9999
]
100+
101+
[tool.ruff]
102+
target-version = "py38"
103+
line-length = 88
104+
exclude = [
105+
"*.egg-info",
106+
"*.pyc",
107+
".git",
108+
".venv*",
109+
"build",
110+
"dist",
111+
"docker",
112+
"docs/*",
113+
"doctests/*",
114+
"tasks.py",
115+
"venv*",
116+
"whitelist.py",
117+
]
118+
119+
[tool.ruff.lint]
120+
ignore = [
121+
"E501", # line too long (taken care of with ruff format)
122+
"E741", # ambiguous variable name
123+
"N818", # Errors should have Error suffix
124+
]
125+
126+
select = [
127+
"E",
128+
"F",
129+
"FLY",
130+
"I",
131+
"N",
132+
"W",
133+
]
134+
135+
[tool.ruff.lint.per-file-ignores]
136+
"redis/commands/bf/*" = [
137+
# the `bf` module uses star imports, so this is required there.
138+
"F405", # name may be undefined, or defined from star imports
139+
]
140+
"redis/commands/{bf,timeseries,json,search}/*" = [
141+
"N",
142+
]
143+
"tests/*" = [
144+
"I", # TODO: could be enabled, plenty of changes
145+
"N801", # class name should use CapWords convention
146+
"N803", # argument name should be lowercase
147+
"N802", # function name should be lowercase
148+
"N806", # variable name should be lowercase
149+
]

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

0 commit comments

Comments
 (0)