Skip to content

Commit b0cd5f8

Browse files
authored
Add pre-commit hooks (#1448)
* Added pre-commit hooks * Updated copyright in all files
1 parent 5346a08 commit b0cd5f8

File tree

174 files changed

+1870
-1855
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+1870
-1855
lines changed

.pre-commit-config.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/PyCQA/bandit
5-
rev: '1.7.0'
5+
rev: '1.7.5'
66
hooks:
77
- id: bandit
88
pass_filenames: false
99
args: ["-r", "dpnp", "-lll"]
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.4.0
12+
hooks:
13+
- id: check-ast
14+
- id: check-builtin-literals
15+
- id: check-case-conflict
16+
- id: check-executables-have-shebangs
17+
- id: check-merge-conflict
18+
- id: check-shebang-scripts-are-executable
19+
- id: check-toml
20+
- id: debug-statements
21+
- id: destroyed-symlinks
22+
- id: double-quote-string-fixer
23+
- id: end-of-file-fixer
24+
- id: fix-byte-order-marker
25+
- id: mixed-line-ending
26+
- id: trailing-whitespace

LICENSE.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
Copyright (c) 2016-2020, Intel Corporation
1+
Copyright (c) 2016-2023, Intel Corporation
22
All rights reserved.
33

4-
Redistribution and use in source and binary forms, with or without
4+
Redistribution and use in source and binary forms, with or without
55
modification, are permitted provided that the following conditions are met:
6-
- Redistributions of source code must retain the above copyright notice,
6+
- Redistributions of source code must retain the above copyright notice,
77
this list of conditions and the following disclaimer.
8-
- Redistributions in binary form must reproduce the above copyright notice,
9-
this list of conditions and the following disclaimer in the documentation
8+
- Redistributions in binary form must reproduce the above copyright notice,
9+
this list of conditions and the following disclaimer in the documentation
1010
and/or other materials provided with the distribution.
1111

1212
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1313
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1414
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
16-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
15+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
16+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1919
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
20+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2222
THE POSSIBILITY OF SUCH DAMAGE.

benchmarks/pytest_benchmark/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pytest-benchmark compare results.json --csv=results.csv --group-by='name'
2020
```
2121

2222
## Optional: creating histogram
23-
Note: make sure that `pytest-benchmark[histogram]` installed
23+
Note: make sure that `pytest-benchmark[histogram]` installed
2424
```bash
2525
# example
2626
pip install pytest-benchmark[histogram]

benchmarks/pytest_benchmark/test_random.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# cython: language_level=3
33
# -*- coding: utf-8 -*-
44
# *****************************************************************************
5-
# Copyright (c) 2016-2020, Intel Corporation
5+
# Copyright (c) 2016-2023, Intel Corporation
66
# All rights reserved.
77
#
88
# Redistribution and use in source and binary forms, with or without
@@ -37,36 +37,36 @@
3737
NNUMBERS = 2**26
3838

3939

40-
@pytest.mark.parametrize("function", [dpnp.random.beta, np.random.beta],
41-
ids=["dpnp", "numpy"])
40+
@pytest.mark.parametrize('function', [dpnp.random.beta, np.random.beta],
41+
ids=['dpnp', 'numpy'])
4242
def test_beta(benchmark, function):
4343
result = benchmark.pedantic(target=function, args=(4.0, 5.0, NNUMBERS,),
4444
rounds=ROUNDS, iterations=ITERATIONS)
4545

4646

47-
@pytest.mark.parametrize("function", [dpnp.random.exponential, np.random.exponential],
48-
ids=["dpnp", "numpy"])
47+
@pytest.mark.parametrize('function', [dpnp.random.exponential, np.random.exponential],
48+
ids=['dpnp', 'numpy'])
4949
def test_exponential(benchmark, function):
5050
result = benchmark.pedantic(target=function, args=(4.0, NNUMBERS,),
5151
rounds=ROUNDS, iterations=ITERATIONS)
5252

5353

54-
@pytest.mark.parametrize("function", [dpnp.random.gamma, np.random.gamma],
55-
ids=["dpnp", "numpy"])
54+
@pytest.mark.parametrize('function', [dpnp.random.gamma, np.random.gamma],
55+
ids=['dpnp', 'numpy'])
5656
def test_gamma(benchmark, function):
5757
result = benchmark.pedantic(target=function, args=(2.0, 4.0, NNUMBERS,),
5858
rounds=ROUNDS, iterations=ITERATIONS)
5959

6060

61-
@pytest.mark.parametrize("function", [dpnp.random.normal, np.random.normal],
62-
ids=["dpnp", "numpy"])
61+
@pytest.mark.parametrize('function', [dpnp.random.normal, np.random.normal],
62+
ids=['dpnp', 'numpy'])
6363
def test_normal(benchmark, function):
6464
result = benchmark.pedantic(target=function, args=(0.0, 1.0, NNUMBERS,),
6565
rounds=ROUNDS, iterations=ITERATIONS)
6666

6767

68-
@pytest.mark.parametrize("function", [dpnp.random.uniform, np.random.uniform],
69-
ids=["dpnp", "numpy"])
68+
@pytest.mark.parametrize('function', [dpnp.random.uniform, np.random.uniform],
69+
ids=['dpnp', 'numpy'])
7070
def test_uniform(benchmark, function):
7171
result = benchmark.pedantic(target=function, args=(0.0, 1.0, NNUMBERS,),
7272
rounds=ROUNDS, iterations=ITERATIONS)

conda-recipe/build.sh

100644100755
File mode changed.

conda-recipe/run_test.sh

100644100755
File mode changed.

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ help:
1717
# Catch-all target: route all unknown targets to Sphinx using the new
1818
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
1919
%: Makefile
20-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/_templates/autosummary/class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
{% for item in attributes %}
5151
.. autoattribute:: {{ item }}
5252
{%- endfor %}
53-
{% endif %} {% endblock %}
53+
{% endif %} {% endblock %}

doc/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@
9494
# a list of builtin themes.
9595
#
9696
# html_theme = 'alabaster'
97-
html_theme = "sphinx_rtd_theme"
97+
html_theme = 'sphinx_rtd_theme'
9898
html_theme_options = {
99-
"sidebarwidth": 30,
100-
"nosidebar": False,
99+
'sidebarwidth': 30,
100+
'nosidebar': False,
101101
}
102102

103103
# Theme options are theme-specific and customize the look and feel of a theme

doc/docstring_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# cython: language_level=3
22
# -*- coding: utf-8 -*-
33
# *****************************************************************************
4-
# Copyright (c) 2016-2020, Intel Corporation
4+
# Copyright (c) 2016-2023, Intel Corporation
55
# All rights reserved.
66
#
77
# Redistribution and use in source and binary forms, with or without

doc/reference/linalg.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Matrix and vector products
99
.. autosummary::
1010
:toctree: generated/
1111
:nosignatures:
12-
12+
1313
dpnp.cross
1414
dpnp.dot
1515
dpnp.linalg.multi_dot

doc/reference/math.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ Miscellaneous
182182
dpnp.blackman
183183
dpnp.hamming
184184
dpnp.hanning
185-
dpnp.kaiser
185+
dpnp.kaiser

dpnp/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
# *****************************************************************************
3-
# Copyright (c) 2016-2022, Intel Corporation
3+
# Copyright (c) 2016-2023, Intel Corporation
44
# All rights reserved.
55
#
66
# Redistribution and use in source and binary forms, with or without
@@ -39,10 +39,10 @@
3939
# are not installed under any of default paths where Python is searching.
4040
from platform import system
4141
if system() == 'Windows':
42-
if hasattr(os, "add_dll_directory"):
42+
if hasattr(os, 'add_dll_directory'):
4343
os.add_dll_directory(mypath)
4444
os.add_dll_directory(dpctlpath)
45-
os.environ["PATH"] = os.pathsep.join([os.getenv("PATH", ""), mypath, dpctlpath])
45+
os.environ['PATH'] = os.pathsep.join([os.getenv('PATH', ''), mypath, dpctlpath])
4646

4747
from dpnp.dpnp_array import dpnp_array as ndarray
4848
from dpnp.dpnp_flatiter import flatiter as flatiter

dpnp/backend/cmake/Modules/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ package. Once it is added, expected 2023.2.0, this vendored package is
55
to be removed.
66

77
tbb-devel script has been modified to allow it to work correctly in conda
8-
environment.
8+
environment.

dpnp/backend/cmake/Modules/TBBConfig.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2017-2021 Intel Corporation
1+
# Copyright (c) 2017-2023 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ endif()
3232

3333
get_filename_component(_tbb_root "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
3434
get_filename_component(_tbb_root "${_tbb_root}/../../.." ABSOLUTE)
35-
35+
3636
set(TBB_INTERFACE_VERSION )
3737

3838
set(_tbb_bin_version 12)
@@ -60,7 +60,7 @@ if (UNIX)
6060
set(_tbb_lib_prefix "lib")
6161
set(_tbb_lib_dir_conda "lib")
6262
set(_bin_version "")
63-
elseif (WIN32)
63+
elseif (WIN32)
6464
set(_bin_version "")
6565
set(_tbb_lib_prefix "")
6666
set(_tbb_lib_ext ".dll")
@@ -82,21 +82,21 @@ if(WIN32)
8282
endif()
8383

8484
if(UNIX)
85-
find_library(_tbb_release_lib
85+
find_library(_tbb_release_lib
8686
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}${_tbb_lib_ext}
8787
PATHS ${_tbb_root}
8888
HINTS ENV TBB_ROOT_HINT
8989
PATH_SUFFIXES "${_tbb_lib_dir_conda}" "lib/${_tbb_subdir}")
9090

9191
else()
92-
find_file(_tbb_release_lib
92+
find_file(_tbb_release_lib
9393
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}${_tbb_lib_ext}
9494
PATHS ${_tbb_root}
9595
HINTS ENV TBB_ROOT_HINT
9696
PATH_SUFFIXES "${_tbb_lib_dir_conda}" "lib/${_tbb_subdir}")
9797

9898
if (EXISTS "${_tbb_release_lib}")
99-
find_library(_tbb_release_impllib
99+
find_library(_tbb_release_impllib
100100
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}${_tbb_impllib_ext}
101101
PATHS ${_tbb_root}
102102
HINTS ENV TBB_ROOT_HINT
@@ -105,13 +105,13 @@ endif()
105105
endif()
106106

107107
if (NOT TBB_FIND_RELEASE_ONLY)
108-
find_library(_tbb_debug_lib
108+
find_library(_tbb_debug_lib
109109
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}_debug.${_tbb_lib_ext}
110110
PATHS ${_tbb_root}
111111
HINTS ENV TBB_ROOT_HINT
112112
PATH_SUFFIXES "${_tbb_lib_dir_conda}" "lib/${_tbb_subdir}")
113113
if(WIN32 AND EXISTS "${_tbb_debug_lib}")
114-
find_library(_tbb_debug_impllib
114+
find_library(_tbb_debug_impllib
115115
NAMES ${_tbb_lib_prefix}${_tbb_component}${_bin_version}_debug.${_tbb_impllib_ext}
116116
PATHS ${_tbb_root}
117117
HINTS ENV TBB_ROOT_HINT

dpnp/backend/cmake/Modules/oneDPLConfig.cmake

100755100644
File mode changed.

dpnp/backend/examples/example10.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example11.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example5.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example7.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example9.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example_bs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/examples/example_experimental_iface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/include/dpnp_gen_1arg_2type_tbl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/include/dpnp_iface_fft.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/include/dpnp_iface_random.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/kernels/dpnp_krnl_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

dpnp/backend/kernels/dpnp_krnl_linalg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2022, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without
@@ -1038,7 +1038,7 @@ void func_map_init_linalg_func(func_map_t& fmap)
10381038
(void*)dpnp_svd_default_c<double, double, double>};
10391039
fmap[DPNPFuncName::DPNP_FN_SVD][eft_C128][eft_C128] = {
10401040
eft_C128, (void*)dpnp_svd_default_c<std::complex<double>, std::complex<double>, double>};
1041-
1041+
10421042
fmap[DPNPFuncName::DPNP_FN_SVD_EXT][eft_INT][eft_INT] = {eft_DBL,
10431043
(void*)dpnp_svd_ext_c<int32_t, double, double>};
10441044
fmap[DPNPFuncName::DPNP_FN_SVD_EXT][eft_LNG][eft_LNG] = {eft_DBL,

dpnp/backend/kernels/dpnp_krnl_random.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,7 @@ void func_map_init_random(func_map_t& fmap)
29062906
(void*)dpnp_rng_binomial_default_c<int32_t>};
29072907

29082908
fmap[DPNPFuncName::DPNP_FN_RNG_BINOMIAL_EXT][eft_INT][eft_INT] = {eft_INT,
2909-
(void*)dpnp_rng_binomial_ext_c<int32_t>};
2909+
(void*)dpnp_rng_binomial_ext_c<int32_t>};
29102910

29112911
fmap[DPNPFuncName::DPNP_FN_RNG_CHISQUARE][eft_DBL][eft_DBL] = {eft_DBL,
29122912
(void*)dpnp_rng_chisquare_default_c<double>};

dpnp/backend/kernels/dpnp_krnl_reduction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//*****************************************************************************
2-
// Copyright (c) 2016-2020, Intel Corporation
2+
// Copyright (c) 2016-2023, Intel Corporation
33
// All rights reserved.
44
//
55
// Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)