diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fb177f21990..55e912f72b61 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,13 +2,13 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/PyCQA/bandit - rev: '1.7.9' + rev: '1.8.3' hooks: - id: bandit pass_filenames: false args: ["-r", "dpnp", "-lll"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-ast - id: check-builtin-literals @@ -44,17 +44,18 @@ repos: - id: rst-inline-touching-normal - id: text-unicode-replacement-char - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell + args: ["-L", "abd"] # ignore "abd" used in einsum tests additional_dependencies: - tomli - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 25.1.0 hooks: - id: black - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 6.0.1 hooks: - id: isort name: isort (python) @@ -65,20 +66,20 @@ repos: name: isort (pyi) types: [pyi] - repo: https://github.com/pycqa/flake8 - rev: 7.1.0 + rev: 7.1.2 hooks: - id: flake8 args: ["--config=.flake8"] additional_dependencies: - flake8-docstrings==1.7.0 - - flake8-bugbear==24.4.26 + - flake8-bugbear==24.12.12 - repo: https://github.com/pocc/pre-commit-hooks rev: v1.3.5 hooks: - id: clang-format args: ["-i"] - repo: https://github.com/gitleaks/gitleaks - rev: v8.18.4 + rev: v8.24.0 hooks: - id: gitleaks - repo: https://github.com/jumanjihouse/pre-commit-hooks @@ -102,3 +103,8 @@ repos: "--disable=unused-wildcard-import" ] files: '^dpnp/(dpnp_iface.*|fft|linalg)' +- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.14.0 + hooks: + - id: pretty-format-toml + args: [--autofix] diff --git a/dpnp/dpnp_iface_linearalgebra.py b/dpnp/dpnp_iface_linearalgebra.py index 59b046ea9195..057362f59602 100644 --- a/dpnp/dpnp_iface_linearalgebra.py +++ b/dpnp/dpnp_iface_linearalgebra.py @@ -418,7 +418,7 @@ def einsum( >>> a = np.ones(64000).reshape(20, 40, 80) Basic `einsum`: 119 ms ± 26 ms per loop (evaluated on 12th - Gen Intel\u00AE Core\u2122 i7 processor) + Gen Intel\u00ae Core\u2122 i7 processor) >>> %timeit np.einsum("ijk,ilm,njm,nlk,abc->",a, a, a, a, a) diff --git a/dpnp/tests/third_party/cupy/math_tests/test_sumprod.py b/dpnp/tests/third_party/cupy/math_tests/test_sumprod.py index 5125a6f9f3f7..b8f98456a13a 100644 --- a/dpnp/tests/third_party/cupy/math_tests/test_sumprod.py +++ b/dpnp/tests/third_party/cupy/math_tests/test_sumprod.py @@ -376,7 +376,7 @@ def test_cub_cumprod(self, xp, dtype): return self._mitigate_cumprod(xp, dtype, result) def _mitigate_cumprod(self, xp, dtype, result): - # for testing cumprod against complex arrays, the gotcha is CuPy may + # for testing cumprod against complex arrays, the catch is CuPy may # produce only Inf at the position where NumPy starts to give NaN. So, # an error would be raised during assert_allclose where the positions # of NaNs are examined. Since this is both algorithm and architecture diff --git a/dpnp/tests/third_party/intel/zero-copy-test1.py b/dpnp/tests/third_party/intel/zero-copy-test1.py index f99565df5e68..3a749c3d9901 100644 --- a/dpnp/tests/third_party/intel/zero-copy-test1.py +++ b/dpnp/tests/third_party/intel/zero-copy-test1.py @@ -17,11 +17,11 @@ def __init__(self, shape, dtype="d", host_buffer=None): shmem.copy_from_host(host_buffer.view(dtype="|u1")) self.arr = np.ndarray(shape, dtype=dtype, buffer=shmem) - def __getitem__(self, indx): - return self.arr[indx] + def __getitem__(self, index): + return self.arr[index] - def __setitem__(self, indx, val): - self.arr.__setitem__(indx, val) + def __setitem__(self, index, val): + self.arr.__setitem__(index, val) @property def __sycl_usm_array_interface__(self): diff --git a/dpnp/to_numba/dpnp_iface_to_numba.py b/dpnp/to_numba/dpnp_iface_to_numba.py index 392f82f7beb1..7684c69474b1 100644 --- a/dpnp/to_numba/dpnp_iface_to_numba.py +++ b/dpnp/to_numba/dpnp_iface_to_numba.py @@ -40,7 +40,11 @@ import numba from numba.extending import get_cython_function_address as nba_addr -name_to_numba_signatures = {"cos": [(numba.types.float64)]} +name_to_numba_signatures = { + "cos": [ + (numba.types.float64), + ] +} name_and_types_to_pointer = { ("cos", numba.types.float64): ctypes.CFUNCTYPE( diff --git a/pyproject.toml b/pyproject.toml index ccaf3bf2c466..8e50e3e0aa7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,9 +5,38 @@ target-version = ['py38', 'py39', 'py310'] [tool.codespell] builtin = "clear,rare,informal,names" check-filenames = true -ignore-words-list="amin,arange,elemt,fro,hist,ith,mone,nd,nin,sinc,vart" +ignore-words-list = "amin,arange,elemt,fro,hist,ith,mone,nd,nin,sinc,vart" quiet-level = 3 +[tool.coverage.report] +omit = [ + "dpnp/tests/*", + "dpnp/_version.py" +] + +[tool.coverage.run] +branch = true +omit = [ + "dpnp/tests/*", + "dpnp/_version.py" +] +plugins = [ + "Cython.Coverage" +] +source = [ + "dpnp" +] + +[tool.isort] +ensure_newline_before_comments = true +force_grid_wrap = 0 +include_trailing_comma = true +line_length = 80 +multi_line_output = 3 +skip = ["dpnp/__init__.py"] +split_on_trailing_comma = true +use_parentheses = true + [tool.pylint.basic] include-naming-hint = true @@ -16,9 +45,9 @@ exclude-protected = ["_create_from_usm_ndarray"] [tool.pylint.design] max-args = 11 -max-positional-arguments = 9 -max-locals = 30 max-branches = 16 +max-locals = 30 +max-positional-arguments = 9 max-returns = 8 [tool.pylint.format] @@ -31,47 +60,22 @@ allow-wildcard-with-all = true [tool.pylint.miscellaneous] notes = ["FIXME", "XXX"] -[tool.isort] -multi_line_output = 3 -include_trailing_comma = true -force_grid_wrap = 0 -use_parentheses = true -ensure_newline_before_comments = true -line_length = 80 -split_on_trailing_comma = true -skip = ["dpnp/__init__.py"] - -[tool.coverage.run] -plugins = [ - "Cython.Coverage" -] -branch = true -source = [ - "dpnp", -] -omit = [ - "dpnp/tests/*", - "dpnp/_version.py", -] - -[tool.coverage.report] -omit = [ - "dpnp/tests/*", - "dpnp/_version.py", -] - [tool.pytest.ini.options] -minversion = "6.0" -norecursedirs= [ - ".*", "*.egg*", "build", "dist", "conda-recipe", -] addopts = [ - "--junitxml=junit.xml", - "--ignore setup.py", - "--ignore run_test.py", - "--cov-report term-missing", - "--tb native", - "--strict", - "--durations=20", - "-q -ra", + "--junitxml=junit.xml", + "--ignore setup.py", + "--ignore run_test.py", + "--cov-report term-missing", + "--tb native", + "--strict", + "--durations=20", + "-q -ra" +] +minversion = "6.0" +norecursedirs = [ + ".*", + "*.egg*", + "build", + "dist", + "conda-recipe" ]