from typing import Iterable
from typing import Dict
from typing import List


def generate_array_selector(
        subscript: str,
        split_indices: Iterable[str],
        split_starts: Iterable[int],
        split_block_sizes: Iterable[int],
        indices_size_dict: Dict[str, int]) -> List[slice]:
    """
    Generate the list of selectors `obj` to use with `array[obj]` when the array
    is split along some indices.

    :param subscript: The subscript of the array.
    :param split_indices: List of indices to split.
    :param split_starts: List of starting points of the splits.
    :param split_block_sizes: List of block sizes of the splits.
    :param indices_size_dict: Dictionary containing sizes of each index.
    :return: The selector `obj` used to select subarray `array[obj]`.
    """
    selector = []
    splits = {
        ind: (start, block_size)
        for ind, start, block_size in
        zip(split_indices, split_starts, split_block_sizes)}
    for i in subscript:
        if i in splits:
            end = min(splits[i][0] + splits[i][1], indices_size_dict[i])
            selector.append(slice(splits[i][0], end))
        else:
            selector.append(slice(None, None, None))
    return selector