def fix_e225(self, result):
        """Fix missing whitespace around operator."""
        target = self.source[result['line'] - 1]
        offset = result['column'] - 1
        fixed = target[:offset] + ' ' + target[offset:]

        # Only proceed if non-whitespace characters match.
        # And make sure we don't break the indentation.
        if (
            fixed.replace(' ', '') == target.replace(' ', '') and
            _get_indentation(fixed) == _get_indentation(target)
        ):
            self.source[result['line'] - 1] = fixed
            error_code = result.get('id', 0)
            try:
                ts = generate_tokens(fixed)
            except (SyntaxError, tokenize.TokenError):
                return
            if not check_syntax(fixed.lstrip()):
                return
            errors = list(
                pycodestyle.missing_whitespace_around_operator(fixed, ts))
            for e in reversed(errors):
                if error_code != e[1].split()[0]:
                    continue
                offset = e[0][1]
                fixed = fixed[:offset] + ' ' + fixed[offset:]
            self.source[result['line'] - 1] = fixed
        else:
            return []
def fix_e225 ( self , result ) : target = self . source [ result [ 'line' ] - 1 ] offset = result [ 'column' ] - 1 fixed = target [ : offset ] + ' ' + target [ offset : ] if ( fixed . replace ( ' ' , '' ) == target . replace ( ' ' , '' ) and _get_indentation ( fixed ) == _get_indentation ( target ) ) : self . source [ result [ 'line' ] - 1 ] = fixed error_code = result . get ( 'id' , 0 ) try : ts = generate_tokens ( fixed ) except ( SyntaxError , tokenize . TokenError ) : return if not check_syntax ( fixed . lstrip ( ) ) : return errors = list ( pycodestyle . missing_whitespace_around_operator ( fixed , ts ) ) for e in reversed ( errors ) : if error_code != e [ 1 ] . split ( ) [ 0 ] : continue offset = e [ 0 ] [ 1 ] fixed = fixed [ : offset ] + ' ' + fixed [ offset : ] self . source [ result [ 'line' ] - 1 ] = fixed else : return [ ]
Fix missing whitespace around operator.