from typing import Dict
import logging


def _get_y_from_results(results: dict) -> dict:
    """
    Get true labels as a dict of np.arrays indexed by results directory. Note
    there is no need to index by models, since y is the same for all models
    within a directory.

    If y is not available, return an empty dictionary.
    """
    y: Dict[str, dict] = {}
    for results_dir, result in results.items():
        if "y_test_outer_folds" in result:
            y[results_dir] = result["y_test_outer_folds"]
        else:
            logging.warning(
                "y_test_outer_folds not found in"
                f" results[{results_dir}]. Returning y as empty dict.",
            )
    return y