Skip to content

Commit 8756f16

Browse files
[pre-commit.ci] pre-commit autoupdate (#4151)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/Lucas-C/pre-commit-hooks: v1.3.0 → v1.3.1](Lucas-C/pre-commit-hooks@v1.3.0...v1.3.1) - [github.com/sirosen/texthooks: 0.3.1 → 0.4.0](sirosen/texthooks@0.3.1...0.4.0) - [github.com/PyCQA/pylint: v2.14.5 → v2.15.0](pylint-dev/pylint@v2.14.5...v2.15.0) - [github.com/codespell-project/codespell: v2.1.0 → v2.2.1](codespell-project/codespell@v2.1.0...v2.2.1) * Introduce .codespell-ignore-lines for safer (line-based instead of word-based) suppressions. * Fix two issues: 1. ensure sort order; 2. remove duplicates Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
1 parent 283f10d commit 8756f16

File tree

3 files changed

+66
-5
lines changed

3 files changed

+66
-5
lines changed

.codespell-ignore-lines

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
2+
template <typename ThisT>
3+
auto &this_ = static_cast<ThisT &>(*this);
4+
if (load_impl<ThisT>(temp, false)) {
5+
ssize_t nd = 0;
6+
auto trivial = broadcast(buffers, nd, shape);
7+
auto ndim = (size_t) nd;
8+
int nd;
9+
ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
10+
using op = op_impl<id, ot, Base, L_type, R_type>;
11+
template <op_id id, op_type ot, typename L, typename R>
12+
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
13+
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
14+
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
15+
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
16+
struct IntStruct {
17+
explicit IntStruct(int v) : value(v){};
18+
~IntStruct() { value = -value; }
19+
IntStruct(const IntStruct &) = default;
20+
IntStruct &operator=(const IntStruct &) = default;
21+
py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
22+
py::implicitly_convertible<int, IntStruct>();
23+
m.def("test", [](int expected, const IntStruct &in) {
24+
[](int expected, const IntStruct &in) {

.pre-commit-config.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ repos:
6262

6363
# Changes tabs to spaces
6464
- repo: https://github.com/Lucas-C/pre-commit-hooks
65-
rev: "v1.3.0"
65+
rev: "v1.3.1"
6666
hooks:
6767
- id: remove-tabs
6868

6969
- repo: https://github.com/sirosen/texthooks
70-
rev: "0.3.1"
70+
rev: "0.4.0"
7171
hooks:
7272
- id: fix-ligatures
7373
- id: fix-smartquotes
@@ -110,7 +110,7 @@ repos:
110110

111111
# PyLint has native support - not always usable, but works for us
112112
- repo: https://github.com/PyCQA/pylint
113-
rev: "v2.14.5"
113+
rev: "v2.15.0"
114114
hooks:
115115
- id: pylint
116116
files: ^pybind11
@@ -143,12 +143,14 @@ repos:
143143
additional_dependencies: [cmake, ninja]
144144

145145
# Check for spelling
146+
# Use tools/codespell_ignore_lines_from_errors.py
147+
# to rebuild .codespell-ignore-lines
146148
- repo: https://github.com/codespell-project/codespell
147-
rev: "v2.1.0"
149+
rev: "v2.2.1"
148150
hooks:
149151
- id: codespell
150152
exclude: ".supp$"
151-
args: ["-L", "nd,ot,thist"]
153+
args: ["-x", ".codespell-ignore-lines"]
152154

153155
# Check for common shell mistakes
154156
- repo: https://github.com/shellcheck-py/shellcheck-py
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Simple script for rebuilding .codespell-ignore-lines
2+
3+
Usage:
4+
5+
cat < /dev/null > .codespell-ignore-lines
6+
pre-commit run --all-files codespell >& /tmp/codespell_errors.txt
7+
python3 tools/codespell_ignore_lines_from_errors.py /tmp/codespell_errors.txt > .codespell-ignore-lines
8+
9+
git diff to review changes, then commit, push.
10+
"""
11+
12+
import sys
13+
from typing import List
14+
15+
16+
def run(args: List[str]) -> None:
17+
assert len(args) == 1, "codespell_errors.txt"
18+
cache = {}
19+
done = set()
20+
for line in sorted(open(args[0]).read().splitlines()):
21+
i = line.find(" ==> ")
22+
if i > 0:
23+
flds = line[:i].split(":")
24+
if len(flds) >= 2:
25+
filename, line_num = flds[:2]
26+
if filename not in cache:
27+
cache[filename] = open(filename).read().splitlines()
28+
supp = cache[filename][int(line_num) - 1]
29+
if supp not in done:
30+
print(supp)
31+
done.add(supp)
32+
33+
34+
if __name__ == "__main__":
35+
run(args=sys.argv[1:])

0 commit comments

Comments
 (0)