Skip to content

Commit a8e6fce

Browse files
authored
Extend pre-commit hooks with codespell (#1798)
* Extend pre-commit hooks with codespell * Stepped versions of pre-commit hooks to the latest releases
1 parent 6b79b34 commit a8e6fce

28 files changed

Lines changed: 56 additions & 43 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ jobs:
1818
sudo ln -s /usr/bin/clang-format-12 /usr/bin/clang-format
1919
clang-format --version
2020
21-
- name: Set up pylint
21+
- name: Set up pip packages
2222
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
2323
with:
2424
packages: |
25+
codespell
2526
pylint
2627
2728
- name: Checkout DPNP repo

.pre-commit-config.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/PyCQA/bandit
5-
rev: '1.7.7'
5+
rev: '1.7.8'
66
hooks:
77
- id: bandit
88
pass_filenames: false
@@ -42,8 +42,14 @@ repos:
4242
- id: rst-directive-colons
4343
- id: rst-inline-touching-normal
4444
- id: text-unicode-replacement-char
45+
- repo: https://github.com/codespell-project/codespell
46+
rev: v2.2.6
47+
hooks:
48+
- id: codespell
49+
additional_dependencies:
50+
- tomli
4551
- repo: https://github.com/psf/black
46-
rev: 23.12.1
52+
rev: 24.4.0
4753
hooks:
4854
- id: black
4955
args: ["--check", "--diff", "--color"]

doc/_templates/autosummary/class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
{% endblock %}
4242

4343
..
44-
Atributes
44+
Attributes
4545
4646
{% block attributes %} {% if attributes %}
4747

doc/docstring_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
4343
Recommendations:
4444
1. Short description
45-
maybe partially taken/combinated from `numpy` and `cupy` docstrings.
45+
maybe partially taken/combined from `numpy` and `cupy` docstrings.
4646
2. Limitations basically should be described according to the code,
4747
paying attention to raised exceptions and fallback to `numpy`.
4848
3. See Also may include links to similar functionality in `dpnp`

dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function(SYCL_FEATURE_TEST_RUN TEST_EXE)
188188
set(IntelSYCL_FOUND False)
189189
set(SYCL_REASON_FAILURE "SYCL: feature test execution failed!!")
190190
endif()
191-
# TODO: what iff the result is false.. error or ignore?
191+
# TODO: what if the result is false.. error or ignore?
192192

193193
set( test_result "${result}" PARENT_SCOPE)
194194
set( test_output "${output}" PARENT_SCOPE)

dpnp/backend/examples/example_bs.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ void black_scholes(double *price,
144144
dpnp_memory_free_c(w1);
145145
double *halfs_mul_erf_w1 =
146146
(double *)dpnp_memory_alloc_c(size * sizeof(double));
147-
// halfs_mul_erf_w1 = halfs * erf_w1
147+
// halfs_mul_erf_w1 = half * erf_w1
148148
dpnp_multiply_c<double, double, double>(halfs_mul_erf_w1, half, scalar_size,
149149
&scalar_size, ndim, erf_w1, size,
150150
&size, ndim, NULL);
151151
dpnp_memory_free_c(erf_w1);
152152
double *d1 = (double *)dpnp_memory_alloc_c(size * sizeof(double));
153-
// d1 = halfs + halfs_mul_erf_w1
153+
// d1 = half + halfs_mul_erf_w1
154154
dpnp_add_c<double, double, double>(d1, half, scalar_size, &scalar_size,
155155
ndim, halfs_mul_erf_w1, size, &size,
156156
ndim, NULL);
@@ -161,13 +161,13 @@ void black_scholes(double *price,
161161
dpnp_memory_free_c(w2);
162162
double *halfs_mul_erf_w2 =
163163
(double *)dpnp_memory_alloc_c(size * sizeof(double));
164-
// halfs_mul_erf_w2 = halfs * erf_w2
164+
// halfs_mul_erf_w2 = half * erf_w2
165165
dpnp_multiply_c<double, double, double>(halfs_mul_erf_w2, half, scalar_size,
166166
&scalar_size, ndim, erf_w2, size,
167167
&size, ndim, NULL);
168168
dpnp_memory_free_c(erf_w2);
169169
double *d2 = (double *)dpnp_memory_alloc_c(size * sizeof(double));
170-
// d2 = halfs + halfs_mul_erf_w2
170+
// d2 = half + halfs_mul_erf_w2
171171
dpnp_add_c<double, double, double>(d2, half, scalar_size, &scalar_size,
172172
ndim, halfs_mul_erf_w2, size, &size,
173173
ndim, NULL);

dpnp/backend/extensions/blas/gemm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ std::pair<sycl::event, sycl::event>
181181
}
182182
if (b_shape[1] != c_shape[1]) {
183183
throw py::value_error("The number of columns in B must be equal to "
184-
"the number of coulmns in result array.");
184+
"the number of columns in result array.");
185185
}
186186

187187
size_t src_nelems = m * n;

dpnp/backend/extensions/blas/gemm_batch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ std::pair<sycl::event, sycl::event>
198198
}
199199
if (b_shape[matrixB_nd - 1] != c_shape[resultC_nd - 1]) {
200200
throw py::value_error("The number of columns in B must be equal to "
201-
"the number of coulmns in result array.");
201+
"the number of columns in result array.");
202202
}
203203

204204
bool shapes_equal = true;

dpnp/backend/extensions/sycl_ext/dispatcher_utils.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,11 @@ struct coord_in_space<DispatchT, Matcher, std::tuple<CurrentAxis>>
300300
}
301301
};
302302

303-
template <typename DispatchT, typename Matcher, typename... Axises>
304-
struct coord_in_space<DispatchT, Matcher, std::tuple<Axises...>>
303+
template <typename DispatchT, typename Matcher, typename... Axes>
304+
struct coord_in_space<DispatchT, Matcher, std::tuple<Axes...>>
305305
{
306-
using CurrentAxis = typename pop_tuple_type<std::tuple<Axises...>>::element;
307-
using OtherAxises = typename pop_tuple_type<std::tuple<Axises...>>::rest;
306+
using CurrentAxis = typename pop_tuple_type<std::tuple<Axes...>>::element;
307+
using OtherAxises = typename pop_tuple_type<std::tuple<Axes...>>::rest;
308308

309309
static bool get(const DispatchT *data, int *result)
310310
{

dpnp/dpnp_iface_manipulation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,9 +1410,11 @@ def result_type(*arrays_and_dtypes):
14101410
"""
14111411

14121412
usm_arrays_and_dtypes = [
1413-
dpnp.get_usm_ndarray(X)
1414-
if isinstance(X, (dpnp_array, dpt.usm_ndarray))
1415-
else X
1413+
(
1414+
dpnp.get_usm_ndarray(X)
1415+
if isinstance(X, (dpnp_array, dpt.usm_ndarray))
1416+
else X
1417+
)
14161418
for X in arrays_and_dtypes
14171419
]
14181420
return dpt.result_type(*usm_arrays_and_dtypes)

0 commit comments

Comments
 (0)