Skip to content

Commit cc69a37

Browse files
chore(deps): update pre-commit hooks (#5745)
* chore(deps): update pre-commit hooks updates: - [github.com/pre-commit/mirrors-clang-format: v20.1.5 → v20.1.7](pre-commit/mirrors-clang-format@v20.1.5...v20.1.7) - [github.com/astral-sh/ruff-pre-commit: v0.11.12 → v0.12.2](astral-sh/ruff-pre-commit@v0.11.12...v0.12.2) - [github.com/pre-commit/mirrors-mypy: v1.16.0 → v1.16.1](pre-commit/mirrors-mypy@v1.16.0...v1.16.1) - [github.com/python-jsonschema/check-jsonschema: 0.33.0 → 0.33.2](python-jsonschema/check-jsonschema@0.33.0...0.33.2) * chore: fix new ruff check warnings Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * style: pre-commit fixes --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 66d394f commit cc69a37

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ repos:
2525

2626
# Clang format the codebase automatically
2727
- repo: https://github.com/pre-commit/mirrors-clang-format
28-
rev: "v20.1.5"
28+
rev: "v20.1.7"
2929
hooks:
3030
- id: clang-format
3131
types_or: [c++, c, cuda]
3232

3333
# Ruff, the Python auto-correcting linter/formatter written in Rust
3434
- repo: https://github.com/astral-sh/ruff-pre-commit
35-
rev: v0.11.12
35+
rev: v0.12.2
3636
hooks:
37-
- id: ruff
37+
- id: ruff-check
3838
args: ["--fix", "--show-fixes"]
3939
- id: ruff-format
4040

4141
# Check static types with mypy
4242
- repo: https://github.com/pre-commit/mirrors-mypy
43-
rev: "v1.16.0"
43+
rev: "v1.16.1"
4444
hooks:
4545
- id: mypy
4646
args: []
@@ -142,7 +142,7 @@ repos:
142142

143143
# Check schemas on some of our YAML files
144144
- repo: https://github.com/python-jsonschema/check-jsonschema
145-
rev: 0.33.0
145+
rev: 0.33.2
146146
hooks:
147147
- id: check-readthedocs
148148
- id: check-github-workflows

pyproject.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ messages_control.disable = [
143143
"consider-using-f-string", # triggers in _version.py incorrectly
144144
]
145145

146-
[tool.ruff]
147-
src = ["src"]
148-
149146
[tool.ruff.lint]
150147
extend-select = [
151148
"B", # flake8-bugbear
@@ -166,17 +163,21 @@ extend-select = [
166163
"YTT", # flake8-2020
167164
]
168165
ignore = [
169-
"PLR", # Design related pylint
170-
"PT011", # Too broad with raises in pytest
171-
"SIM118", # iter(x) is not always the same as iter(x.keys())
166+
"PLR", # Design related pylint
167+
"PT011", # Too broad with raises in pytest
168+
"SIM118", # iter(x) is not always the same as iter(x.keys())
169+
"PLC0415", # We import in functions for various reasons
172170
]
173-
unfixable = ["T20"]
174171
isort.known-first-party = ["env", "pybind11_cross_module_tests", "pybind11_tests"]
175172
isort.required-imports = ["from __future__ import annotations"]
176173

177174

178175
[tool.ruff.lint.per-file-ignores]
179-
"tests/**" = ["EM", "N", "E721"]
176+
"tests/**" = [
177+
"EM",
178+
"N",
179+
"E721",
180+
]
180181
"tests/test_call_policies.py" = ["PLC1901"]
181182

182183
[tool.repo-review]

tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def __init__(self, string):
7777
def __str__(self):
7878
return self.string
7979

80+
__hash__ = None
81+
8082
def __eq__(self, other):
8183
# Ignore constructor/destructor output which is prefixed with "###"
8284
a = [
@@ -94,6 +96,8 @@ def __eq__(self, other):
9496
class Unordered(Output):
9597
"""Custom comparison for output without strict line ordering"""
9698

99+
__hash__ = None
100+
97101
def __eq__(self, other):
98102
a = _split_and_sort(self.string)
99103
b = _split_and_sort(other)
@@ -116,6 +120,8 @@ def __enter__(self):
116120
def __exit__(self, *args):
117121
self.out, self.err = self.capfd.readouterr()
118122

123+
__hash__ = None
124+
119125
def __eq__(self, other):
120126
a = Output(self.out)
121127
b = other
@@ -155,6 +161,8 @@ def __call__(self, thing):
155161
self.string = self.sanitizer(thing)
156162
return self
157163

164+
__hash__ = None
165+
158166
def __eq__(self, other):
159167
a = self.string
160168
b = _strip_and_dedent(other)

tests/test_class_sh_basic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ def test_cannot_disown_use_count_ne_1(pass_f, rtrn_f):
135135
assert str(exc_info.value) == ("Cannot disown use_count != 1 (load_as_unique_ptr).")
136136

137137

138-
def test_unique_ptr_roundtrip(num_round_trips=1000):
138+
def test_unique_ptr_roundtrip():
139139
# Multiple roundtrips to stress-test instance registration/deregistration.
140+
num_round_trips = 1000
140141
recycled = m.atyp("passenger")
141142
for _ in range(num_round_trips):
142143
id_orig = id(recycled)
@@ -164,8 +165,9 @@ def test_rtrn_unique_ptr_cref():
164165
assert obj0 is obj1
165166

166167

167-
def test_unique_ptr_cref_roundtrip(num_round_trips=1000):
168+
def test_unique_ptr_cref_roundtrip():
168169
# Multiple roundtrips to stress-test implementation.
170+
num_round_trips = 1000
169171
orig = m.atyp("passenger")
170172
mtxt_orig = m.get_mtxt(orig)
171173
recycled = orig

tests/test_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def test_warning_simple(
2020
expected_category, expected_message, expected_value, module_function
2121
):
22-
with pytest.warns(Warning) as excinfo:
22+
with pytest.warns(Warning, match="This is") as excinfo:
2323
value = module_function()
2424

2525
assert issubclass(excinfo[0].category, expected_category)

0 commit comments

Comments
 (0)