Skip to content

Commit e627184

Browse files
authored
Added pygrep-hooks to pre-commit config (#1454)
1 parent c106d91 commit e627184

File tree

5 files changed

+48
-13
lines changed

5 files changed

+48
-13
lines changed

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ repos:
2323
- id: fix-byte-order-marker
2424
- id: mixed-line-ending
2525
- id: trailing-whitespace
26+
- repo: https://github.com/pre-commit/pygrep-hooks
27+
rev: v1.10.0
28+
hooks:
29+
- id: python-check-blanket-noqa
30+
- id: python-check-blanket-type-ignore
31+
- id: python-check-mock-methods
32+
- id: python-no-eval
33+
exclude: |
34+
(?x)^(
35+
tests/test_arraycreation.py|
36+
tests/test_sycl_queue.py|
37+
tests/test_usm_type.py
38+
)$
39+
- id: python-no-log-warn
40+
- id: python-use-type-annotations
41+
- id: rst-backticks
42+
- id: rst-directive-colons
43+
- id: rst-inline-touching-normal
44+
- id: text-unicode-replacement-char
2645
- repo: https://github.com/psf/black
2746
rev: 23.3.0
2847
hooks:

tests/third_party/cupy/creation_tests/test_from_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def test_fromfile(self, xp):
558558
# mask = testing.shaped_arange((2, 3, 4), cupy, dtype)
559559
# a = DummyObjectWithCudaArrayInterface(a, self.ver, self.strides, mask)
560560
# with pytest.raises(ValueError) as ex:
561-
# b = cupy.asarray(a) # noqa
561+
# b = cupy.asarray(a)
562562
# assert 'does not support' in str(ex.value)
563563

564564

tests/third_party/cupy/testing/array.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def assert_allclose(
2121
2222
.. seealso:: :func:`numpy.testing.assert_allclose`
2323
24-
""" # NOQA
24+
"""
25+
2526
numpy.testing.assert_allclose(
2627
dpnp.asnumpy(actual),
2728
dpnp.asnumpy(desired),
@@ -44,7 +45,9 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg="", verbose=True):
4445
values are appended to the error message.
4546
4647
.. seealso:: :func:`numpy.testing.assert_array_almost_equal`
47-
""" # NOQA
48+
49+
"""
50+
4851
numpy.testing.assert_array_almost_equal(
4952
dpnp.asnumpy(x),
5053
dpnp.asnumpy(y),
@@ -80,7 +83,9 @@ def assert_array_max_ulp(a, b, maxulp=1, dtype=None):
8083
dtype(numpy.dtype): Data-type to convert ``a`` and ``b`` to if given.
8184
8285
.. seealso:: :func:`numpy.testing.assert_array_max_ulp`
83-
""" # NOQA
86+
87+
"""
88+
8489
numpy.testing.assert_array_max_ulp(
8590
dpnp.asnumpy(a), dpnp.asnumpy(b), maxulp=maxulp, dtype=dtype
8691
)
@@ -165,7 +170,9 @@ def assert_array_less(x, y, err_msg="", verbose=True):
165170
are appended to the error message.
166171
167172
.. seealso:: :func:`numpy.testing.assert_array_less`
168-
""" # NOQA
173+
174+
"""
175+
169176
numpy.testing.assert_array_less(
170177
dpnp.asnumpy(x), dpnp.asnumpy(y), err_msg=err_msg, verbose=verbose
171178
)

tests/third_party/cupy/testing/helper.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,8 @@ def numpy_cupy_array_almost_equal_nulp(
522522
(except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.
523523
524524
.. seealso:: :func:`cupy.testing.assert_array_almost_equal_nulp`
525-
""" # NOQA
525+
526+
"""
526527

527528
def check_func(x, y):
528529
array.assert_array_almost_equal_nulp(x, y, nulp)
@@ -570,7 +571,7 @@ def numpy_cupy_array_max_ulp(
570571
571572
.. seealso:: :func:`cupy.testing.assert_array_max_ulp`
572573
573-
""" # NOQA
574+
"""
574575

575576
def check_func(x, y):
576577
array.assert_array_max_ulp(x, y, maxulp, dtype)
@@ -659,7 +660,8 @@ def numpy_cupy_array_list_equal(
659660
(except the type of array module) even if ``xp`` is ``numpy`` or ``cupy``.
660661
661662
.. seealso:: :func:`cupy.testing.assert_array_list_equal`
662-
""" # NOQA
663+
664+
"""
663665

664666
def check_func(x, y):
665667
array.assert_array_equal(x, y, err_msg, verbose)
@@ -1011,7 +1013,9 @@ def for_int_dtypes(name="dtype", no_bool=False):
10111013
10121014
.. seealso:: :func:`cupy.testing.for_dtypes`,
10131015
:func:`cupy.testing.for_all_dtypes`
1014-
""" # NOQA
1016+
1017+
"""
1018+
10151019
if no_bool:
10161020
return for_dtypes(_int_dtypes, name=name)
10171021
else:
@@ -1139,7 +1143,9 @@ def for_signed_dtypes_combination(names=("dtype",), full=None):
11391143
(see description in :func:`cupy.testing.for_dtypes_combination`).
11401144
11411145
.. seealso:: :func:`cupy.testing.for_dtypes_combination`
1142-
""" # NOQA
1146+
1147+
"""
1148+
11431149
return for_dtypes_combination(_signed_dtypes, names=names, full=full)
11441150

11451151

@@ -1154,7 +1160,9 @@ def for_unsigned_dtypes_combination(names=("dtype",), full=None):
11541160
(see description in :func:`cupy.testing.for_dtypes_combination`).
11551161
11561162
.. seealso:: :func:`cupy.testing.for_dtypes_combination`
1157-
""" # NOQA
1163+
1164+
"""
1165+
11581166
return for_dtypes_combination(_unsigned_dtypes, names=names, full=full)
11591167

11601168

@@ -1171,7 +1179,9 @@ def for_int_dtypes_combination(names=("dtype",), no_bool=False, full=None):
11711179
(see description in :func:`cupy.testing.for_dtypes_combination`).
11721180
11731181
.. seealso:: :func:`cupy.testing.for_dtypes_combination`
1174-
""" # NOQA
1182+
1183+
"""
1184+
11751185
if no_bool:
11761186
types = _int_dtypes
11771187
else:

tests/third_party/cupy/testing/parameterized.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import io
33
import itertools
44
import types
5-
import typing as tp # NOQA
65
import unittest
76

87
from tests.third_party.cupy.testing import _bundle

0 commit comments

Comments
 (0)