def insert_new_blocks(self, new_blocks):

    # We could do a more efficient merge here since both lists
    # are already sorted, but these data structures are small, so let's
    # do the easy thing.
    blocks_dict = dict( (b.blockId, b) for b in self.blocks )

    # Merge in new data to dictionary
    for nb in new_blocks:
      blocks_dict[nb.blockId] = nb

    # Convert back to sorted list
    block_list = blocks_dict.values()
    block_list.sort(cmp=lambda a,b: cmp(a.startOffset, b.startOffset))

    # Update cache with new data
    self.blocks = block_list
Sum of absolute values of vector.
dataset/ETHPy150Open cloudera/hue/desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py/BlockCache.insert_new_blocks--crossover with--dataset/ETHPy150Open lebedov/scikit-cuda/skcuda/magma.py/magma_dzasum