mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-22 03:14:06 -05:00
11 lines
199 B
Python
11 lines
199 B
Python
from typing import TypeVar
|
|
|
|
T = TypeVar("T")
|
|
|
|
|
|
def batch_list(
|
|
lst: list[T],
|
|
batch_size: int,
|
|
) -> list[list[T]]:
|
|
return [lst[i : i + batch_size] for i in range(0, len(lst), batch_size)]
|