from typing import Tuple
import pickle


def load(path: str) -> Tuple:
    """
    Returns dictionaries of tokens to their number of occurences.

    Parameters
    ----------
    path : str
        The path of the pickled dictionary

    Returns
    -------
    subtoken2count : dict
        A dictionary mapping subtokens to their number of occurences
    node2count : dict
        A dictionary mapping ast path nodes to their number of occurences
    target2count : dict
        A dictionary mapping subtargets to their number of occurences
    max_context : int
        The maximum number of paths per function
    """
    with open(path, 'rb') as file:
        subtoken2count = pickle.load(file)
        node2count = pickle.load(file)
        target2count = pickle.load(file)
        max_contexts = pickle.load(file)
        
        return subtoken2count, node2count, target2count, max_contexts