Loading muffin/utils.py +4 −1 Original line number Diff line number Diff line Loading @@ -5,5 +5,8 @@ from collections.abc import Iterable, Iterator T = TypeVar("T") S = TypeVar("S") def group_by(iterable: Iterable[T], key: Callable[[T], S]) -> Iterator[tuple[S, Iterator[T]]]: def group_by( iterable: Iterable[T], key: Callable[[T], S] ) -> Iterator[tuple[S, Iterator[T]]]: return itertools.groupby(sorted(iterable, key=key), key) Loading
muffin/utils.py +4 −1 Original line number Diff line number Diff line Loading @@ -5,5 +5,8 @@ from collections.abc import Iterable, Iterator T = TypeVar("T") S = TypeVar("S") def group_by(iterable: Iterable[T], key: Callable[[T], S]) -> Iterator[tuple[S, Iterator[T]]]: def group_by( iterable: Iterable[T], key: Callable[[T], S] ) -> Iterator[tuple[S, Iterator[T]]]: return itertools.groupby(sorted(iterable, key=key), key)