pypaginate.sorting

Universal sorting – backend-agnostic sort engine.

Submodules

Classes

SortEngine

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

Package Contents

class pypaginate.sorting.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.