@@ -506,8 +506,9 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing,
506506 yield start , "%s continuation line %s" % error
507507
508508 # 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 ]):
511512 indent [depth ] = start [1 ]
512513 indent_chances [start [1 ]] = True
513514 if verbose >= 4 :
@@ -943,8 +944,8 @@ def is_binary_operator(token_type, text):
943944 # The % character is strictly speaking a binary operator, but the
944945 # common usage seems to be to put it next to the format parameters,
945946 # 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 "()[]{},:.;@=%" )
948949
949950 line_break = False
950951 unary_context = True
@@ -954,8 +955,8 @@ def is_binary_operator(token_type, text):
954955 if ('\n ' in text or '\r ' in text ) and token_type != tokenize .STRING :
955956 line_break = True
956957 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 ):
959960 yield start , "W503 line break before binary operator"
960961 unary_context = text in '([{,;'
961962 line_break = False
@@ -1364,8 +1365,8 @@ def build_tokens_line(self):
13641365 (start_row , start_col ) = start
13651366 if prev_row != start_row : # different row
13661367 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 '}])' ):
13691370 text = ' ' + text
13701371 elif prev_col != start_col : # different column
13711372 text = line [prev_col :start_col ] + text
0 commit comments