Skip to content

Commit 1fd64c8

Browse files
committed
chore(dev): Run cython-lint against codebase (except cuda_bindings), add it to pre-commit
1 parent 73da391 commit 1fd64c8

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,12 @@ repos:
7878
hooks:
7979
- id: actionlint
8080

81+
- repo: https://github.com/MarcoGorelli/cython-lint
82+
rev: "d9ff7ce99ef4f2ae8fba93079ca9d76c4651d4ac" # frozen: v0.18.0
83+
hooks:
84+
- id: cython-lint
85+
args: [--no-pycodestyle]
86+
exclude: ^cuda_bindings/
87+
8188
default_language_version:
8289
python: python3

cuda_core/cuda/core/experimental/_context.pyx

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

55
from dataclasses import dataclass
66

7-
from cuda.core.experimental._utils.clear_error_support import assert_type
87
from cuda.core.experimental._utils.cuda_utils import driver
98

109

cuda_core/cuda/core/experimental/_memory.pyx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ from cuda.core.experimental._utils.cuda_utils cimport (
2020
)
2121

2222
import abc
23-
import array
24-
import contextlib
2523
import cython
2624
from dataclasses import dataclass, field
2725
from typing import Iterable, Literal, Optional, TYPE_CHECKING, TypeVar, Union
@@ -34,9 +32,6 @@ from cuda.core.experimental._dlpack import DLDeviceType, make_py_capsule
3432
from cuda.core.experimental._stream import Stream
3533
from cuda.core.experimental._utils.cuda_utils import ( driver, Transaction, get_binding_version )
3634

37-
if platform.system() == "Linux":
38-
import socket
39-
4035
if TYPE_CHECKING:
4136
from ._device import Device
4237
import uuid

cuda_core/cuda/core/experimental/_memoryview.pyx

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

5-
cimport cython
6-
75
from ._dlpack cimport *
86

97
import functools
10-
from typing import Any, Optional
8+
from typing import Optional
119

1210
import numpy
1311

@@ -226,7 +224,7 @@ cdef class _StridedMemoryViewProxy:
226224

227225

228226
cdef StridedMemoryView view_as_dlpack(obj, stream_ptr, view=None):
229-
cdef int dldevice, device_id, i
227+
cdef int dldevice, device_id
230228
cdef bint is_device_accessible, is_readonly
231229
is_device_accessible = False
232230
dldevice, device_id = obj.__dlpack_device__()

cuda_core/cuda/core/experimental/_stream.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ from cuda.core.experimental._utils.cuda_utils cimport (
1818
)
1919

2020
import cython
21-
import os
2221
import warnings
2322
from dataclasses import dataclass
2423
from typing import TYPE_CHECKING, Optional, Protocol, Union
@@ -29,7 +28,6 @@ if TYPE_CHECKING:
2928
from cuda.core.experimental._context import Context
3029
from cuda.core.experimental._event import Event, EventOptions
3130
from cuda.core.experimental._graph import GraphBuilder
32-
from cuda.core.experimental._utils.clear_error_support import assert_type
3331
from cuda.core.experimental._utils.cuda_utils import (
3432
driver,
3533
)

0 commit comments

Comments
 (0)