Generate all combinations of a given list of items.
500369
def all_combinations(items):
    """"""
    return (set(compress(items,mask)) for mask in product(*[[0,1]]*len(items)))
651153
def convert_items(self, items):
        """"""
        return ((key, self.convert(value, self)) for key, value in items)
1188695
def generate(self,**kwargs):
        """"""
        import collections
        all_params = cartesian_dicts({k:kwargs[k] for k in kwargs.keys() if isinstance(kwargs[k], collections.Iterable)})
        for pi,p in enumerate(all_params):
            if self.name_mode == 'int':
                n = str(len(self.containers))
            else:
                n = None
            self.containers.append(PDContainer(name=n,params=p,parent=self))
        self.parameters.update({ k: kwargs[k] for k in kwargs.keys() if not isinstance(kwargs[k], collections.Iterable) })
        self.save()
1134570
def de_duplicate(items):
    
    result = []
    for item in items:
        if item not in result:
            result.append(item)
    return result
434843
public static <T> List<T> makeList(T... items) {
    List<T> s = new ArrayList<T>(items.length);
    for (int i = 0; i < items.length; i++) {
      s.add(items[i]);
    }
    return s;
  }
1137343
def detuning_combinations(lists):
    
    """
    Nl = len(lists)
    comb = [[i] for i in range(lists[0])]
    for l in range(1, Nl):
        combn = []
        for c0 in comb:
            for cl in range(lists[l]):
                combn += [c0[:]+[cl]]
        comb = combn[:]
    return comb
851133
def combinations(self):
        
        keys = self._vars.keys()
        for result in product(*self._vars.values()):
            possible_solution = {}
            for i, v in enumerate(result):
                possible_solution[keys[i]] = v
            yield possible_solution
50090
def enumerate(self, **kwargs):
        '''
        '''
        for item in self.set.enumerate(**kwargs):
            yield flattened(item)
34752
def join(iterable, sep):
    """"""
    i = 0
    for i, item in enumerate(iterable):
        if i == 0:
            yield item
        else:
            yield sep
            yield item
208038
def mix_generators(generator_list):
  """"""
  i = 0
  l = len(generator_list)
  stopiters_seen = 0
  while stopiters_seen <= l:
    try:
      yield six.next(generator_list[i % l])
      i += 1
      stopiters_seen = 0
    except StopIteration:
      i += 1
      stopiters_seen += 1
1099611
public List<List<Classification.RuntimeClassification>> generate() {
    List<Classification.RuntimeClassification> classes = getClassifications();
    List<List<Classification.RuntimeClassification>> treeData = new ArrayList<>();
    for (Classification.RuntimeClassification cls : classes) {
      treeData.add(cls.getClassifications());
    }

    combinations = new ArrayList<>();
    getCombinations(treeData, 0, new ArrayList<>());
    return combinations;
  }
786990
def _sorted_keys_items(dobj):
    """"""
    keys = sorted(dobj.keys())
    for key in keys:
        yield key, dobj[key]
1033143
def items(self):
        
        for c in self._all_combos():
            _, value = _getitem(self.cube, c)
            yield c, value
916236
private void generateNextCombinationIndices()
    {
        if (remainingCombinations == 0)
        {
            throw new IllegalStateException("There are no combinations remaining.  " +
                                            "Generator must be reset to continue using.");
        }
        else if (remainingCombinations < totalCombinations)
        {
            int i = combinationIndices.length - 1;
            while (combinationIndices[i] == elements.length - combinationIndices.length + i)
            {
                i--;
            }
            ++combinationIndices[i];
            for (int j = i + 1; j < combinationIndices.length; j++)
            {
                combinationIndices[j] = combinationIndices[i] + j - i;
            }
        }
        --remainingCombinations;
    }
1281806
def random_combination_with_replacement(iterable, r):
    ""
    pool = tuple(iterable)
    n = len(pool)
    indices = sorted(random.randrange(n) for i in xrange(r))
    return tuple(pool[i] for i in indices)
82865
def chunks(items, n):
    
    it = iter(items)
    chunk = tuple(itertools.islice(it, n))
    while chunk:
        yield chunk
        chunk = tuple(itertools.islice(it, n))
1178550
def dedupe(items):
    
    seen = set()
    for item in items:
        if item not in seen:
            yield item
            seen.add(item)