Skip to content

Commit

Permalink
Merge pull request #751 from hhatto/w504-position
Browse files Browse the repository at this point in the history
Change the position pointed out by W504
  • Loading branch information
sigmavirus24 committed May 19, 2018
2 parents f4f6e55 + 7ca10fe commit 0364618
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,15 +1279,16 @@ def break_after_binary_operator(logical_line, tokens):
Okay: var = (1 /\n -2)
Okay: var = (1 +\n -1 +\n -2)
"""
prev_start = None
for context in _break_around_binary_operators(tokens):
(token_type, text, previous_token_type, previous_text,
line_break, unary_context, start) = context
if (_is_binary_operator(previous_token_type, previous_text) and
line_break and
not unary_context and
not _is_binary_operator(token_type, text)):
error_pos = (start[0] - 1, start[1])
yield error_pos, "W504 line break after binary operator"
yield prev_start, "W504 line break after binary operator"
prev_start = start


@register_check
Expand Down

0 comments on commit 0364618

Please sign in to comment.