import pathlib
import yaml
import json


def read_file(file: pathlib.Path) -> dict:
    """Read a json/yaml file without the znjson.Decoder

    Parameters
    ----------
    file: pathlib.Path
        The file to read

    Returns
    -------
    dict:
        Content of the json/yaml file
    """
    if file.suffix in [".yaml", ".yml"]:
        with file.open("r") as f:
            file_content = yaml.safe_load(f)
    elif file.suffix == ".json":
        file_content = json.loads(file.read_text())
    else:
        raise ValueError(f"File with suffix {file.suffix} is not supported")
    return file_content