kazu.utils.grouping

Module Attributes

Item

The type of an element in the iterable being grouped.

Key

The type of the sort key provided by the key_func.

Functions

sort_then_group(items, key_func[, reverse])

class kazu.utils.grouping.Item

The type of an element in the iterable being grouped.

alias of TypeVar(‘Item’)

class kazu.utils.grouping.Key

The type of the sort key provided by the key_func.

Bound to ‘SupportsRichComparison’ from _typeshed as the keys must support comparison in order to be sorted using sorted().

alias of TypeVar(‘Key’, bound=SupportsRichComparison)

kazu.utils.grouping.sort_then_group(items, key_func, reverse=False)[source]
Parameters:
Return type:

Iterable[tuple[Key, Iterable[Item]]]