pypaginate.sorting.engine

Sort engine applying SortSpec sequences to in-memory sequences.

Delegates to the native pypaginate._core engine, which applies the ordered sort specs (each controlling direction and null placement) and returns a row permutation.

Classes

SortEngine

Stateless engine that sorts sequences by SortSpec rules (native).

Module Contents

class pypaginate.sorting.engine.SortEngine

Stateless engine that sorts sequences by SortSpec rules (native).

apply(items: collections.abc.Sequence[T], sorting: collections.abc.Sequence[pypaginate.domain.specs.SortSpec]) list[T]

Sort items according to the given sort specifications.

Parameters:
  • items – Input sequence to sort.

  • sorting – Sort specs in priority order (first = highest).

Returns:

New sorted list (original unchanged).

Raises:

SortError – If sorting fails for any reason.