from json import load
from pathlib import Path
import logging


def load_single(file_name):
    """
    Load a single json file

    Parameters
    ----------
    file_name : str, Path
        file_name to load from

    Returns
    -------
    dict
        the loaded json as a dict ``{data}``

    """

    if Path(file_name).is_dir():
        raise IsADirectoryError("given path is a directory not a file")

    with open(Path(file_name), "r") as f:
        logging.info("loading file_name {}".format(file_name))
        return load(f)