from typing import Dict
from typing import List


def generate_rules_list(source_index: int, rules_dict: Dict[str, List]) -> List[str]:
    """
    Generates a List of rules from ``rules_dict``, which should be
    applied to the line at ``source_index``.

    Parameters
    ----------
    source_index : int
        Index of the source code line.
    rules_dict : Dict[str, List]
        Dict containing lists of rules, depending on if the tag is a
        cell or a line tag.

    Returns
    -------
    List[str]
        List of rules which should be applied to the line at ``source_index``.

    See Also
    --------
    flake8_tag_to_rules_dict, get_flake8_rules_dict
    """
    line_rules = rules_dict.get(str(source_index + 1), [])
    cell_rules = rules_dict.get("cell", [])
    return line_rules + cell_rules