from typing import Dict
import pathlib
import json


def load_git_info(input_path=None) -> Dict[str, str]:
    """
    Load previously saved output of git_info from a json file.

    Args:
        input_path: Input path to json file. If None, the default will be
            bclustering/git_info.json

    Returns:
        Parsed json file (should be identical to saved output of version_info).
    """
    if input_path:
        input_path = pathlib.Path(input_path)
    if not input_path:
        this_dir = pathlib.Path(__file__).parent.resolve()
        input_path = this_dir / ".." / "git_info.json"
    with input_path.open() as input_file:
        info = json.loads(input_file.read())
    return info