arrUnits sorted in reverse chronological order
501782
function prepareLinkProofs(arrUnits, callbacks){
	if (!ValidationUtils.isNonemptyArray(arrUnits))
		return callbacks.ifError("no units array");
	if (arrUnits.length === 1)
		return callbacks.ifError("chain of one element");
	mutex.lock(['prepareLinkProofs'], function(unlock){
		var start_ts = Date.now();
		var arrChain = [];
		async.forEachOfSeries(
			arrUnits,
			function(unit, i, cb){
				if (i === 0)
					return cb();
				createLinkProof(arrUnits[i-1], arrUnits[i], arrChain, cb);
			},
			function(err){
				console.log("prepareLinkProofs for units "+arrUnits.join(', ')+" took "+(Date.now()-start_ts)+'ms, err='+err);
				err ? callbacks.ifError(err) : callbacks.ifOk(arrChain);
				unlock();
			}
		);
	});
}
673903
function sortByOrdinal(extensions, done) {
    const sorted = extensions.sort((a, b) => {
        if (a.ordinal || b.ordinal) {
            if (!a.ordinal) return 1;
            if (!b.ordinal) return -1;
            if (a.ordinal < b.ordinal) return -1;
            return 1;
        }
        return a.pluginId.localeCompare(b.pluginId);
    });

    if (done) {
        done(sorted);
    }

    return sorted;
}
1277601
def sort(self, order="asc"):
        
        self.__prepare()
        if isinstance(self._json_data, list):
            if order == "asc":
                self._json_data = sorted(self._json_data)
            else:
                self._json_data = sorted(self._json_data, reverse=True)

        return self
1361085
def get_longest_orf(orfs):
    """"""
    sorted_orf = sorted(orfs, key=lambda x: len(x['sequence']), reverse=True)[0]
    return sorted_orf
347867
def sort(records: Sequence[Record]) -> List[Record]:
    ""
    return sorted(records, key=_record_key)
291272
function sortByFirst(valueArrays) {
  const firstValues = valueArrays[0];
  const indices = sortedIndices(firstValues);
  return valueArrays.map(function(values) {
    return indices.map(function(sortedIndex) {
      return values[sortedIndex];
    });
  });
}
391984
def sorted(self, attrname, reverse=False):
        
        attrs = []
        for i, pseudo in self:
            try:
                a = getattr(pseudo, attrname)
            except AttributeError:
                a = np.inf
            attrs.append((i, a))

        # Sort attrs, and build new table with sorted pseudos.
        return self.__class__([self[a[0]] for a in sorted(attrs, key=lambda t: t[1], reverse=reverse)])
221786
def sorted(self, fsort):
        '''
        
        '''
        if not self.params:
            self.params = dict()
        self.params['sort'] = fsort

        return self
1274496
function getSortedRefPaths (reverse) {
  let refs = []

  if (this.schema.refs) {
    for (const key in this.schema.refs) {
      if (this.schema.refs.hasOwnProperty(key)) {
        refs.push(this.schema.refs[key].path)
      }
    }

    if (refs.length > 0) {
      refs = _.sortBy(refs, 'length')
      if (reverse) {
        refs.reverse()
      }
    }
  }

  return refs
}
767679
public static <T> void rsort (List<T> a, Comparator<? super T> comp)
    {
        sort(a, Collections.reverseOrder(comp));
    }
694662
def sorted_releases(self):
        
        releases = [(parse_version(release.version), release)
                    for release in self.releases]
        releases.sort(reverse=True)
        return [release[1] for release in releases]
795642
def sort_entries(self):
        """"""
        return sorted(self.data, key=self.sort_func, reverse=self.get_reverse())
895258
async def sort(self, request, reverse=False):
        """"""
        return sorted(
            self.collection, key=lambda o: getattr(o, self.columns_sort, 0), reverse=reverse)
859715
def reorder(self, dst_order, arr, src_order=None):
        """"""
        if dst_order is None:
            dst_order = self.viewer.rgb_order
        if src_order is None:
            src_order = self.rgb_order
        if src_order != dst_order:
            arr = trcalc.reorder_image(dst_order, arr, src_order)

        return arr
30126
function(data, sortOrder) {
  if(sortOrder){
    data = _.sortBy(data, sortOrder.substr(1));
    if(sortOrder[0] === '-'){
      data.reverse();
    }
  }
  return data;
}
1184692
def inverted_level_order(self) -> Iterator["BSP"]:
        
        levels = []  # type: List[List['BSP']]
        next = [self]  # type: List['BSP']
        while next:
            levels.append(next)
            level = next  # type: List['BSP']
            next = []
            for node in level:
                next.extend(node.children)
        while levels:
            yield from levels.pop()
442728
public function sortReleases()
	{
		// If there is an unreleased release pull that out and sort the rest
		$unreleased = null;
		if (isset($this->releases['unreleased']))
		{
			$unreleased = $this->releases['unreleased'];
			unset($this->releases['unreleased']);
		}

		$order = Sort::sort(array_keys($this->releases));
		$order = array_reverse($order);

		$newOrder = [];
		/** @var Version $version */
		foreach ($order as $version)
		{
			$index = $version->__toString();
			$newOrder[$index] = $this->releases[$index];
		}

		if ($unreleased !== null)
		{
			$newOrder = ['unreleased' => $unreleased] + $newOrder;
		}

		$this->releases = $newOrder;
	}