Skip to content

Commit 4fb305e

Browse files
committed
Merge pull request #383 from czyzykowski/patch-1
Fix problem with treating ~ operator as binary.
2 parents 8664e18 + 18b12f0 commit 4fb305e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pep8.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,13 +1017,14 @@ def break_around_binary_operator(logical_line, tokens):
10171017
Okay: x = '''\n''' + ''
10181018
Okay: foo(x,\n -y)
10191019
Okay: foo(x, # comment\n -y)
1020+
Okay: var = (1 &\n ~2)
10201021
"""
10211022
def is_binary_operator(token_type, text):
10221023
# The % character is strictly speaking a binary operator, but the
10231024
# common usage seems to be to put it next to the format parameters,
10241025
# after a line break.
10251026
return ((token_type == tokenize.OP or text in ['and', 'or']) and
1026-
text not in "()[]{},:.;@=%")
1027+
text not in "()[]{},:.;@=%~")
10271028

10281029
line_break = False
10291030
unary_context = True

0 commit comments

Comments
 (0)