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

0 commit comments

Comments
 (0)