Skip to content

Commit a9e2581

Browse files
[pre-commit.ci] pre-commit autoupdate (#509)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.12.11 → v0.13.3](astral-sh/ruff-pre-commit@v0.12.11...v0.13.3) - https://github.com/psf/blackhttps://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 25.1.0 → 25.9.0](psf/black-pre-commit-mirror@25.1.0...25.9.0) - [github.com/tox-dev/pyproject-fmt: v2.6.0 → v2.7.0](tox-dev/pyproject-fmt@v2.6.0...v2.7.0) * ruff check --select=RUF059 --fix --unsafe-fixes * Add Python 3.14 and 3.14t to the testing * Ruff v0.14.0 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent a167b87 commit a9e2581

File tree

6 files changed

+68
-66
lines changed

6 files changed

+68
-66
lines changed

.github/workflows/tox.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ jobs:
1919
fail-fast: false
2020
max-parallel: 5
2121
matrix:
22-
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
22+
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v5
2626
- uses: actions/setup-python@v6
2727
with:
2828
python-version: ${{ matrix.python }}
29+
allow-prereleases: true
2930
- run: pip install --upgrade pip
3031
- run: pip install tox
3132
- run: tox -e py

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ repos:
3636
- tomli
3737

3838
- repo: https://github.com/astral-sh/ruff-pre-commit
39-
rev: v0.12.11
39+
rev: v0.14.0
4040
hooks:
41-
- id: ruff
41+
- id: ruff-check
4242

43-
- repo: https://github.com/psf/black
44-
rev: 25.1.0
43+
- repo: https://github.com/psf/black-pre-commit-mirror
44+
rev: 25.9.0
4545
hooks:
4646
- id: black
4747

4848
- repo: https://github.com/tox-dev/pyproject-fmt
49-
rev: v2.6.0
49+
rev: v2.7.0
5050
hooks:
5151
- id: pyproject-fmt
5252

pyproject.toml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,39 @@
22
target-version = "py37"
33

44
lint.select = [
5-
"A", # flake8-builtins
6-
"B", # flake8-bugbear
7-
"BLE", # flake8-blind-except
8-
"C4", # flake8-comprehensions
9-
"C90", # McCabe cyclomatic complexity
10-
"E", # pycodestyle
11-
"ERA", # eradicate
12-
"EXE", # flake8-executable
13-
"F", # Pyflakes
14-
"G", # flake8-logging-format
15-
"I", # isort
16-
"ICN", # flake8-import-conventions
17-
"INP", # flake8-no-pep420
18-
"INT", # flake8-gettext
19-
"ISC", # flake8-implicit-str-concat
20-
"N", # pep8-naming
21-
"PGH", # pygrep-hooks
22-
"PIE", # flake8-pie
23-
"PL", # Pylint
24-
"PT", # flake8-pytest-style
25-
"PTH", # flake8-use-pathlib
26-
"PYI", # flake8-pyi
27-
"RET", # flake8-return
28-
"RSE", # flake8-raise
29-
"RUF", # Ruff-specific rules
30-
"S", # flake8-bandit
31-
"T10", # flake8-debugger
32-
"TCH", # flake8-type-checking
33-
"TID", # flake8-tidy-imports
34-
"W", # pycodestyle
35-
"YTT", # flake8-2020
5+
"A", # flake8-builtins
6+
"AIR", # Airflow
7+
"ASYNC", # flake8-async
8+
"B", # flake8-bugbear
9+
"BLE", # flake8-blind-except
10+
"C4", # flake8-comprehensions
11+
"C90", # McCabe cyclomatic complexity
12+
"E", # pycodestyle
13+
"ERA", # eradicate
14+
"EXE", # flake8-executable
15+
"F", # Pyflakes
16+
"G", # flake8-logging-format
17+
"I", # isort
18+
"ICN", # flake8-import-conventions
19+
"INP", # flake8-no-pep420
20+
"INT", # flake8-gettext
21+
"ISC", # flake8-implicit-str-concat
22+
"N", # pep8-naming
23+
"PGH", # pygrep-hooks
24+
"PIE", # flake8-pie
25+
"PL", # Pylint
26+
"PT", # flake8-pytest-style
27+
"PTH", # flake8-use-pathlib
28+
"PYI", # flake8-pyi
29+
"RET", # flake8-return
30+
"RSE", # flake8-raise
31+
"RUF", # Ruff-specific rules
32+
"S", # flake8-bandit
33+
"T10", # flake8-debugger
34+
"TCH", # flake8-type-checking
35+
"TID", # flake8-tidy-imports
36+
"W", # pycodestyle
37+
"YTT", # flake8-2020
3638
# "ANN", # flake8-annotations
3739
# "ARG", # flake8-unused-arguments
3840
# "COM", # flake8-commas
@@ -67,7 +69,6 @@ lint.ignore = [
6769
"RET506",
6870
"RUF100",
6971
"S113",
70-
"S311",
7172
"S314",
7273
"S603",
7374
]

pysolr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ def getRandomURL(self, collname, only_leader=False):
16651665
hosts = self.getHosts(collname, only_leader=only_leader)
16661666
if not hosts:
16671667
raise SolrError("ZooKeeper returned no active shards!")
1668-
return "%s/%s" % (random.choice(hosts), collname) # NOQA: B311
1668+
return "%s/%s" % (random.choice(hosts), collname) # NOQA: S311
16691669

16701670
def getLeaderURL(self, collname):
16711671
return self.getRandomURL(collname, only_leader=True)

tests/test_client.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def test_search(self):
565565
results = self.solr.search("doc")
566566
self.assertEqual(len(results), 3)
567567
# search should default to 'select' handler
568-
args, kwargs = self.solr._send_request.call_args
568+
args, _kwargs = self.solr._send_request.call_args
569569
self.assertTrue(args[1].startswith("select/?"))
570570

571571
results = self.solr.search("example")
@@ -619,20 +619,20 @@ def test_multiple_search_handlers(self):
619619
# search should support custom handlers
620620
with self.assertRaises(SolrError):
621621
self.solr.search("doc", search_handler="fakehandler")
622-
args, kwargs = self.solr._send_request.call_args
622+
args, _kwargs = self.solr._send_request.call_args
623623
self.assertTrue(args[1].startswith("fakehandler"))
624624

625625
def test_more_like_this(self):
626626
results = self.solr.more_like_this("id:doc_1", "text")
627627
self.assertEqual(len(results), 0)
628628
# more_like_this should default to 'mlt' handler
629-
args, kwargs = self.solr._send_request.call_args
629+
args, _kwargs = self.solr._send_request.call_args
630630
self.assertTrue(args[1].startswith("mlt/?"))
631631

632632
# more_like_this should support custom handlers
633633
with self.assertRaises(SolrError):
634634
self.solr.more_like_this("id:doc_1", "text", handler="fakehandler")
635-
args, kwargs = self.solr._send_request.call_args
635+
args, _kwargs = self.solr._send_request.call_args
636636
self.assertTrue(args[1].startswith("fakehandler"))
637637

638638
def test_suggest_terms(self):
@@ -654,13 +654,13 @@ def test_suggest_terms(self):
654654
},
655655
)
656656
# suggest_terms should default to 'mlt' handler
657-
args, kwargs = self.solr._send_request.call_args
657+
args, _kwargs = self.solr._send_request.call_args
658658
self.assertTrue(args[1].startswith("terms/?"))
659659

660660
# suggest_terms should support custom handlers
661661
with self.assertRaises(SolrError):
662662
self.solr.suggest_terms("title", "", handler="fakehandler")
663-
args, kwargs = self.solr._send_request.call_args
663+
args, _kwargs = self.solr._send_request.call_args
664664
self.assertTrue(args[1].startswith("fakehandler"))
665665

666666
def test__build_xml_doc(self):
@@ -768,17 +768,17 @@ def test_build_json_doc_matches_xml(self):
768768

769769
def test__build_docs_plain(self):
770770
docs = [{"id": "doc_1", "title": "", "price": 12.59, "popularity": 10}]
771-
solrapi, m, len_message = self.solr._build_docs(docs)
771+
solrapi, _m, _len_message = self.solr._build_docs(docs)
772772
self.assertEqual(solrapi, "JSON")
773773

774774
def test__build_docs_boost(self):
775775
docs = [{"id": "doc_1", "title": "", "price": 12.59, "popularity": 10}]
776-
solrapi, m, len_message = self.solr._build_docs(docs, boost={"title": 10.0})
776+
solrapi, _m, _len_message = self.solr._build_docs(docs, boost={"title": 10.0})
777777
self.assertEqual(solrapi, "XML")
778778

779779
def test__build_docs_field_updates(self):
780780
docs = [{"id": "doc_1", "popularity": 10}]
781-
solrapi, m, len_message = self.solr._build_docs(
781+
solrapi, _m, _len_message = self.solr._build_docs(
782782
docs, fieldUpdates={"popularity": "inc"}
783783
)
784784
self.assertEqual(solrapi, "JSON")
@@ -795,7 +795,7 @@ def test_add(self):
795795
commit=True,
796796
)
797797
# add should default to 'update' handler
798-
args, kwargs = self.solr._send_request.call_args
798+
args, _kwargs = self.solr._send_request.call_args
799799
self.assertTrue(args[1].startswith("update/?"))
800800

801801
self.assertEqual(len(self.solr.search("doc")), 5)
@@ -804,7 +804,7 @@ def test_add(self):
804804
# add should support custom handlers
805805
with self.assertRaises(SolrError):
806806
self.solr.add([], handler="fakehandler", commit=True)
807-
args, kwargs = self.solr._send_request.call_args
807+
args, _kwargs = self.solr._send_request.call_args
808808
self.assertTrue(args[1].startswith("fakehandler"))
809809

810810
def test_add_with_boost(self):
@@ -927,7 +927,7 @@ def test_delete(self):
927927
self.assertEqual(len(self.solr.search("doc")), 3)
928928
self.solr.delete(id="doc_1", commit=True)
929929
# delete should default to 'update' handler
930-
args, kwargs = self.solr._send_request.call_args
930+
args, _kwargs = self.solr._send_request.call_args
931931
self.assertTrue(args[1].startswith("update/?"))
932932

933933
self.assertEqual(len(self.solr.search("doc")), 2)
@@ -971,7 +971,7 @@ def leaf_doc(doc):
971971
self.assertEqual(len(self.solr.search(leaf_q)), len(to_delete_docs))
972972
# Extract a random doc from the list, to later check it wasn't deleted.
973973
graced_doc_id = to_delete_ids.pop(
974-
random.randint(0, len(to_delete_ids) - 1) # NOQA: B311
974+
random.randint(0, len(to_delete_ids) - 1) # NOQA: S311
975975
)
976976
self.solr.delete(id=to_delete_ids, commit=True)
977977
# There should be only one left, our graced id
@@ -993,7 +993,7 @@ def leaf_doc(doc):
993993
# delete should support custom handlers
994994
with self.assertRaises(SolrError):
995995
self.solr.delete(id="doc_1", handler="fakehandler", commit=True)
996-
args, kwargs = self.solr._send_request.call_args
996+
args, _kwargs = self.solr._send_request.call_args
997997
self.assertTrue(args[1].startswith("fakehandler"))
998998

999999
def test_commit(self):
@@ -1002,7 +1002,7 @@ def test_commit(self):
10021002
self.assertEqual(len(self.solr.search("doc")), 3)
10031003
self.solr.commit()
10041004
# commit should default to 'update' handler
1005-
args, kwargs = self.solr._send_request.call_args
1005+
args, _kwargs = self.solr._send_request.call_args
10061006
self.assertTrue(args[1].startswith("update/?"))
10071007
self.assertEqual(len(self.solr.search("doc")), 4)
10081008

@@ -1031,7 +1031,7 @@ def test_overwrite(self):
10311031
# commit should support custom handlers
10321032
with self.assertRaises(SolrError):
10331033
self.solr.commit(handler="fakehandler")
1034-
args, kwargs = self.solr._send_request.call_args
1034+
args, _kwargs = self.solr._send_request.call_args
10351035
self.assertTrue(args[1].startswith("fakehandler"))
10361036

10371037
def test_optimize(self):
@@ -1041,14 +1041,14 @@ def test_optimize(self):
10411041
self.assertEqual(len(self.solr.search("doc")), 3)
10421042
self.solr.optimize()
10431043
# optimize should default to 'update' handler
1044-
args, kwargs = self.solr._send_request.call_args
1044+
args, _kwargs = self.solr._send_request.call_args
10451045
self.assertTrue(args[1].startswith("update/?"))
10461046
self.assertEqual(len(self.solr.search("doc")), 4)
10471047

10481048
# optimize should support custom handlers
10491049
with self.assertRaises(SolrError):
10501050
self.solr.optimize(handler="fakehandler")
1051-
args, kwargs = self.solr._send_request.call_args
1051+
args, _kwargs = self.solr._send_request.call_args
10521052
self.assertTrue(args[1].startswith("fakehandler"))
10531053

10541054
def test_extract(self):
@@ -1067,13 +1067,13 @@ def test_extract(self):
10671067
fake_f.name = "test.html"
10681068
extracted = self.solr.extract(fake_f)
10691069
# extract should default to 'update/extract' handler
1070-
args, kwargs = self.solr._send_request.call_args
1070+
args, _kwargs = self.solr._send_request.call_args
10711071
self.assertTrue(args[1].startswith("update/extract"))
10721072

10731073
# extract should support custom handlers
10741074
with self.assertRaises(SolrError):
10751075
self.solr.extract(fake_f, handler="fakehandler")
1076-
args, kwargs = self.solr._send_request.call_args
1076+
args, _kwargs = self.solr._send_request.call_args
10771077
self.assertTrue(args[1].startswith("fakehandler"))
10781078

10791079
# Verify documented response structure:
@@ -1110,13 +1110,13 @@ def test_extract_special_char_in_filename(self):
11101110
fake_f.name = "test☃.html"
11111111
extracted = self.solr.extract(fake_f)
11121112
# extract should default to 'update/extract' handler
1113-
args, kwargs = self.solr._send_request.call_args
1113+
args, _kwargs = self.solr._send_request.call_args
11141114
self.assertTrue(args[1].startswith("update/extract"))
11151115

11161116
# extract should support custom handlers
11171117
with self.assertRaises(SolrError):
11181118
self.solr.extract(fake_f, handler="fakehandler")
1119-
args, kwargs = self.solr._send_request.call_args
1119+
args, _kwargs = self.solr._send_request.call_args
11201120
self.assertTrue(args[1].startswith("fakehandler"))
11211121

11221122
# Verify documented response structure:
@@ -1151,26 +1151,26 @@ def test_request_handler(self):
11511151
self.solr.use_qt_param = True
11521152

11531153
self.solr.search("my query")
1154-
args, kwargs = self.solr._send_request.call_args
1154+
args, _kwargs = self.solr._send_request.call_args
11551155
self.assertTrue(args[1].startswith("select"))
11561156

11571157
self.solr.search("my", search_handler="/autocomplete")
1158-
args, kwargs = self.solr._send_request.call_args
1158+
args, _kwargs = self.solr._send_request.call_args
11591159
self.assertTrue(args[1].startswith("select"))
11601160
self.assertGreaterEqual(args[1].find("qt=%2Fautocomplete"), 0)
11611161

11621162
self.solr.search_handler = "/autocomplete"
11631163

11641164
self.solr.search("my")
1165-
args, kwargs = self.solr._send_request.call_args
1165+
args, _kwargs = self.solr._send_request.call_args
11661166
self.assertTrue(args[1].startswith("select"))
11671167
self.assertGreaterEqual(args[1].find("qt=%2Fautocomplete"), 0)
11681168

11691169
self.solr.use_qt_param = False
11701170
# will change the path, so expect a 404
11711171
with self.assertRaises(SolrError):
11721172
self.solr.search("my")
1173-
args, kwargs = self.solr._send_request.call_args
1173+
args, _kwargs = self.solr._send_request.call_args
11741174
self.assertTrue(args[1].startswith("/autocomplete"))
11751175
self.assertLess(args[1].find("qt=%2Fautocomplete"), 0)
11761176

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py39,py310,py311,py312,py313,pypy3
2+
envlist = py39,py310,py311,py312,py313,py314,py314t,pypy3
33

44
[base]
55
deps =

0 commit comments

Comments
 (0)