Skip to content

Commit 0eb0fde

Browse files
author
Scott Sanderson
committed
BLD: Add pre-commit.
1 parent 3b83d78 commit 0eb0fde

File tree

7 files changed

+41
-7
lines changed

7 files changed

+41
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ MANIFEST
6363

6464
# pytest
6565
.cache
66+
.pytest_cache

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
default_language_version:
2+
python: python3.6
3+
4+
repos:
5+
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v2.1.0
8+
hooks:
9+
- id: check-merge-conflict
10+
- id: check-yaml
11+
args: [--allow-multiple-documents]
12+
- id: check-symlinks
13+
- id: end-of-file-fixer
14+
- id: trailing-whitespace
15+
16+
- repo: https://gitlab.com/pycqa/flake8
17+
rev: 3.7.7
18+
hooks:
19+
- id: flake8

interface/compat.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,17 @@ class metaclass(meta):
7070
def __new__(cls, name, this_bases, d):
7171
return meta(name, bases, d)
7272
return type.__new__(metaclass, 'temporary_class', (), {})
73+
74+
75+
__all__ = [
76+
'PY2',
77+
'PY3',
78+
'Parameter',
79+
'raise_from',
80+
'signature',
81+
'unwrap',
82+
'viewkeys',
83+
'with_metaclass',
84+
'wraps',
85+
'zip_longest',
86+
]

interface/tests/test_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class I(Interface):
298298

299299
def test_reject_non_callable_interface_field():
300300

301-
with pytest.raises(TypeError) as e:
301+
with pytest.raises(TypeError):
302302
class IFace(Interface):
303303
x = "not allowed"
304304

interface/tests/test_typecheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ def test_first_argument_name():
7979

8080

8181
if PY3: # pragma: nocover
82-
from ._py3_typecheck_tests import *
82+
from ._py3_typecheck_tests import * # noqa

interface/typecheck.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def params_compatible(impl, iface):
7575
return has_default(impl)
7676

7777
return (
78-
impl.name == iface.name and
79-
impl.kind == iface.kind and
80-
has_default(impl) == has_default(iface) and
81-
annotations_compatible(impl, iface)
78+
impl.name == iface.name
79+
and impl.kind == iface.kind
80+
and has_default(impl) == has_default(iface)
81+
and annotations_compatible(impl, iface)
8282
)
8383

8484

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ max-line-length = 90
77

88
[flake8]
99
max_line_length = 90
10-
ignore=F811,E741
10+
ignore=F811,E741,W503,E742
1111

1212
[testenv]
1313
commands=

0 commit comments

Comments
 (0)