(
    policy_breaks: List[PolicyBreak],
)
return sha_dict
leak_dictionary_by_ignore_sha sorts matches and incidents by
    first appearance in file.

    sort incidents by first appearance on file,
    file wide matches have no index
    so give it -1 so they get bumped to the top

    :return: Dictionary with line number as index and a list of
    matches that start on said line.
leak_dictionary_by_ignore_sha sorts matches and incidents by
    first appearance in file.
leak_dictionary_by_ignore_sha sorts matches and incidents by first appearance in file .
def leak_dictionary_by_ignore_sha(
    policy_breaks: List[PolicyBreak],
) -> Dict[str, List[PolicyBreak]]:
    """
    leak_dictionary_by_ignore_sha sorts matches and incidents by
    first appearance in file.

    sort incidents by first appearance on file,
    file wide matches have no index
    so give it -1 so they get bumped to the top

    :return: Dictionary with line number as index and a list of
    matches that start on said line.
    """
    policy_breaks.sort(
        key=lambda x: min(  # type: ignore
            (match.index_start if match.index_start else -1 for match in x.matches)
        )
    )
    sha_dict: Dict[str, List[PolicyBreak]] = OrderedDict()
    for policy_break in policy_breaks:
        policy_break.matches.sort(key=lambda x: x.index_start if x.index_start else -1)
        ignore_sha = get_ignore_sha(policy_break)
        sha_dict.setdefault(ignore_sha, []).append(policy_break)

    return sha_dict
def leak_dictionary_by_ignore_sha ( policy_breaks : List [ PolicyBreak ] , ) -> Dict [ str , List [ PolicyBreak ] ] : policy_breaks . sort ( key = lambda x : min ( # type: ignore ( match . index_start if match . index_start else - 1 for match in x . matches ) ) ) sha_dict : Dict [ str , List [ PolicyBreak ] ] = OrderedDict ( ) for policy_break in policy_breaks : policy_break . matches . sort ( key = lambda x : x . index_start if x . index_start else - 1 ) ignore_sha = get_ignore_sha ( policy_break ) sha_dict . setdefault ( ignore_sha , [ ] ) . append ( policy_break ) return sha_dict