Skip to content

Commit 4490525

Browse files
Add pre-commit hooks for autofixing trailing whitespace (#15237)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 2df6f36 commit 4490525

32 files changed

+31
-30
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Adopt black and isort
2-
97c5ee99bc98dc475512e549b252b23a6e7e0997
2+
97c5ee99bc98dc475512e549b252b23a6e7e0997

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
exclude: '^(mypyc/external/)|(mypy/typeshed/)' # Exclude all vendored code from lints
12
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.4.0 # must match test-requirements.txt
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
28
- repo: https://github.com/psf/black
39
rev: 23.3.0 # must match test-requirements.txt
410
hooks:

mypyc/lib-rt/bytes_ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "CPy.h"
77

88
// Returns -1 on error, 0 on inequality, 1 on equality.
9-
//
9+
//
1010
// Falls back to PyObject_RichCompareBool.
1111
int CPyBytes_Compare(PyObject *left, PyObject *right) {
1212
if (PyBytes_CheckExact(left) && PyBytes_CheckExact(right)) {

mypyc/test-data/irbuild-dict.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,4 +583,3 @@ L2:
583583
L3:
584584
r7 = box(None, 1)
585585
return r7
586-

mypyc/test-data/irbuild-nested.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,4 +859,3 @@ L2:
859859
r2 = baz(r1)
860860
r3 = CPyTagged_Add(n, r2)
861861
return r3
862-

mypyc/test-data/irbuild-set.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,4 +836,3 @@ L4:
836836
r11 = CPy_NoErrOccured()
837837
L5:
838838
return 1
839-

mypyc/test-data/irbuild-strip-asserts.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ L0:
1010
r0 = object 3
1111
x = r0
1212
return x
13-

mypyc/test-data/run-bools.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,4 @@ def test_mixed_comparisons_i64() -> None:
226226
y = False
227227
print((y or 0) and True)
228228
[out]
229-
0
229+
0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bar_var: str
1+
bar_var: str
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bar_var = "bar"
1+
bar_var = "bar"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a_var = "a"
1+
a_var = "a"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c_var = "c"
1+
c_var = "c"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a_var = "a"
1+
a_var = "a"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c_var = "c"
1+
c_var = "c"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pkg_typed_var = "pkg_typed"
1+
pkg_typed_var = "pkg_typed"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a_var = "a"
1+
a_var = "a"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b_var = "b"
1+
b_var = "b"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c_var = "c"
1+
c_var = "c"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pkg_untyped_var = "pkg_untyped"
1+
pkg_untyped_var = "pkg_untyped"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a_var = "a"
1+
a_var = "a"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b_var = "b"
1+
b_var = "b"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c_var = "c"
1+
c_var = "c"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
standalone_var = "standalone"
1+
standalone_var = "standalone"

test-data/pybind11_mypy_demo/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ requires = [
77
"pybind11==2.9.2",
88
]
99

10-
build-backend = "setuptools.build_meta"
10+
build-backend = "setuptools.build_meta"

test-data/pybind11_mypy_demo/src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ void bind_basics(py::module& basics) {
167167
PYBIND11_MODULE(pybind11_mypy_demo, m) {
168168
auto basics = m.def_submodule("basics");
169169
bind_basics(basics);
170-
}
170+
}

test-data/unit/check-assert-type-fail.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ class array:
2525
i = 1
2626
def f(si: arr.array[int]):
2727
typing.assert_type(si, int) # E: Expression is of type "array[int]", not "int"
28-
[builtins fixtures/tuple.pyi]
28+
[builtins fixtures/tuple.pyi]

test-data/unit/check-python39.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ a = b = c = [1, 2, 3]
2525
for x in *a, *b, *c:
2626
reveal_type(x) # N: Revealed type is "builtins.int"
2727
[builtins fixtures/tuple.pyi]
28-

test-data/unit/check-singledispatch.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def g(arg: int) -> None:
7171
from functools import singledispatch
7272

7373
@singledispatch
74-
def f(arg) -> None:
74+
def f(arg) -> None:
7575
pass
7676

7777
@f.register(str)

test-data/unit/envvars.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ BAR = 0 # type: int
88
[file subdir/mypy.ini]
99
\[mypy]
1010
files=$MYPY_CONFIG_FILE_DIR/good.py
11-

test-data/unit/pep561.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ from typedpkg_ns.a.bbb import bf
222222
-- dummy should trigger a second iteration
223223
[file dummy.py.2]
224224
[out]
225-
[out2]
225+
[out2]

test-data/unit/plugins/fully_qualified_test_hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def get_method_signature_hook(self, fullname):
66
if 'FullyQualifiedTest' in fullname:
77
assert fullname.startswith('__main__.') and not ' of ' in fullname, fullname
88
return my_hook
9-
9+
1010
return None
1111

1212
def my_hook(ctx: MethodSigContext) -> CallableType:

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ flake8-noqa==1.3.1; python_version >= "3.8" # must match version in .pre-co
99
isort[colors]==5.12.0; python_version >= "3.8" # must match version in .pre-commit-config.yaml
1010
lxml>=4.9.1; (python_version<'3.11' or sys_platform!='win32') and python_version<'3.12'
1111
pre-commit
12+
pre-commit-hooks==4.4.0
1213
psutil>=4.0
1314
# pytest 6.2.3 does not support Python 3.10
1415
pytest>=6.2.4

0 commit comments

Comments
 (0)