Skip to content

Commit edb86e6

Browse files
authored
Extend pre-commit hooks with pretty-format-toml (#2399)
In this PR, pre-commit hook is extended with pretty-format-toml. In addition, the version of other packages in pre-commit hook is updated.
1 parent f6e6adb commit edb86e6

File tree

6 files changed

+73
-59
lines changed

6 files changed

+73
-59
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/PyCQA/bandit
5-
rev: '1.7.9'
5+
rev: '1.8.3'
66
hooks:
77
- id: bandit
88
pass_filenames: false
99
args: ["-r", "dpnp", "-lll"]
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.6.0
11+
rev: v5.0.0
1212
hooks:
1313
- id: check-ast
1414
- id: check-builtin-literals
@@ -44,17 +44,18 @@ repos:
4444
- id: rst-inline-touching-normal
4545
- id: text-unicode-replacement-char
4646
- repo: https://github.com/codespell-project/codespell
47-
rev: v2.3.0
47+
rev: v2.4.1
4848
hooks:
4949
- id: codespell
50+
args: ["-L", "abd"] # ignore "abd" used in einsum tests
5051
additional_dependencies:
5152
- tomli
5253
- repo: https://github.com/psf/black
53-
rev: 24.4.2
54+
rev: 25.1.0
5455
hooks:
5556
- id: black
5657
- repo: https://github.com/pycqa/isort
57-
rev: 5.13.2
58+
rev: 6.0.1
5859
hooks:
5960
- id: isort
6061
name: isort (python)
@@ -65,20 +66,20 @@ repos:
6566
name: isort (pyi)
6667
types: [pyi]
6768
- repo: https://github.com/pycqa/flake8
68-
rev: 7.1.0
69+
rev: 7.1.2
6970
hooks:
7071
- id: flake8
7172
args: ["--config=.flake8"]
7273
additional_dependencies:
7374
- flake8-docstrings==1.7.0
74-
- flake8-bugbear==24.4.26
75+
- flake8-bugbear==24.12.12
7576
- repo: https://github.com/pocc/pre-commit-hooks
7677
rev: v1.3.5
7778
hooks:
7879
- id: clang-format
7980
args: ["-i"]
8081
- repo: https://github.com/gitleaks/gitleaks
81-
rev: v8.18.4
82+
rev: v8.24.0
8283
hooks:
8384
- id: gitleaks
8485
- repo: https://github.com/jumanjihouse/pre-commit-hooks
@@ -102,3 +103,8 @@ repos:
102103
"--disable=unused-wildcard-import"
103104
]
104105
files: '^dpnp/(dpnp_iface.*|fft|linalg)'
106+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
107+
rev: v2.14.0
108+
hooks:
109+
- id: pretty-format-toml
110+
args: [--autofix]

dpnp/dpnp_iface_linearalgebra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def einsum(
418418
>>> a = np.ones(64000).reshape(20, 40, 80)
419419
420420
Basic `einsum`: 119 ms ± 26 ms per loop (evaluated on 12th
421-
Gen Intel\u00AE Core\u2122 i7 processor)
421+
Gen Intel\u00ae Core\u2122 i7 processor)
422422
423423
>>> %timeit np.einsum("ijk,ilm,njm,nlk,abc->",a, a, a, a, a)
424424

dpnp/tests/third_party/cupy/math_tests/test_sumprod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def test_cub_cumprod(self, xp, dtype):
376376
return self._mitigate_cumprod(xp, dtype, result)
377377

378378
def _mitigate_cumprod(self, xp, dtype, result):
379-
# for testing cumprod against complex arrays, the gotcha is CuPy may
379+
# for testing cumprod against complex arrays, the catch is CuPy may
380380
# produce only Inf at the position where NumPy starts to give NaN. So,
381381
# an error would be raised during assert_allclose where the positions
382382
# of NaNs are examined. Since this is both algorithm and architecture

dpnp/tests/third_party/intel/zero-copy-test1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def __init__(self, shape, dtype="d", host_buffer=None):
1717
shmem.copy_from_host(host_buffer.view(dtype="|u1"))
1818
self.arr = np.ndarray(shape, dtype=dtype, buffer=shmem)
1919

20-
def __getitem__(self, indx):
21-
return self.arr[indx]
20+
def __getitem__(self, index):
21+
return self.arr[index]
2222

23-
def __setitem__(self, indx, val):
24-
self.arr.__setitem__(indx, val)
23+
def __setitem__(self, index, val):
24+
self.arr.__setitem__(index, val)
2525

2626
@property
2727
def __sycl_usm_array_interface__(self):

dpnp/to_numba/dpnp_iface_to_numba.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
import numba
4141
from numba.extending import get_cython_function_address as nba_addr
4242

43-
name_to_numba_signatures = {"cos": [(numba.types.float64)]}
43+
name_to_numba_signatures = {
44+
"cos": [
45+
(numba.types.float64),
46+
]
47+
}
4448

4549
name_and_types_to_pointer = {
4650
("cos", numba.types.float64): ctypes.CFUNCTYPE(

pyproject.toml

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,38 @@ target-version = ['py38', 'py39', 'py310']
55
[tool.codespell]
66
builtin = "clear,rare,informal,names"
77
check-filenames = true
8-
ignore-words-list="amin,arange,elemt,fro,hist,ith,mone,nd,nin,sinc,vart"
8+
ignore-words-list = "amin,arange,elemt,fro,hist,ith,mone,nd,nin,sinc,vart"
99
quiet-level = 3
1010

11+
[tool.coverage.report]
12+
omit = [
13+
"dpnp/tests/*",
14+
"dpnp/_version.py"
15+
]
16+
17+
[tool.coverage.run]
18+
branch = true
19+
omit = [
20+
"dpnp/tests/*",
21+
"dpnp/_version.py"
22+
]
23+
plugins = [
24+
"Cython.Coverage"
25+
]
26+
source = [
27+
"dpnp"
28+
]
29+
30+
[tool.isort]
31+
ensure_newline_before_comments = true
32+
force_grid_wrap = 0
33+
include_trailing_comma = true
34+
line_length = 80
35+
multi_line_output = 3
36+
skip = ["dpnp/__init__.py"]
37+
split_on_trailing_comma = true
38+
use_parentheses = true
39+
1140
[tool.pylint.basic]
1241
include-naming-hint = true
1342

@@ -16,9 +45,9 @@ exclude-protected = ["_create_from_usm_ndarray"]
1645

1746
[tool.pylint.design]
1847
max-args = 11
19-
max-positional-arguments = 9
20-
max-locals = 30
2148
max-branches = 16
49+
max-locals = 30
50+
max-positional-arguments = 9
2251
max-returns = 8
2352

2453
[tool.pylint.format]
@@ -31,47 +60,22 @@ allow-wildcard-with-all = true
3160
[tool.pylint.miscellaneous]
3261
notes = ["FIXME", "XXX"]
3362

34-
[tool.isort]
35-
multi_line_output = 3
36-
include_trailing_comma = true
37-
force_grid_wrap = 0
38-
use_parentheses = true
39-
ensure_newline_before_comments = true
40-
line_length = 80
41-
split_on_trailing_comma = true
42-
skip = ["dpnp/__init__.py"]
43-
44-
[tool.coverage.run]
45-
plugins = [
46-
"Cython.Coverage"
47-
]
48-
branch = true
49-
source = [
50-
"dpnp",
51-
]
52-
omit = [
53-
"dpnp/tests/*",
54-
"dpnp/_version.py",
55-
]
56-
57-
[tool.coverage.report]
58-
omit = [
59-
"dpnp/tests/*",
60-
"dpnp/_version.py",
61-
]
62-
6363
[tool.pytest.ini.options]
64-
minversion = "6.0"
65-
norecursedirs= [
66-
".*", "*.egg*", "build", "dist", "conda-recipe",
67-
]
6864
addopts = [
69-
"--junitxml=junit.xml",
70-
"--ignore setup.py",
71-
"--ignore run_test.py",
72-
"--cov-report term-missing",
73-
"--tb native",
74-
"--strict",
75-
"--durations=20",
76-
"-q -ra",
65+
"--junitxml=junit.xml",
66+
"--ignore setup.py",
67+
"--ignore run_test.py",
68+
"--cov-report term-missing",
69+
"--tb native",
70+
"--strict",
71+
"--durations=20",
72+
"-q -ra"
73+
]
74+
minversion = "6.0"
75+
norecursedirs = [
76+
".*",
77+
"*.egg*",
78+
"build",
79+
"dist",
80+
"conda-recipe"
7781
]

0 commit comments

Comments
 (0)