Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert codebase to adhere to flake8 W504 (PEP 8) #462

Merged
merged 1 commit into from Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tox.ini
Expand Up @@ -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]
Expand Down
11 changes: 6 additions & 5 deletions voluptuous/schema_builder.py
Expand Up @@ -308,14 +308,15 @@ def _compile_mapping(self, schema, invalid_msg=None):

# 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):
Expand Down
12 changes: 6 additions & 6 deletions voluptuous/tests/tests.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions voluptuous/validators.py
Expand Up @@ -751,8 +751,8 @@ def __call__(self, v):
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):
Expand All @@ -772,8 +772,8 @@ def __call__(self, v):
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):
Expand Down