def load_user_config():
    """
    Returns the gitver's configuration: tries to read the stored configuration
    file and merges it with the default one, ensuring a valid configuration is
    always returned.
    """
    try:

        with open(CFGFILE, 'r') as f:
            data = ''
            for line in f:
                l = line.strip()
                if not l.startswith('#'):
                    data += l
            user = json.loads(data)

    except IOError:
        user = dict()

    except (ValueError, __HOLE__) as v:
        term.err("An error occured parsing the configuration file \"" +
                 CFGFILE + "\": " + v.message +
                 "\nPlease check its syntax or rename it and generate the "
                 "default one with the " + bold("gitver init") + " command.")
        sys.exit(1)

    # merge user with defaults
    return dict(default_config, **user)
dataset/ETHPy150Open manuelbua/gitver/gitver/config.py/load_user_config