Sorts lists of objects and combines them into a single list
188689
def _sortObjects(orderby='created', **kwargs):
    """"""
    o = []
    
    for m in kwargs.values():
        for l in iter(m):
            o.append(l)
    o = list(set(o))
    sortfunc = _sortByCreated if orderby == 'created' else _sortByModified
    if six.PY2:
        o.sort(sortfunc)
    else:
        o.sort(key=functools.cmp_to_key(sortfunc))

    return o
630773
def _process_items(cls, vals):
        ""
        if type(vals) is cls:
            return vals.data
        elif not isinstance(vals, (list, tuple)):
            vals = [vals]
        items = []
        counts = defaultdict(lambda: 1)
        cls._unpack_paths(vals, items, counts)
        items = cls._deduplicate_items(items)
        return items
595224
private static void sort (double[] coords1, int length1,
                              double[] coords2, int length2, int[] array) {
        int temp;
        int length = length1 + length2;
        double x1, y1, x2, y2;

        for (int i = 1; i < length; i++) {
            if (array[i - 1] < length1) {
                x1 = coords1[2 * array[i - 1]];
                y1 = coords1[2 * array[i - 1] + 1];
            } else {
                x1 = coords2[2 * (array[i - 1] - length1)];
                y1 = coords2[2 * (array[i - 1] - length1) + 1];
            }
            if (array[i] < length1) {
                x2 = coords1[2 * array[i]];
                y2 = coords1[2 * array[i] + 1];
            } else {
                x2 = coords2[2 * (array[i] - length1)];
                y2 = coords2[2 * (array[i] - length1) + 1];
            }
            int j = i;
            while (j > 0 && compare(x1, y1, x2, y2) <= 0) {
                temp = array[j];
                array[j] = array[j - 1];
                array[j - 1] = temp;
                j--;
                if (j > 0) {
                    if (array[j - 1] < length1) {
                        x1 = coords1[2 * array[j - 1]];
                        y1 = coords1[2 * array[j - 1] + 1];
                    } else {
                        x1 = coords2[2 * (array[j - 1] - length1)];
                        y1 = coords2[2 * (array[j - 1] - length1) + 1];
                    }
                    if (array[j] < length1) {
                        x2 = coords1[2 * array[j]];
                        y2 = coords1[2 * array[j] + 1];
                    } else {
                        x2 = coords2[2 * (array[j] - length1)];
                        y2 = coords2[2 * (array[j] - length1) + 1];
                    }
                }
            }
        }
    }
1270776
function sortObject(originalSrc, options, done) {
  var callback

  if (options === undefined) {
    // do nothing
  } else if (typeof options === "function") {
    callback = options
  } else {
    callback = done
  }

  if (callback) {
    process.nextTick(function() {
      done(work(originalSrc))
    })
    return
  }

  function work(obj) {
    try {
      // Uses module to sort all objects key names based on standard
      // string ordering.
      var deepSorted = deep_sort_object(obj)

      // Once object keys are sorted, we still need to check for arrays.
      var out = deepInspect(deepSorted)
      return out
    } catch (e) {
      console.log(e)
      throw e
    }
  }

  return work(originalSrc)
}
327823
def _organize_output(output, combine_map, file_key, combine_arg_keys):
    
    out_map = collections.defaultdict(list)
    extra_args = collections.defaultdict(list)
    final_args = collections.OrderedDict()
    extras = []
    for data in output:
        cur_file = data.get(file_key)
        if not cur_file:
            extras.append([data])
        else:
            cur_out = combine_map[cur_file]
            out_map[cur_out].append(cur_file)
            extra_args[cur_out].append([data[x] for x in combine_arg_keys])
            data[file_key] = cur_out
            if cur_out not in final_args:
                final_args[cur_out] = [data]
            else:
                extras.append([data])
    combine_args = [[v, k] + _get_extra_args(extra_args[k], combine_arg_keys)
                    for (k, v) in out_map.items()]
    return combine_args, list(final_args.values()) + extras
25085
function objectToArray(o, order) {
    order = order || Object.keys(o);

    return order.map(function(k) {
      return o[k];
    });
  }
108449
function combine(...objects) {
  inv(Array.isArray(objects) && objects.length > 0,
    'You must pass at least one object to instantiate'
  );

  inv(objects.every(isObj),
    'Expecting only plain objects as parameter(s)'
  );

  return assign({}, ...objects);
}
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))
1172982
private List<Coordinate> sortY(List<Coordinate> coordinates) {
		List<Coordinate> sorted = new ArrayList<Coordinate>(coordinates);
		Collections.sort(sorted, new YComparator());
		return sorted;
	}
1019246
def sort(self, *args, **kwargs):
		""""""
		self._list.sort(*args, **kwargs)
		for index, value in enumerate(self._list):
			self._dict[value] = index
1188514
def _sorter(generated):
    """"""
    pairs = [(os.path.dirname(f), os.path.basename(f))
             for f in set(list(generated))]

    pairs.sort()

    return [os.path.join(pair[0], pair[1]) for pair in pairs]
663124
function objectFromLists(keys, vals) {
  var result = {};
  for (let i = 0, len = keys.length; i < len; i++) {
    result[keys[i]] = vals[i];
  }
  return result;
}
65805
function doesObjectListHaveDuplicates(l) {
    const mergedList = l.reduce((merged, obj) => (
        obj ? merged.concat(Object.keys(obj)) : merged
    ), []);

    // Taken from: http://stackoverflow.com/a/7376645/1263876
    // By casting the array to a Set, and then checking if the size of the array
    // shrunk in the process of casting, we can check if there were any duplicates
    return new Set(mergedList).size !== mergedList.length;
}
930299
def list_combiner(value, mutator, *args, **kwargs):
    
    value.append(mutator(*args, **kwargs))
    return value
1286280
def sorted(cls, items, orders):
    ''''''
    return sorted(items, cmp=cls.multipleOrderComparison(orders))
1314626
private static <T> ArrayList<T> sorted(Collection<T> cls, Comparator<? super T> c) {
    ArrayList<T> sorted = new ArrayList<>(cls);
    sorted.sort(c);
    return sorted;
  }
1293593
def flatlist_dropdup(list_of_lists):
    
    return list(set([str(item) for sublist in list_of_lists for item in sublist]))