def break_around_binary_operator(logical_line, tokens):
def is_binary_operator(token_type, text):<EOL><INDENT>return ((token_type == tokenize.OP or text in ['<STR_LIT>', '<STR_LIT>']) and<EOL>text not in "<STR_LIT>")<EOL><DEDENT>line_break = False<EOL>unary_context = True<EOL>for token_type, text, start, end, line in tokens:<EOL><INDENT>if token_type == tokenize.COMMENT:<EOL><INDENT>continue<EOL><DEDENT>if ('<STR_LIT:\n>' in text or '<STR_LIT:\r>' in text) and token_type != tokenize.STRING:<EOL><INDENT>line_break = True<EOL><DEDENT>else:<EOL><INDENT>if (is_binary_operator(token_type, text) and line_break and<EOL>not unary_context):<EOL><INDENT>yield start, "<STR_LIT>"<EOL><DEDENT>unary_context = text in '<STR_LIT>'<EOL>line_break = False<EOL><DEDENT><DEDENT>
r"""
    Avoid breaks before binary operators.

    The preferred place to break around a binary operator is after the
    operator, not before it.

    W503: (width == 0\n + height == 0)
    W503: (width == 0\n and height == 0)

    Okay: (width == 0 +\n height == 0)
    Okay: foo(\n    -x)
    Okay: foo(x\n    [])
    Okay: x = '''\n''' + ''
    Okay: foo(x,\n    -y)
    Okay: foo(x,  # comment\n    -y)