Union multiple sorted sets specified by ``keys`` into
        a new sorted set, ``dest``. Scores in the destination will be
        aggregated based on the ``aggregate``, or SUM if none is provided.
193487
def zunionstore(self, dest, keys, aggregate=None):
        
        with self.pipe as pipe:
            keys = [self.redis_key(k) for k in keys]
            return pipe.zunionstore(self.redis_key(dest), keys,
                                    aggregate=aggregate)
1088530
function mergeKeys(currNodeKeys, currKeyIndex, nextNodeKeys, nextKeyIndex) {
  const allKeys = []

  for (let i = 0; i < nextNodeKeys.length; i++) {
    allKeys[i] = nextNodeKeys[i]
  }

  for (let i = 0; i < currNodeKeys.length; i++) {
    if (nextKeyIndex[currNodeKeys[i]] === undefined) {
      allKeys.push(currNodeKeys[i])
    }
  }

  return allKeys.sort((a, b) => {
    const nextOrderA = nextKeyIndex[a]
    const nextOrderB = nextKeyIndex[b]
    const currOrderA = currKeyIndex[a]
    const currOrderB = currKeyIndex[b]

    if (nextOrderA != null && nextOrderB != null) {
      return nextKeyIndex[a] - nextKeyIndex[b]
    } else if (currOrderA != null && currOrderB != null) {
      return currKeyIndex[a] - currKeyIndex[b]
    } else if (nextOrderA != null) {
      for (let i = 0; i < nextNodeKeys.length; i++) {
        const pivot = nextNodeKeys[i]

        if (!currKeyIndex[pivot]) {
          continue
        }

        if (
          nextOrderA < nextKeyIndex[pivot] &&
          currOrderB > currKeyIndex[pivot]
        ) {
          return -1
        } else if (
          nextOrderA > nextKeyIndex[pivot] &&
          currOrderB < currKeyIndex[pivot]
        ) {
          return 1
        }
      }

      return 1
    }

    for (let i = 0; i < nextNodeKeys.length; i++) {
      const pivot = nextNodeKeys[i]

      if (!currKeyIndex[pivot]) {
        continue
      }

      if (
        nextOrderB < nextKeyIndex[pivot] &&
        currOrderA > currKeyIndex[pivot]
      ) {
        return 1
      } else if (
        nextOrderB > nextKeyIndex[pivot] &&
        currOrderA < currKeyIndex[pivot]
      ) {
        return -1
      }
    }

    return -1
  })
}
1162071
function fromEntries(keys, values) {
  return keys.reduce((obj, key, i) => {
    obj[key] = values[i];
    return obj;
  }, {})
}
267085
def mget(self, keys, *args):
        
        keys = [self.redis_key(k) for k in self._parse_values(keys, args)]
        with self.pipe as pipe:
            f = Future()
            res = pipe.mget(keys)

            def cb():
                decode = self.valueparse.decode
                f.set([None if r is None else decode(r) for r in res.result])

            pipe.on_execute(cb)
            return f
463775
private function unionAggregate(array $sets, array $weights = null, string $aggregate = 'SUM'): int
    {
        return $this->handle->zUnion($this->name, $sets, $weights, $aggregate);
    }
59017
function slice(source, keys){
    var result = {};

    if (!keys)
      return extend(result, source);

    for (var i = 0, key; key = keys[i++];)
      if (key in source)
        result[key] = source[key];

    return result;
  }
772717
private Iterable<Key> getSplitKey(List<Key> keys, int numSplits) {
    // If the number of keys is less than the number of splits, we are limited in the number of
    // splits we can make.
    if (keys.size() < numSplits - 1) {
      return keys;
    }

    // Calculate the number of keys per split. This should be KEYS_PER_SPLIT, but may
    // be less if there are not KEYS_PER_SPLIT * (numSplits - 1) scatter entities.
    //
    // Consider the following dataset, where - represents an entity and * represents an entity
    // that is returned as a scatter entity:
    // ||---*-----*----*-----*-----*------*----*----||
    // If we want 4 splits in this data, the optimal split would look like:
    // ||---*-----*----*-----*-----*------*----*----||
    //            |          |            |
    // The scatter keys in the last region are not useful to us, so we never request them:
    // ||---*-----*----*-----*-----*------*---------||
    //            |          |            |
    // With 6 scatter keys we want to set scatter points at indexes: 1, 3, 5.
    //
    // We keep this as a double so that any "fractional" keys per split get distributed throughout
    // the splits and don't make the last split significantly larger than the rest.
    double numKeysPerSplit = Math.max(1.0, ((double) keys.size()) / (numSplits - 1));

    List<Key> keysList = new ArrayList<Key>(numSplits - 1);
    // Grab the last sample for each split, otherwise the first split will be too small.
    for (int i = 1; i < numSplits; i++) {
      int splitIndex = (int) Math.round(i * numKeysPerSplit) - 1;
      keysList.add(keys.get(splitIndex));
    }

    return keysList;
  }
1192021
private static Map<Symbol, Aggregation> outputsAsInputs(Map<Symbol, Aggregation> assignments)
    {
        ImmutableMap.Builder<Symbol, Aggregation> builder = ImmutableMap.builder();
        for (Map.Entry<Symbol, Aggregation> entry : assignments.entrySet()) {
            Symbol output = entry.getKey();
            Aggregation aggregation = entry.getValue();
            checkState(!aggregation.getCall().getOrderBy().isPresent(), "Intermediate aggregation does not support ORDER BY");
            builder.put(
                    output,
                    new Aggregation(
                            new FunctionCall(aggregation.getCall().getName(), ImmutableList.of(output.toSymbolReference())),
                            aggregation.getFunctionHandle(),
                            Optional.empty()));  // No mask for INTERMEDIATE
        }
        return builder.build();
    }
246588
function(stats) {
      var map = new Map();
      Object.keys(stats).forEach(function(key) {
        map.set(key, stats[key]);
        map[key] = stats[key];
      });
      return map;
    }
793357
def zinterstore(self, dest, keys, aggregate=None):
        
        return self._zaggregate('ZINTERSTORE', dest, keys, aggregate)
35024
def union(*argv):
        
        res = OrderedSet()
        for ods in argv:
            res = res | ods
        return res
1116129
def _fromset(cls, values, key=None):
        """"""
        sorted_set = object.__new__(cls)
        sorted_set._set = values  # pylint: disable=protected-access
        sorted_set.__init__(key=key)
        return sorted_set
299736
def mget(self, *keys):
        
        return list(map(
            self._loads, self._client.hmget(self.key_prefix, *keys)))
278606
def zunionstore(self, dest, keys, aggregate=None):
        
        return self._zaggregate('ZUNIONSTORE', dest, keys, aggregate)
1200469
def flatten (d, *keys):
    
    flat = { }

    for k in keys:
        flat = merge(flat, d.pop(k, { }))

    return flat
275048
def merge_dict(a, b):
    

    if not isinstance(b, dict):
        return b

    result = deepcopy(a)
    for key, val in six.iteritems(b):
        if key in result and isinstance(result[key], dict):
            result[key] = merge_dict(result[key], val)
        elif key in result and isinstance(result[key], list):
            result[key] = sorted(list(set(val) | set(result[key])))
        else:
            result[key] = deepcopy(val)

    return result
415260
def dict_union_combine(dict1, dict2, combine_op=op.add,
                       default=util_const.NoParam,
                       default2=util_const.NoParam):
    
    keys3 = set(dict1.keys()).union(set(dict2.keys()))
    if default is util_const.NoParam:
        dict3 = {key: combine_op(dict1[key], dict2[key]) for key in keys3}
    else:
        if default2 is util_const.NoParam:
            default2 = default
        dict3 = {key: combine_op(dict1.get(key, default), dict2.get(key, default2))
                 for key in keys3}
    return dict3