Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/PyCQA/bandit
rev: '1.9.2'
rev: '1.9.3'
hooks:
- id: bandit
pass_filenames: false
Expand Down Expand Up @@ -64,7 +64,7 @@ repos:
additional_dependencies:
- tomli
- repo: https://github.com/psf/black
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
exclude: "dpnp/_version.py"
Expand Down
1 change: 0 additions & 1 deletion dpnp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@
kaiser,
)


# =============================================================================
# Helper functions
# =============================================================================
Expand Down
1 change: 0 additions & 1 deletion dpnp/dpnp_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

"""


import dpctl.tensor as dpt
import dpctl.utils as dpu

Expand Down
1 change: 1 addition & 0 deletions dpnp/dpnp_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- The functions parameters check

"""

# pylint: disable=protected-access

import os
Expand Down
1 change: 0 additions & 1 deletion dpnp/dpnp_iface_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

"""


# pylint: disable=duplicate-code

import operator
Expand Down
3 changes: 1 addition & 2 deletions dpnp/dpnp_iface_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"""


import math
import operator
import warnings
Expand Down Expand Up @@ -3418,7 +3417,7 @@ def rot90(m, k=1, axes=(0, 1)):
return dpnp.flip(dpnp.flip(m, axes[0]), axes[1])

axes_list = list(range(0, m_ndim))
(axes_list[axes[0]], axes_list[axes[1]]) = (
axes_list[axes[0]], axes_list[axes[1]] = (
axes_list[axes[1]],
axes_list[axes[0]],
)
Expand Down
1 change: 0 additions & 1 deletion dpnp/linalg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

"""


from .dpnp_iface_linalg import (
LinAlgError,
cholesky,
Expand Down
1 change: 0 additions & 1 deletion dpnp/random/dpnp_random_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

"""


import dpctl.utils as dpu
import numpy

Expand Down
1 change: 0 additions & 1 deletion dpnp/scipy/linalg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

"""


from ._decomp_lu import lu_factor, lu_solve

__all__ = [
Expand Down
3 changes: 1 addition & 2 deletions dpnp/scipy/linalg/_decomp_lu.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"""


import dpnp
from dpnp.linalg.dpnp_utils_linalg import (
assert_stacked_2d,
Expand Down Expand Up @@ -181,7 +180,7 @@ def lu_solve(lu_and_piv, b, trans=0, overwrite_b=False, check_finite=True):
"""

(lu, piv) = lu_and_piv
lu, piv = lu_and_piv
dpnp.check_supported_arrays_type(lu, piv, b)
assert_stacked_2d(lu)
assert_stacked_square(lu)
Expand Down
1 change: 0 additions & 1 deletion dpnp/scipy/linalg/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

"""


# pylint: disable=no-name-in-module
# pylint: disable=protected-access

Expand Down
4 changes: 1 addition & 3 deletions dpnp/tests/third_party/cupy/core_tests/test_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def test_key_error(self):
def test_repr(self):
assert """ C_CONTIGUOUS : 1
F_CONTIGUOUS : 2
OWNDATA : 3""" == repr(
self.flags
)
OWNDATA : 3""" == repr(self.flags)


@testing.parameterize(
Expand Down
8 changes: 2 additions & 6 deletions dpnp/tests/third_party/cupy/core_tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def test_custom_user_struct(self):
offsets[3] = (unsigned long long)&ptr->d;
offsets[4] = (unsigned long long)&ptr->e;
}}
""".format(
struct_definition=struct_definition
)
""".format(struct_definition=struct_definition)

itemsize = cupy.ndarray(shape=(1,), dtype=numpy.uint64)
sizes = cupy.ndarray(shape=(5,), dtype=numpy.uint64)
Expand Down Expand Up @@ -213,9 +211,7 @@ def make_packed(basetype, N, itemsize):
sum += s.e[0] + s.e[1] + s.e[2];
x[i] = a[i] + sum;
}}
""".format(
struct_definition=struct_definition
)
""".format(struct_definition=struct_definition)

a_cpu = numpy.arange(24, dtype=numpy.float64)
a = cupy.array(a_cpu)
Expand Down
10 changes: 2 additions & 8 deletions dpnp/tests/third_party/cupy/core_tests/test_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,19 @@
#include <cupy/hip_workaround.cuh>
"""

_code_nvcc = (
_code_base
+ """
_code_nvcc = _code_base + """
#include <cupy/type_dispatcher.cuh>

int main() {
return 0;
}
"""
)

_code_nvrtc = (
_code_base
+ """
_code_nvrtc = _code_base + """

__device__ void kernel() {
}
"""
)


@pytest.mark.skipif(cupy.cuda.runtime.is_hip, reason="for CUDA")
Expand Down
12 changes: 4 additions & 8 deletions dpnp/tests/third_party/cupy/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ def _run_script(code):


def _test_cupy_available(self):
returncode, stdoutdata, stderrdata = _run_script(
"""
returncode, stdoutdata, stderrdata = _run_script("""
import dpnp as cupy
print(cupy.is_available())"""
)
print(cupy.is_available())""")
assert returncode == 0, "stderr: {!r}".format(stderrdata)
assert stdoutdata in (b"True\n", b"True\r\n", b"False\n", b"False\r\n")
return stdoutdata == b"True\n" or stdoutdata == b"True\r\n"
Expand All @@ -49,14 +47,12 @@ def _test_cupy_available(self):
class TestImportError(unittest.TestCase):

def test_import_error(self):
returncode, stdoutdata, stderrdata = _run_script(
"""
returncode, stdoutdata, stderrdata = _run_script("""
try:
import dpnp as cupy
except Exception as e:
print(type(e).__name__)
"""
)
""")
assert returncode == 0, "stderr: {!r}".format(stderrdata)
assert stdoutdata in (b"", b"RuntimeError\n")

Expand Down
10 changes: 4 additions & 6 deletions dpnp/tests/third_party/cupy/testing/_loops.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def decorator(impl):
@_wraps_partial_xp(impl, name, sp_name, scipy_name)
def test_func(*args, **kw):
# Run cupy and numpy
(cupy_result, cupy_error, numpy_result, numpy_error) = (
cupy_result, cupy_error, numpy_result, numpy_error = (
_call_func_numpy_cupy(impl, args, kw, name, sp_name, scipy_name)
)
assert cupy_result is not None or cupy_error is not None
Expand Down Expand Up @@ -344,9 +344,7 @@ def test_func(*args, **kw):
raise AssertionError(
"""ndarrays of different dtypes are returned.
cupy: {}
numpy: {}""".format(
cupy_r.dtype, numpy_r.dtype
)
numpy: {}""".format(cupy_r.dtype, numpy_r.dtype)
)

# Check contiguous
Expand Down Expand Up @@ -902,7 +900,7 @@ def decorator(impl):
@_wraps_partial_xp(impl, name, sp_name, scipy_name)
def test_func(*args, **kw):
# Run cupy and numpy
(cupy_result, cupy_error, numpy_result, numpy_error) = (
cupy_result, cupy_error, numpy_result, numpy_error = (
_call_func_numpy_cupy(impl, args, kw, name, sp_name, scipy_name)
)

Expand Down Expand Up @@ -958,7 +956,7 @@ def decorator(impl):
@_wraps_partial_xp(impl, name, sp_name, scipy_name)
def test_func(*args, **kw):
# Run cupy and numpy
(cupy_result, cupy_error, numpy_result, numpy_error) = (
cupy_result, cupy_error, numpy_result, numpy_error = (
_call_func_numpy_cupy(impl, args, kw, name, sp_name, scipy_name)
)

Expand Down
8 changes: 2 additions & 6 deletions dpnp/tests/third_party/cupy/testing/_pytest_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ def is_available():

def check_available(feature):
if not is_available():
raise RuntimeError(
"""\
raise RuntimeError("""\
cupy.testing: {} is not available.

Reason: {}: {}""".format(
feature, type(_error).__name__, _error
)
)
Reason: {}: {}""".format(feature, type(_error).__name__, _error))


if is_available():
Expand Down
1 change: 0 additions & 1 deletion examples/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

"""


import time

import dpctl
Expand Down
1 change: 0 additions & 1 deletion examples/example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

"""


import time

import numpy
Expand Down
1 change: 0 additions & 1 deletion examples/example4.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

"""


import numpy

"""
Expand Down
Loading