Skip to content

Batching

async_boto.utils.batching

chunks

chunks(list_, n)

Yield successive n-sized chunks from lst.

Source code in async_boto/utils/batching.py
4
5
6
7
def chunks(list_: list[Any], n: int):
    """Yield successive n-sized chunks from lst."""
    for i in range(0, len(list_), n):
        yield list_[i : i + n]

list_to_batches

list_to_batches(list_, batch_size)
Source code in async_boto/utils/batching.py
10
11
def list_to_batches(list_: list[Any], batch_size: int) -> list[list[Any]]:
    return list(chunks(list_, batch_size))