def calculate_chunk_slices(items_per_chunk, num_items):
    'Calculate slices for indexing an adapter.\n\n    Parameters\n    ----------\n    items_per_chunk: int\n        Approximate number of items per chunk.\n    num_items: int\n        Total number of items.\n\n    Returns\n    -------\n    list of slices\n\n    '
    assert (items_per_chunk > 0)
    assert (num_items > 0)
    return [slice(i, min((i + items_per_chunk), num_items)) for i in range(0, num_items, items_per_chunk)]
Calculate slices for indexing an adapter.

Parameters
----------
items_per_chunk: int
    Approximate number of items per chunk.
num_items: int
    Total number of items.

Returns
-------
list of slices
def calculate_chunk_slices(items_per_chunk, num_items):
    'Calculate slices for indexing an adapter.\n\n    Parameters\n    ----------\n    items_per_chunk: int\n        Approximate number of items per chunk.\n    num_items: int\n        Total number of items.\n\n    Returns\n    -------\n    list of slices\n\n    '
    assert (items_per_chunk > 0)
    assert (num_items > 0)
    return [slice(i, min((i + items_per_chunk), num_items)) for i in range(0, num_items, items_per_chunk)]