from typing import List
import pathlib
from typing import Dict
from typing import Any
import pickle


def _open_hydra_pickles(paths: List[pathlib.Path]) -> Dict[str, Any]:
    """Open pickles in directory of Hydra log and return dict of data.

    Parameters
    ----------
    paths : List[pathlib.Path]
        Paths to Hydra pickles to load.

    Returns
    -------
    Dict[str, Any]
        Dict of loaded data, where the key is the loaded file name without its
        extension.
    """
    loaded_data = {}
    for path in paths:
        name = pathlib.Path(path).parent.name
        with open(path, 'rb') as f:
            opened_pickle = pickle.load(f)
        loaded_data[name] = opened_pickle
    return loaded_data