Skip to content

Commit 6fa905f

Browse files
authored
style: combine repeated ruff configuration to top-level module (#1019)
* chore(dev-deps): move ruff config to shared workspace * chore: fix misspelling * style: format TOML * style: ignore ternary if/else * style: allow old-style type annotations * style: globs * chore: more ignore config * chore(autofix): unnecessary mode argument * style(autofix): ruff formatting * chore(if-stmt): combine verbose elif and if using `and` * chore: use proper file reading APIs * chore(autofix): ruff check fixes
1 parent 32b0f12 commit 6fa905f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+108
-205
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repos:
1818
rev: 0b19ef1fd6ad680ed7752d6daba883ce1265a6de # frozen: v0.12.2
1919
hooks:
2020
- id: ruff
21-
args: [--fix, --show-fixes, --target-version=py39]
21+
args: [--fix, --show-fixes]
2222
- id: ruff-format
2323

2424
- repo: local

conftest.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import os
5+
56
import pytest
67

78

@@ -11,15 +12,9 @@ def pytest_collection_modifyitems(config, items):
1112
nodeid = item.nodeid.replace("\\", "/")
1213

1314
# Package markers by path
14-
if (
15-
nodeid.startswith("cuda_pathfinder/tests/")
16-
or "/cuda_pathfinder/tests/" in nodeid
17-
):
15+
if nodeid.startswith("cuda_pathfinder/tests/") or "/cuda_pathfinder/tests/" in nodeid:
1816
item.add_marker(pytest.mark.pathfinder)
19-
if (
20-
nodeid.startswith("cuda_bindings/tests/")
21-
or "/cuda_bindings/tests/" in nodeid
22-
):
17+
if nodeid.startswith("cuda_bindings/tests/") or "/cuda_bindings/tests/" in nodeid:
2318
item.add_marker(pytest.mark.bindings)
2419
if nodeid.startswith("cuda_core/tests/") or "/cuda_core/tests/" in nodeid:
2520
item.add_marker(pytest.mark.core)
@@ -38,8 +33,4 @@ def pytest_collection_modifyitems(config, items):
3833

3934
# Gate core cython tests on CUDA_HOME
4035
if "core" in item.keywords and not cuda_home:
41-
item.add_marker(
42-
pytest.mark.skip(
43-
reason="CUDA_HOME not set; skipping core cython tests"
44-
)
45-
)
36+
item.add_marker(pytest.mark.skip(reason="CUDA_HOME not set; skipping core cython tests"))

cuda_bindings/benchmarks/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import numpy as np
55
import pytest
6-
76
from cuda.bindings import driver as cuda
87
from cuda.bindings import nvrtc
98
from cuda.bindings import runtime as cudart

cuda_bindings/benchmarks/test_launch_latency.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import ctypes
55

66
import pytest
7-
from conftest import ASSERT_DRV
7+
from cuda.bindings import driver as cuda
88
from kernels import kernel_string
99

10-
from cuda.bindings import driver as cuda
10+
from conftest import ASSERT_DRV
1111

1212

1313
def launch(kernel, stream, args=(), arg_types=()):

cuda_bindings/benchmarks/test_pointer_attributes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import random
55

66
import pytest
7-
from conftest import ASSERT_DRV
8-
97
from cuda.bindings import driver as cuda
108

9+
from conftest import ASSERT_DRV
10+
1111
random.seed(0)
1212

1313
idx = 0

cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import numpy as np
77
from common import common
88
from common.helper_cuda import checkCudaErrors, findCudaDevice
9-
109
from cuda.bindings import driver as cuda
1110

1211
clock_nvrtc = """\

cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99
from common import common
1010
from common.helper_cuda import checkCudaErrors, findCudaDevice
11-
1211
from cuda.bindings import driver as cuda
1312
from cuda.bindings import runtime as cudart
1413

cuda_bindings/examples/0_Introduction/simpleP2P_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99
from common import common
1010
from common.helper_cuda import checkCudaErrors
11-
1211
from cuda.bindings import driver as cuda
1312
from cuda.bindings import runtime as cudart
1413

cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from common import common
1212
from common.helper_cuda import checkCudaErrors
1313
from common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt
14-
1514
from cuda.bindings import driver as cuda
1615
from cuda.bindings import runtime as cudart
1716

cuda_bindings/examples/0_Introduction/systemWideAtomics_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99
from common import common
1010
from common.helper_cuda import checkCudaErrors, findCudaDevice
11-
1211
from cuda.bindings import driver as cuda
1312
from cuda.bindings import runtime as cudart
1413

0 commit comments

Comments
 (0)