@@ -506,8 +506,9 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
506
506
yield start , "%s continuation line %s" % error
507
507
508
508
# look for visual indenting
509
- if (parens [row ] and token_type not in (tokenize .NL , tokenize .COMMENT )
510
- and not indent [depth ]):
509
+ if (parens [row ] and
510
+ token_type not in (tokenize .NL , tokenize .COMMENT ) and
511
+ not indent [depth ]):
511
512
indent [depth ] = start [1 ]
512
513
indent_chances [start [1 ]] = True
513
514
if verbose >= 4 :
@@ -943,8 +944,8 @@ def is_binary_operator(token_type, text):
943
944
# The % character is strictly speaking a binary operator, but the
944
945
# common usage seems to be to put it next to the format parameters,
945
946
# after a line break.
946
- return ((token_type == tokenize .OP or text == 'and' or text == 'or' )
947
- and text not in "()[]{},:.;@=%" )
947
+ return ((token_type == tokenize .OP or text in [ 'and' , 'or' ]) and
948
+ text not in "()[]{},:.;@=%" )
948
949
949
950
line_break = False
950
951
unary_context = True
@@ -954,8 +955,8 @@ def is_binary_operator(token_type, text):
954
955
if ('\n ' in text or '\r ' in text ) and token_type != tokenize .STRING :
955
956
line_break = True
956
957
else :
957
- if (is_binary_operator (token_type , text ) and line_break
958
- and not unary_context ):
958
+ if (is_binary_operator (token_type , text ) and line_break and
959
+ not unary_context ):
959
960
yield start , "W503 line break before binary operator"
960
961
unary_context = text in '([{,;'
961
962
line_break = False
@@ -1364,8 +1365,8 @@ def build_tokens_line(self):
1364
1365
(start_row , start_col ) = start
1365
1366
if prev_row != start_row : # different row
1366
1367
prev_text = self .lines [prev_row - 1 ][prev_col - 1 ]
1367
- if prev_text == ',' or (prev_text not in '{[('
1368
- and text not in '}])' ):
1368
+ if prev_text == ',' or (prev_text not in '{[(' and
1369
+ text not in '}])' ):
1369
1370
text = ' ' + text
1370
1371
elif prev_col != start_col : # different column
1371
1372
text = line [prev_col :start_col ] + text
0 commit comments