(self, result)
Fix comparison with None.
Fix comparison with None.
Fix comparison with None .
def fix_e711(self, result):
        """Fix comparison with None."""
        (line_index, offset, target) = get_index_offset_contents(result,
                                                                 self.source)

        right_offset = offset + 2
        if right_offset >= len(target):
            return []

        left = target[:offset].rstrip()
        center = target[offset:right_offset]
        right = target[right_offset:].lstrip()

        if not right.startswith('None'):
            return []

        if center.strip() == '==':
            new_center = 'is'
        elif center.strip() == '!=':
            new_center = 'is not'
        else:
            return []

        self.source[line_index] = ' '.join([left, new_center, right])
def fix_e711 ( self , result ) : ( line_index , offset , target ) = get_index_offset_contents ( result , self . source ) right_offset = offset + 2 if right_offset >= len ( target ) : return [ ] left = target [ : offset ] . rstrip ( ) center = target [ offset : right_offset ] right = target [ right_offset : ] . lstrip ( ) if not right . startswith ( 'None' ) : return [ ] if center . strip ( ) == '==' : new_center = 'is' elif center . strip ( ) == '!=' : new_center = 'is not' else : return [ ] self . source [ line_index ] = ' ' . join ( [ left , new_center , right ] )