Convert a mapping object (such as a dictionary) to tuple pairs,
        using its keys and values to generate the pairs and then generating
        all possible combinations between those
        e.g. {1: (1,2,3)} -> (((1, 1),), ((1, 2),), ((1, 3),))
766154
def _mapping_to_tuple_pairs(d):
    
    # order the keys, this will prevent different implementations of Python,
    # return different results from the same dictionary since the order of
    # iteration depends on it
    t = []
    ord_keys = sorted(d.keys())
    for k in ord_keys:
        t.append(_product(k, d[k]))
    return tuple(product(*t))
1097529
public static <K, V> Map<K, V> zipMap(Iterable<K> keys, Iterable<V> values) {
    Map<K, V> retVal = new LinkedHashMap<>();

    Iterator<K> keysIter = keys.iterator();
    Iterator<V> valsIter = values.iterator();

    while (keysIter.hasNext()) {
      final K key = keysIter.next();

      Preconditions.checkArgument(valsIter.hasNext(),
                                  "number of values[%s] less than number of keys, broke on key[%s]",
                                  retVal.size(), key);

      retVal.put(key, valsIter.next());
    }

    Preconditions.checkArgument(!valsIter.hasNext(),
                                "number of values[%s] exceeds number of keys[%s]",
                                retVal.size() + Iterators.size(valsIter), retVal.size());

    return retVal;
  }
403219
def map(cls, iterable, func, *a, **kw):
    

    return cls(func(x, *a, **kw) for x in iterable)
823754
function (obj, f) {
      var r = {};
      each(obj, function (x, i) {
        var tuple = f(x, i, obj);
        r[tuple.k] = tuple.v;
      });
      return r;
    }
744357
private Set<Tuple> toEdgeSet(int[] mapping) {
        Set<Tuple> edges = new HashSet<Tuple>(mapping.length * 2);
        for (int u = 0; u < g.length; u++) {
            for (int v : g[u]) {
                edges.add(new Tuple(mapping[u], mapping[v]));
            }
        }
        return edges;
    }
499800
def _mappingGetValueSet(mapping, keys):
    
    setUnion = set()
    for k in keys:
        setUnion = setUnion.union(mapping[k])
    return setUnion
1070425
def tlist2dict(tuple_list,**kwargs):
    '''
        
    '''
    if('deepcopy' in kwargs):
        deepcopy = kwargs['deepcopy']
    else:
        deepcopy = 1
    if('check' in kwargs):
        check = kwargs['check']
    else:
        check = 1
    if(check):
        if(tltl.is_tlist(tuple_list)):
            pass
        else:
            return(None)
    else:
        pass
    j = {}
    if(deepcopy):
        new = copy.deepcopy(tuple_list)
    else:
        new = tuple_list
    for i in range(0,new.__len__()):
        temp = new[i]
        key = temp[0]
        value = temp[1]
        j[key] = value
    return(j)
1048311
public final <U2> Tuple3<T1, U2, T3> map2(Function<? super T2, ? extends U2> function) {
        return Tuple.tuple(v1, function.apply(v2), v3);
    }
522671
def convert_mapping(self, mapping):
        """"""
        if isinstance(mapping, dict):
            return self.convert_items(iteritems(mapping))
        return self.convert_items(mapping)
822167
def pairwise_point_combinations(xs, ys, anchors):
    
    for i in xs:
        anchors.append((i, max(ys)))
        anchors.append((i, min(ys)))
    for i in ys:
        anchors.append((max(xs), i))
        anchors.append((min(xs), i))
536711
def pairwise(iterable):
    ""
    a, b = tee(iterable)
    next(b, None)
    return izip(a, b)
590248
def compose(self, mapping):
        
        items = [f.compose(mapping) for f in self._items]
        return self.__class__(items, self.shape, self.ftype)
911561
def p_ex_map_pair(self, p):
        """"""
        try:
            p[0] = {p[1]: p[3]}
        except TypeError:
            msg = u"%s is an invalid hash key because it cannot be hashed." % repr(p[1])
            self.errors.append((msg, p.lineno(2), self.path))
            p[0] = {}
719226
def map_values(f, D):
    ''''''
    return { key:f(val) for key,val in D.iteritems() }
297680
public final <U3> Tuple4<T1, T2, U3, T4> map3(Function<? super T3, ? extends U3> function) {
        return Tuple.tuple(v1, v2, function.apply(v3), v4);
    }
724763
def map_to_array(pairs):
    
    if pairs:
        pairs = [TuidMap(*p) for p in pairs]
        max_line = max(p.line for p in pairs)
        tuids = [None] * max_line
        for p in pairs:
            if p.line:  # line==0 IS A PLACEHOLDER FOR FILES THAT DO NOT EXIST
                tuids[p.line-1] = p.tuid
        return tuids
    else:
        return None
725023
function pairs(strMap) {
    return Z.map (function(k) { return Pair (k) (strMap[k]); },
                  Object.keys (strMap));
  }