summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Allgaier <mail@spacegaier.de>2022-04-02 21:55:38 +0200
committerGitHub <noreply@github.com>2022-04-02 21:55:38 +0200
commit402da7c8785c41db875c5eaaa13c89a98ae42d65 (patch)
treeadd2b1c6e0975e269c2e89ff522f0ae9ab62d42d
parente6bd67b064592ba671780e7069a279f6df89e206 (diff)
downloadvoluptuous-402da7c8785c41db875c5eaaa13c89a98ae42d65.tar.gz
Convert codebase to adhere to flake8 W504 (PEP 8) (#462)
-rw-r--r--tox.ini4
-rw-r--r--voluptuous/schema_builder.py11
-rw-r--r--voluptuous/tests/tests.py12
-rw-r--r--voluptuous/validators.py8
4 files changed, 18 insertions, 17 deletions
diff --git a/tox.ini b/tox.ini
index ec13834..bcd52cb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,8 +3,8 @@ envlist = flake8,py27,py36,py37,py38,py39
[flake8]
; E501: line too long (X > 79 characters)
-; W504 line break after binary operator
-ignore = E501,W504
+; W503 line break before binary operator
+ignore = E501,W503
exclude = .tox,.venv,build,*.egg
[testenv]
diff --git a/voluptuous/schema_builder.py b/voluptuous/schema_builder.py
index df19c8d..d308bd3 100644
--- a/voluptuous/schema_builder.py
+++ b/voluptuous/schema_builder.py
@@ -308,14 +308,15 @@ class Schema(object):
# Keys that may be required
all_required_keys = set(key for key in schema
- if key is not Extra and
- ((self.required and not isinstance(key, (Optional, Remove))) or
- isinstance(key, Required)))
+ if key is not Extra
+ and ((self.required
+ and not isinstance(key, (Optional, Remove)))
+ or isinstance(key, Required)))
# Keys that may have defaults
all_default_keys = set(key for key in schema
- if isinstance(key, Required) or
- isinstance(key, Optional))
+ if isinstance(key, Required)
+ or isinstance(key, Optional))
_compiled_schema = {}
for skey, svalue in iteritems(schema):
diff --git a/voluptuous/tests/tests.py b/voluptuous/tests/tests.py
index c9d2b93..577732b 100644
--- a/voluptuous/tests/tests.py
+++ b/voluptuous/tests/tests.py
@@ -497,8 +497,8 @@ def test_inequality():
def test_inequality_negative():
assert_false(Schema('foo') != Schema('foo'))
- assert_false(Schema(['foo', 'bar', 'baz']) !=
- Schema(['foo', 'bar', 'baz']))
+ assert_false(Schema(['foo', 'bar', 'baz'])
+ != Schema(['foo', 'bar', 'baz']))
# Ensure two Schemas w/ two equivalent dicts initialized in a different
# order are considered equal.
@@ -1305,8 +1305,8 @@ def test_any_error_has_path():
s({'q': 'str', 'q2': 'tata'})
except MultipleInvalid as exc:
assert (
- (exc.errors[0].path == ['q'] and exc.errors[1].path == ['q2']) or
- (exc.errors[1].path == ['q'] and exc.errors[0].path == ['q2'])
+ (exc.errors[0].path == ['q'] and exc.errors[1].path == ['q2'])
+ or (exc.errors[1].path == ['q'] and exc.errors[0].path == ['q2'])
)
else:
assert False, "Did not raise AnyInvalid"
@@ -1322,8 +1322,8 @@ def test_all_error_has_path():
s({'q': 'str', 'q2': 12})
except MultipleInvalid as exc:
assert (
- (exc.errors[0].path == ['q'] and exc.errors[1].path == ['q2']) or
- (exc.errors[1].path == ['q'] and exc.errors[0].path == ['q2'])
+ (exc.errors[0].path == ['q'] and exc.errors[1].path == ['q2'])
+ or (exc.errors[1].path == ['q'] and exc.errors[0].path == ['q2'])
)
else:
assert False, "Did not raise AllInvalid"
diff --git a/voluptuous/validators.py b/voluptuous/validators.py
index d0f1c43..9019f1f 100644
--- a/voluptuous/validators.py
+++ b/voluptuous/validators.py
@@ -751,8 +751,8 @@ class In(object):
except TypeError:
check = True
if check:
- raise InInvalid(self.msg or
- 'value must be one of {}'.format(sorted(self.container)))
+ raise InInvalid(self.msg
+ or 'value must be one of {}'.format(sorted(self.container)))
return v
def __repr__(self):
@@ -772,8 +772,8 @@ class NotIn(object):
except TypeError:
check = True
if check:
- raise NotInInvalid(self.msg or
- 'value must not be one of {}'.format(sorted(self.container)))
+ raise NotInInvalid(self.msg
+ or 'value must not be one of {}'.format(sorted(self.container)))
return v
def __repr__(self):