diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 10b36ce70..bb564d0fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -78,5 +78,12 @@ repos: hooks: - id: actionlint + - repo: https://github.com/MarcoGorelli/cython-lint + rev: "d9ff7ce99ef4f2ae8fba93079ca9d76c4651d4ac" # frozen: v0.18.0 + hooks: + - id: cython-lint + args: [--no-pycodestyle] + exclude: ^cuda_bindings/ + default_language_version: python: python3 diff --git a/cuda_core/cuda/core/experimental/_context.pyx b/cuda_core/cuda/core/experimental/_context.pyx index b03828a1b..d6ccf3231 100644 --- a/cuda_core/cuda/core/experimental/_context.pyx +++ b/cuda_core/cuda/core/experimental/_context.pyx @@ -4,7 +4,6 @@ from dataclasses import dataclass -from cuda.core.experimental._utils.clear_error_support import assert_type from cuda.core.experimental._utils.cuda_utils import driver diff --git a/cuda_core/cuda/core/experimental/_memory.pyx b/cuda_core/cuda/core/experimental/_memory.pyx index 34e9d18e4..024ffa2ae 100644 --- a/cuda_core/cuda/core/experimental/_memory.pyx +++ b/cuda_core/cuda/core/experimental/_memory.pyx @@ -20,8 +20,6 @@ from cuda.core.experimental._utils.cuda_utils cimport ( ) import abc -import array -import contextlib import cython from dataclasses import dataclass, field from typing import Iterable, Literal, Optional, TYPE_CHECKING, TypeVar, Union @@ -34,9 +32,6 @@ from cuda.core.experimental._dlpack import DLDeviceType, make_py_capsule from cuda.core.experimental._stream import Stream from cuda.core.experimental._utils.cuda_utils import ( driver, Transaction, get_binding_version ) -if platform.system() == "Linux": - import socket - if TYPE_CHECKING: from ._device import Device import uuid diff --git a/cuda_core/cuda/core/experimental/_memoryview.pyx b/cuda_core/cuda/core/experimental/_memoryview.pyx index 6bec14def..3ae7fed14 100644 --- a/cuda_core/cuda/core/experimental/_memoryview.pyx +++ b/cuda_core/cuda/core/experimental/_memoryview.pyx @@ -2,12 +2,10 @@ # # SPDX-License-Identifier: Apache-2.0 -cimport cython - from ._dlpack cimport * import functools -from typing import Any, Optional +from typing import Optional import numpy @@ -226,7 +224,7 @@ cdef class _StridedMemoryViewProxy: cdef StridedMemoryView view_as_dlpack(obj, stream_ptr, view=None): - cdef int dldevice, device_id, i + cdef int dldevice, device_id cdef bint is_device_accessible, is_readonly is_device_accessible = False dldevice, device_id = obj.__dlpack_device__() diff --git a/cuda_core/cuda/core/experimental/_stream.pyx b/cuda_core/cuda/core/experimental/_stream.pyx index 4afde6baf..e2a418ac2 100644 --- a/cuda_core/cuda/core/experimental/_stream.pyx +++ b/cuda_core/cuda/core/experimental/_stream.pyx @@ -18,7 +18,6 @@ from cuda.core.experimental._utils.cuda_utils cimport ( ) import cython -import os import warnings from dataclasses import dataclass from typing import TYPE_CHECKING, Optional, Protocol, Union @@ -29,7 +28,6 @@ if TYPE_CHECKING: from cuda.core.experimental._context import Context from cuda.core.experimental._event import Event, EventOptions from cuda.core.experimental._graph import GraphBuilder -from cuda.core.experimental._utils.clear_error_support import assert_type from cuda.core.experimental._utils.cuda_utils import ( driver, )