Skip to content

Commit

Permalink
Merge pull request #383 from czyzykowski/patch-1
Browse files Browse the repository at this point in the history
Fix problem with treating ~ operator as binary.
  • Loading branch information
IanLee1521 committed Feb 24, 2016
2 parents 8664e18 + 18b12f0 commit 4fb305e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,13 +1017,14 @@ def break_around_binary_operator(logical_line, tokens):
Okay: x = '''\n''' + ''
Okay: foo(x,\n -y)
Okay: foo(x, # comment\n -y)
Okay: var = (1 &\n ~2)
"""
def is_binary_operator(token_type, text):
# The % character is strictly speaking a binary operator, but the
# common usage seems to be to put it next to the format parameters,
# after a line break.
return ((token_type == tokenize.OP or text in ['and', 'or']) and
text not in "()[]{},:.;@=%")
text not in "()[]{},:.;@=%~")

line_break = False
unary_context = True
Expand Down

0 comments on commit 4fb305e

Please sign in to comment.