(self, result, logical)
return [line_index + 1]
Put semicolon-separated compound statement on separate lines.
Put semicolon-separated compound statement on separate lines.
Put semicolon - separated compound statement on separate lines .
def fix_e702(self, result, logical):
        """Put semicolon-separated compound statement on separate lines."""
        if not logical:
            return []  # pragma: no cover
        logical_lines = logical[2]

        line_index = result['line'] - 1
        target = self.source[line_index]

        if target.rstrip().endswith('\\'):
            # Normalize '1; \\\n2' into '1; 2'.
            self.source[line_index] = target.rstrip('\n \r\t\\')
            self.source[line_index + 1] = self.source[line_index + 1].lstrip()
            return [line_index + 1, line_index + 2]

        if target.rstrip().endswith(';'):
            self.source[line_index] = target.rstrip('\n \r\t;') + '\n'
            return [line_index + 1]

        offset = result['column'] - 1
        first = target[:offset].rstrip(';').rstrip()
        second = (_get_indentation(logical_lines[0]) +
                  target[offset:].lstrip(';').lstrip())

        # Find inline comment.
        inline_comment = None
        if target[offset:].lstrip(';').lstrip()[:2] == '# ':
            inline_comment = target[offset:].lstrip(';')

        if inline_comment:
            self.source[line_index] = first + inline_comment
        else:
            self.source[line_index] = first + '\n' + second
        return [line_index + 1]
def fix_e702 ( self , result , logical ) : if not logical : return [ ] # pragma: no cover logical_lines = logical [ 2 ] line_index = result [ 'line' ] - 1 target = self . source [ line_index ] if target . rstrip ( ) . endswith ( '\\' ) : # Normalize '1; \\\n2' into '1; 2'. self . source [ line_index ] = target . rstrip ( '\n \r\t\\' ) self . source [ line_index + 1 ] = self . source [ line_index + 1 ] . lstrip ( ) return [ line_index + 1 , line_index + 2 ] if target . rstrip ( ) . endswith ( ';' ) : self . source [ line_index ] = target . rstrip ( '\n \r\t;' ) + '\n' return [ line_index + 1 ] offset = result [ 'column' ] - 1 first = target [ : offset ] . rstrip ( ';' ) . rstrip ( ) second = ( _get_indentation ( logical_lines [ 0 ] ) + target [ offset : ] . lstrip ( ';' ) . lstrip ( ) ) # Find inline comment. inline_comment = None if target [ offset : ] . lstrip ( ';' ) . lstrip ( ) [ : 2 ] == '# ' : inline_comment = target [ offset : ] . lstrip ( ';' ) if inline_comment : self . source [ line_index ] = first + inline_comment else : self . source [ line_index ] = first + '\n' + second return [ line_index + 1 ]