Merge (K,V) pair by mergeCombiner
177534
def mergeCombiners(self, iterator, limit=None):
        
        if limit is None:
            limit = self.memory_limit
        # speedup attribute lookup
        comb, hfun, objsize = self.agg.mergeCombiners, self._partition, self._object_size
        c, data, pdata, batch = 0, self.data, self.pdata, self.batch
        for k, v in iterator:
            d = pdata[hfun(k)] if pdata else data
            d[k] = comb(d[k], v) if k in d else v
            if not limit:
                continue

            c += objsize(v)
            if c > batch:
                if get_used_memory() > limit:
                    self._spill()
                    limit = self._next_limit()
                    batch /= 2
                    c = 0
                else:
                    batch *= 1.5

        if limit and get_used_memory() >= limit:
            self._spill()
968930
function merge (target, src) {
        var dst = {};

        if (target && typeof target === 'object') {
            Object.keys(target).forEach(function (key) {
                dst[key] = target[key];
            });
        }
        Object.keys(src).forEach(function (key) {
            if (typeof src[key] !== 'object' || !src[key]) {
                dst[key] = src[key];
            } else {
                if (!target[key]) {
                    dst[key] = src[key];
                } else {
                    dst[key] = merge(target[key], src[key]);
                }
            }
        });

        return dst;
    }
1173837
def _deep_merge_dict(a, b):
    """"""
    for k, v in b.items():
        if k in a and isinstance(a[k], dict) and isinstance(v, dict):
            _deep_merge_dict(a[k], v)
        else:
            a[k] = v
424597
def combine(items, k=None):
    
    length_items = len(items)
    lengths = [len(i) for i in items]
    length = reduce(lambda x, y: x * y, lengths)
    repeats = [reduce(lambda x, y: x * y, lengths[i:])
               for i in range(1, length_items)] + [1]
    if k is not None:
        k = k % length
        # Python division by default is integer division (~ floor(a/b))
        indices = [old_div((k % (lengths[i] * repeats[i])), repeats[i])
                   for i in range(length_items)]
        return [items[i][indices[i]] for i in range(length_items)]
    else:
        matrix = []
        for i, item in enumerate(items):
            row = []
            for subset in item:
                row.extend([subset] * repeats[i])
            times = old_div(length, len(row))
            matrix.append(row * times)
        # Transpose the matrix or return the columns instead rows
        return list(zip(*matrix))
1284333
function linComb_(x, y, a, b) {
  var i, c, k, kk;
  k=x.length<y.length ? x.length : y.length;
  kk=x.length;
  for (c=0, i=0; i<k; i++) {
    c+=a*x[i]+b*y[i];
    x[i]=c & mask;
    c>>=bpe;
  }
  for (i=k; i<kk; i++) {
    c+=a*x[i];
    x[i]=c & mask;
    c>>=bpe;
  }
}
996355
private int merge(String[] dst, String[] srcA, int lengthA, Tag[] srcB, int lengthB) {
    int i = 0;
    int ai = 0;
    int bi = 0;

    while (ai < lengthA && bi < lengthB) {
      final String ak = srcA[ai];
      final String av = srcA[ai + 1];
      Tag b = srcB[bi];
      int cmp = ak.compareTo(b.key());
      if (cmp < 0) {
        dst[i++] = ak;
        dst[i++] = av;
        ai += 2;
      } else if (cmp > 0) {
        dst[i++] = b.key();
        dst[i++] = b.value();
        ++bi;
      } else {
        // Newer tags should override, use source B if there are duplicate keys.
        // If source B has duplicates, then use the last value for the given key.
        int j = bi + 1;
        for (; j < lengthB && ak.equals(srcB[j].key()); ++j) {
          b = srcB[j];
        }
        dst[i++] = b.key();
        dst[i++] = b.value();
        bi = j;
        ai += 2; // Ignore
      }
    }

    if (ai < lengthA) {
      System.arraycopy(srcA, ai, dst, i, lengthA - ai);
      i += lengthA - ai;
    } else if (bi < lengthB) {
      i = dedup(srcB, bi, dst, i, lengthB - bi);
    }

    return i;
  }
139858
function merge( to ){
	var from,
		i, c,
		m = function( val, key ){
			to[ key ] = merge( to[key], val );
		};

	for( i = 1, c = arguments.length; i < c; i++ ){
		from = arguments[i];

		if ( to === from ){
			continue;
		}else if ( to && to.merge ){
			to.merge( from );
		}else if ( !bmoor.isObject(from) ){
			to = from;
		}else if ( !bmoor.isObject(to) ){
			to = merge( {}, from );
		}else{
			bmoor.safe( from, m );
		}
	}
	
	return to;
}
1110458
function _merge (getKeys, a, b) {
    return reduce([a, b], function (result, source) {
        forEach(getKeys(source), function (key) {
            result[key] = source[key];
        });

        return result;
    }, {});
}
818256
private void merge(Map<String, NodeT> source, Map<String, NodeT> target) {
        for (Map.Entry<String, NodeT> entry : source.entrySet()) {
            String key = entry.getKey();
            if (!target.containsKey(key)) {
                target.put(key, entry.getValue());
            }
        }
    }
370644
def _union(d1,d2):
    '''
        
    '''
    u = {}
    ds = _diff_internal(d1,d2)
    for key in ds['same']:
        u[key] = d1[key]
    for key in ds['vdiff']:
        u[key] = d1[key]
    for key in ds['kdiff']:
        u[key] = d1[key]
    ds = _diff_internal(d2,d1)
    for key in ds['kdiff']:
        u[key] = d2[key]
    return(u)
607881
def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):
    '''
    
    '''
    return salt.utils.dictupdate.merge(obj_a, obj_b, strategy, renderer,
            merge_lists)
1096164
def merge(*maps):
    """"""
    copies = map(deepcopy, maps)
    return reduce(lambda acc, val: acc.update(val) or acc, copies)
1179567
private SortedSet<String> mergeSets(SortedSet<String> primary, Set<String> secondary) {
    SortedSet<String> result = primary;
    if (!secondary.isEmpty()) {
      result = new TreeSet<>();
      result.addAll(primary);
      result.addAll(secondary);
    }
    return result;
  }
822174
def merge_recursive(obj_a, obj_b, level=False):
    '''
    
    '''
    return aggregate(obj_a, obj_b, level,
                     map_class=AggregatedMap,
                     sequence_class=AggregatedSequence)
423269
def replace_combiner(value, mutator, *args, **kwargs):
    
    args = list(args) + [value]
    return mutator(*args, **kwargs)
172730
def merge!(rh)
      rh.each_pair do |k, v|
        # v is a TimeCollector
        if self.has_key?(k)
          self[k].merge!(v)
        else
          self[k] = v
        end
      end
    end
27674
private Collection<Tuple> getCombinedTuples( List<VarDef> combinedVars, Collection<Tuple> tuples)
    {
    // Apply any once-only constraints.
    Set<Tuple> onceTuples = getOnceTupleDefs( combinedVars);
    if( !onceTuples.isEmpty())
      {
      for( Tuple tuple : tuples)
        {
        tuple.setOnce( onceTuples.contains( tuple));
        }
      }
    
    return tuples;
    }