#NEWLINE# def explicit_line_join( logical_line , tokens ) : #NEWLINE# #INDENT# '\n    Avoid explicit line join between brackets.\n\n    The preferred way of wrapping long lines is by using Python\'s implied line\n    continuation inside parentheses, brackets and braces.  Long lines can be\n    broken over multiple lines by wrapping expressions in parentheses.  These\n    should be used in preference to using a backslash for line continuation.\n\n    E502: aaa = [123, \\\\n       123]\n    E502: aaa = ("bbb " \\\\n       "ccc")\n\n    Okay: aaa = [123,\\n       123]\n    Okay: aaa = ("bbb "\\n       "ccc")\n    Okay: aaa = "bbb " \\\\n    "ccc"\n    ' #NEWLINE# prev_start = prev_end = parens = 0 #NEWLINE# for ( token_type , text , start , end , line ) in tokens : #NEWLINE# #INDENT# if ( ( start [ 0 ] != prev_start ) and parens and start ) : #NEWLINE# #INDENT# ( yield ( backslash , 'E502 the backslash is redundant between brackets' ) ) #NEWLINE# #UNINDENT# if ( end [ 0 ] != prev_end ) : #NEWLINE# #INDENT# if line . rstrip ( '\r\n' ) . endswith ( '\\' ) : #NEWLINE# #INDENT# backslash = ( end [ 0 ] , ( len ( line . splitlines ( ) [ ( - 1 ) ] ) - 1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# backslash = None #NEWLINE# #UNINDENT# prev_start = prev_end = end [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# prev_start = start [ 0 ] #NEWLINE# #UNINDENT# if ( token_type == tokenize . OP ) : #NEWLINE# #INDENT# if ( text in '([{' ) : #NEWLINE# #INDENT# parens += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( text in ')]}' ) : #NEWLINE# #INDENT# parens -= 1