Sort records into a canonical order, suitable for comparison.
347867
def sort(records: Sequence[Record]) -> List[Record]:
    ""
    return sorted(records, key=_record_key)
462346
def chrom_sorted(in_chroms):
    
    in_chroms.sort()
    canonicals = [str(c) for c in range(1, 23)] + ['X', 'Y', 'M', 'MT']
    canonical_chr = ['chr' + c for c in canonicals]
    out_chroms_dict = {
        'can': [c for c in in_chroms if c in canonicals],
        'can_chr': [c for c in in_chroms if c in canonical_chr],
        'others': [c for c in in_chroms if c not in canonicals + canonical_chr]}

    assert not (out_chroms_dict['can'] and out_chroms_dict['can_chr'])
    assert not ('M' in out_chroms_dict['can']and 'MT' in out_chroms_dict['can'])
    assert not ('chrM' in out_chroms_dict['can_chr'] and 'chrMT' in out_chroms_dict['can_chr'])

    out_chroms_dict['can'] = canonical_chrom_sorted(out_chroms_dict['can'])
    out_chroms_dict['can_chr'] = canonical_chrom_sorted(out_chroms_dict['can_chr'])

    out_chroms = out_chroms_dict['can'] or out_chroms_dict['can_chr']
    out_chroms.extend(out_chroms_dict['others'])
    return out_chroms
674683
private Table sortOn(IntComparator rowComparator) {
        Table newTable = emptyCopy(rowCount());

        int[] newRows = rows();
        IntArrays.parallelQuickSort(newRows, rowComparator);

        Rows.copyRowsToTable(newRows, this, newTable);
        return newTable;
    }
504803
def order_by(self, order_by: Union[set, str]):
        """"""
        clone = self._clone()
        if isinstance(order_by, str):
            order_by = {order_by}

        clone._order_by = clone._order_by.union(order_by)

        return clone
1092697
def sort(self, column, order=Qt.AscendingOrder):
        """"""
        ascending = order == Qt.AscendingOrder
        self.model.sort(self.COLUMN_INDEX, order=ascending)
        return True
1122855
def sort(self):
        
        self._matches.sort_values(
            by=[constants.SIZE_FIELDNAME, constants.NGRAM_FIELDNAME,
                constants.COUNT_FIELDNAME, constants.LABEL_FIELDNAME,
                constants.WORK_FIELDNAME, constants.SIGLUM_FIELDNAME],
            ascending=[False, True, False, True, True, True], inplace=True)
772049
def _ordered(self, odict):
        """"""
        ndict = OrderedDict()

        if isinstance(odict, CatDict) or isinstance(odict, Entry):
            key = odict.sort_func
        else:
            key = None

        nkeys = list(sorted(odict.keys(), key=key))
        for key in nkeys:
            if isinstance(odict[key], OrderedDict):
                odict[key] = self._ordered(odict[key])
            if isinstance(odict[key], list):
                if (not (odict[key] and
                         not isinstance(odict[key][0], OrderedDict))):
                    nlist = []
                    for item in odict[key]:
                        if isinstance(item, OrderedDict):
                            nlist.append(self._ordered(item))
                        else:
                            nlist.append(item)
                    odict[key] = nlist
            ndict[key] = odict[key]

        return ndict
1020865
def sort(self, **parameters):
        
        parameters = self._coerce_by_parameter(parameters)
        self._sort = parameters
        return self
815587
def sort_nicely(l):
    """"""
    convert = lambda text: int(text) if text.isdigit() else text
    alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
    l.sort(key=alphanum_key)
558096
def _compare_rows(from_recs, to_recs, keys):
    ""
    return set(
        k for k in keys
        if sorted(from_recs[k].items()) != sorted(to_recs[k].items())
    )
430933
def _sort_r(sorted, processed, key, deps, dependency_tree):
    """"""
    if key in processed:
        return
    processed.add(key)
    for dep_key in deps:
        dep_deps = dependency_tree.get(dep_key)
        if dep_deps is None:
            log.debug('"%s" not found, skipped', Repr(dep_key))
            continue
        _sort_r(sorted, processed, dep_key, dep_deps, dependency_tree)
    sorted.append((key, deps))
405863
def sort(self, column, order=Qt.AscendingOrder):
        """"""
        self.sourceModel().sort(column, order)
678747
def sort_name(self):
        
        if self._record and self._record.sort_name:
            return self._record.sort_name
        return self.name
473919
def _sort_schema(schema):
    """"""

    if isinstance(schema, dict):
        for k, v in sorted(schema.items()):
            if isinstance(v, dict):
                yield k, OrderedDict(_sort_schema(v))
            elif isinstance(v, list):
                yield k, list(_sort_schema(v))
            else:
                yield k, v
    elif isinstance(schema, list):
        for v in schema:
            if isinstance(v, dict):
                yield OrderedDict(_sort_schema(v))
            elif isinstance(v, list):
                yield list(_sort_schema(v))
            else:
                yield v
    else:
        yield d
194967
def natural_sorted(l):
    
    ll = copy(l)
    ll.sort(key=_natural_keys)
    return ll
1333573
def sort_order(options = {})
      [[prefix, last].compact.join(' '), suffix, options[:initials] ? initials : first].compact.join(', ')
    end
80900
def sort(self, key, *get_patterns,
             by=None, offset=None, count=None,
             asc=None, alpha=False, store=None):
        """"""
        args = []
        if by is not None:
            args += [b'BY', by]
        if offset is not None and count is not None:
            args += [b'LIMIT', offset, count]
        if get_patterns:
            args += sum(([b'GET', pattern] for pattern in get_patterns), [])
        if asc is not None:
            args += [asc is True and b'ASC' or b'DESC']
        if alpha:
            args += [b'ALPHA']
        if store is not None:
            args += [b'STORE', store]
        return self.execute(b'SORT', key, *args)