@staticmethod
    def _add_one_address(cidr_array, address):
        full_mask = 0xffffffff
        position = None

        for index in range(len(cidr_array)):
            cidr_item = cidr_array[index]
            temp_min = cidr_item["prefix"]
            temp_max = temp_min + (cidr_item["mask"] - full_mask)
            if temp_max >= address:
                if temp_min <= address:
                    return cidr_array, [], []
                position = index
                break

        if position is None:
            left_array = list(cidr_array)
            right_array = []
        else:
            left_array = cidr_array[:position]
            right_array = cidr_array[position:]

        added_cidr = []
        removed_cidr = []
        new_cidr_array = []

        current_prefix = address
        current_mask = full_mask
        continue_flag = True
        while continue_flag:
            continue_flag = False

            if len(left_array) != 0:
                left_item = left_array.pop(-1)
                new_mask = SGApp._try_merge_cidr(current_prefix, current_mask,
                                                 left_item, full_mask)
                if new_mask:
                    current_prefix &= new_mask
                    current_mask = new_mask
                    removed_cidr.append(left_item)
                    continue_flag = True
                    continue
                else:
                    left_array.append(left_item)
            if len(right_array) != 0:
                right_item = right_array.pop(0)
                new_mask = SGApp._try_merge_cidr(current_prefix, current_mask,
                                                 right_item, full_mask)
                if new_mask:
                    current_prefix &= new_mask
                    current_mask = new_mask
                    removed_cidr.append(right_item)
                    continue_flag = True
                    continue
                else:
                    right_array.insert(0, right_item)

        added_cidr.append({"prefix": current_prefix, "mask": current_mask})
        new_cidr_array.extend(left_array)
        new_cidr_array.extend(added_cidr)
        new_cidr_array.extend(right_array)

        return new_cidr_array, added_cidr, removed_cidr
dataset/ETHPy150Open openstack/dragonflow/dragonflow/controller/sg_app.py/SGApp._add_one_address/swapped operands of `-`