Given two name histories (grouped by block), merge them.
541742
def name_history_merge(h1, h2):
    
    ret = {}
    blocks_1 = [int(b) for b in h1.keys()]
    blocks_2 = [int(b) for b in h2.keys()]

    # find overlapping blocks
    overlap = list(set(blocks_1).intersection(set(blocks_2)))
    if len(overlap) > 0:
        for b in overlap:
            h = h1[str(b)] + h2[str(b)]
            h.sort(lambda v1, v2: -1 if v1['vtxindex'] < v2['vtxindex'] else 1)
            
            uniq = []
            last_vtxindex = None
            for i in range(0, len(h)):
                if h[i]['vtxindex'] != last_vtxindex:
                    uniq.append(h[i])
                    last_vtxindex = h[i]['vtxindex']
                
            ret[str(b)] = uniq
    
    all_blocks = list(set(blocks_1 + blocks_2))
    for b in all_blocks:
        if b in overlap:
            continue

        if b in blocks_1:
            ret[str(b)] = h1[str(b)]
        else:
            ret[str(b)] = h2[str(b)]

    return ret
1000507
def merge (dst, src):
        """"""
        for key in src.keys():
                if key not in dst:
                        dst[key] = src[key]
4536
function mergeBlocks(blocks) {
  let finalBlock;
  for (const block of blocks) {
    if (!finalBlock) finalBlock = block;
    else {
      block.nodes.forEach(node => finalBlock.push(node));
    }
  }
  return finalBlock;
}
169318
def merge_vertices(self):
        """"""

        # groupby expects sorted data
        sorted_vertices = sorted(list(self.vertices.items()), key=lambda v: hash(v[1]))
        groups = []
        for k, g in groupby(sorted_vertices, lambda v: hash(v[1])):
            groups.append(list(g))
        for group in groups:
            if len(group) == 1:
                continue
            names = [v[0] for v in group]
            self.reduce_vertex(*names)
23955
def merge_dicts(dict_a, dict_b):
    """"""
    obj = {}
    for key, value in iteritems(dict_a):
        if key in dict_b:
            if isinstance(dict_b[key], dict):
                obj[key] = merge_dicts(value, dict_b.pop(key))
        else:
            obj[key] = value

    for key, value in iteritems(dict_b):
        obj[key] = value

    return obj
746093
def _join_names(names):
    """"""

    levels = (str(name) for name in names if name != '')
    return '_'.join(levels)
824562
def merge_conflicts(self):
        """"""
        filenames = set()
        listing = self.context.capture('git', 'ls-files', '--unmerged', '-z')
        for entry in split(listing, '\0'):
            # The output of `git ls-files --unmerged -z' consists of two
            # tab-delimited fields per zero-byte terminated record, where the
            # first field contains metadata and the second field contains the
            # filename. A single filename can be output more than once.
            metadata, _, name = entry.partition('\t')
            if metadata and name:
                filenames.add(name)
        return sorted(filenames)
1191625
def merge(self, other):
        
        
        for key in other.keys():
            if key not in self:
                # copies over both lower and higher dimensional data
                self[key] = other[key]
1107268
def merge_dicts(dict_a, dict_b):
    """"""
    duplicates = [val for val in dict_a if val in dict_b]
    if duplicates:
        _LOGGER.warning(("Duplicates found during merge: %s. "
                         "Renaming is recommended."), duplicates)
    return {**dict_a, **dict_b}
890188
def merge(self, other):
        """"""
        for key, value in other.items():
            if key in self and (isinstance(self[key], Compound)
                                and isinstance(value, dict)):
                self[key].merge(value)
            else:
                self[key] = value
295231
def merge(s, t):
    """"""

    for k, v in t.items():
        if isinstance(v, dict):
            if k not in s:
                s[k] = v
                continue

            s[k] = merge(s[k], v)
            continue

        s[k] = v

    return s
888106
def namedb_flatten_history( hist ):
    
    ret = []
    block_ids = sorted(hist.keys())
    for block_id in block_ids:
        vtxinfos = hist[block_id]
        for vtxinfo in vtxinfos:
            info = copy.deepcopy(vtxinfo)
            ret.append(info)

    return ret
937436
def _consolidate(blocks):
    

    # sort by _can_consolidate, dtype
    gkey = lambda x: x._consolidate_key
    grouper = itertools.groupby(sorted(blocks, key=gkey), gkey)

    new_blocks = []
    for (_can_consolidate, dtype), group_blocks in grouper:
        merged_blocks = _merge_blocks(list(group_blocks), dtype=dtype,
                                      _can_consolidate=_can_consolidate)
        new_blocks = _extend_blocks(merged_blocks, new_blocks)
    return new_blocks
1096164
def merge(*maps):
    """"""
    copies = map(deepcopy, maps)
    return reduce(lambda acc, val: acc.update(val) or acc, copies)
870045
void mergeContiguousRegions( Collection<AbstractBlock> blocks ) {

		AbstractIgnorableInstruction initialInstr = null;
		List<AbstractBlock> toRemove = new ArrayList<> ();
		StringBuilder sb = new StringBuilder();

		// We only merge comments and blank regions to reduce their number
		for( AbstractBlock block : blocks ) {
			if( initialInstr == null ) {

				if( block.getInstructionType() == AbstractBlock.COMMENT
						|| block.getInstructionType() == AbstractBlock.BLANK ) {

					AbstractIgnorableInstruction currentInstr = (AbstractIgnorableInstruction) block;
					initialInstr = currentInstr;
					sb = new StringBuilder( currentInstr.getContent());
				}

			} else if( initialInstr.getInstructionType() == block.getInstructionType()) {
				toRemove.add( block );
				sb.append( System.getProperty( "line.separator" ));
				sb.append(((AbstractIgnorableInstruction) block).getContent());

			} else {
				initialInstr.setContent( sb.toString());
				initialInstr = null;
			}
		}

		// Remove the blocks that have been merged
		blocks.removeAll( toRemove );

		// In a second time, we can reduce facets and components too
		for( AbstractBlock block : blocks ) {
			if( block.getInstructionType() == AbstractBlock.COMPONENT
					|| block.getInstructionType() == AbstractBlock.FACET )
				mergeContiguousRegions(((AbstractBlockHolder) block).getInnerBlocks());
		}
	}
1340778
def merge(database=None, directory=None, verbose=None):
    """"""
    router = get_router(directory, database, verbose)
    router.merge()
619822
def merge(self, other):
        
        Stats.merge(self, other)
        self.changes += other.changes