From fc8ec8fcb06c5721ef3f04dfd47a89d80cf12e45 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 4 Nov 2026 09:22:42 -0500 Subject: [PATCH] chore: Enable the C408 lint in ruff --- cuda_core/tests/test_program_cache.py | 2 +- cuda_core/tests/test_tensor_map.py | 8 ++++---- .../cuda_python_test_helpers/cython_cache.py | 2 +- ruff.toml | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cuda_core/tests/test_program_cache.py b/cuda_core/tests/test_program_cache.py index c23de6d9617..04437e4c0be 100644 --- a/cuda_core/tests/test_program_cache.py +++ b/cuda_core/tests/test_program_cache.py @@ -124,7 +124,7 @@ def _make_key(**overrides): unspecified defaults to a valid cubin-from-c++ compile over "a".""" from cuda.core.utils import make_program_cache_key - base = dict(code="a", code_type="c++", options=_opts(), target_type="cubin") + base = {"code": "a", "code_type": "c++", "options": _opts(), "target_type": "cubin"} return make_program_cache_key(**{**base, **overrides}) diff --git a/cuda_core/tests/test_tensor_map.py b/cuda_core/tests/test_tensor_map.py index de83d3f8db1..3f05a2e477b 100644 --- a/cuda_core/tests/test_tensor_map.py +++ b/cuda_core/tests/test_tensor_map.py @@ -810,10 +810,10 @@ class TestTensorMapHelpers: @pytest.mark.parametrize( ("kwargs", "match"), [ - (dict(box_dim=5), "box_dim must be a tuple of ints"), - (dict(box_dim=(1, "x", 3)), r"box_dim\[1\] must be an int"), - (dict(box_dim=(32,), swizzle=2), "swizzle must be a TensorMapSwizzle"), - (dict(box_dim=(32,), interleave=0), "interleave must be a TensorMapInterleave"), + ({"box_dim": 5}, "box_dim must be a tuple of ints"), + ({"box_dim": (1, "x", 3)}, r"box_dim\[1\] must be an int"), + ({"box_dim": (32,), "swizzle": 2}, "swizzle must be a TensorMapSwizzle"), + ({"box_dim": (32,), "interleave": 0}, "interleave must be a TensorMapInterleave"), ], ids=["box_dim_non_iterable", "box_dim_non_int_element", "swizzle_wrong_type", "interleave_wrong_type"], ) diff --git a/cuda_python_test_helpers/cuda_python_test_helpers/cython_cache.py b/cuda_python_test_helpers/cuda_python_test_helpers/cython_cache.py index 5a831123063..c6e429d2f1b 100644 --- a/cuda_python_test_helpers/cuda_python_test_helpers/cython_cache.py +++ b/cuda_python_test_helpers/cuda_python_test_helpers/cython_cache.py @@ -349,7 +349,7 @@ def test_identical_settings_produce_same_path(self, monkeypatch, tmp_path): def test_changed_directives_change_namespace(self, monkeypatch, tmp_path): """Different ``compiler_directives`` map to different namespaces (#7532 workaround).""" self._set_env(monkeypatch, str(tmp_path)) - base = dict(embedsignature=True, freethreading_compatible=True) + base = {"embedsignature": True, "freethreading_compatible": True} with_linetrace = dict(base, linetrace=True) p1 = self.build_hooks._cython_cache_path(self.package, compiler_directives=base) p2 = self.build_hooks._cython_cache_path(self.package, compiler_directives=with_linetrace) diff --git a/ruff.toml b/ruff.toml index 4dcc72d6eb5..482e51b9cf4 100644 --- a/ruff.toml +++ b/ruff.toml @@ -62,7 +62,6 @@ ignore = [ "S404", # allow subprocess imports # style preferences - "C408", # unnecessary dict/list/tuple call (dict() is fine) "E501", # line too long (formatter handles what it can; the rest is intentional) "E741", # ambiguous variable name (I, l, O) "B007", # unused loop control variable