def load_config(mode='force'):
    """
    Load the current config
    By default, the user is prompted for values which have not been set already

    Keyword arguments:
    mode -- 3 options:
        verbose -- prompt for all options
            (`python -m digits.config.edit --verbose`)
        normal -- accept defaults for hidden options, otherwise prompt
            (`digits-devserver --config`, `python -m digits.config.edit`)
        quiet -- prompt only for options without valid defaults
            (`digits-devserver`)
        force -- throw errors for invalid options
            (`digits-server`, `digits-test`)
    """
    current_config.reset()

    instanceConfig = config_file.InstanceConfigFile()
    newConfig = config_file.InstanceConfigFile()

    non_framework_options = [o for o in current_config.option_list
            if not isinstance(o, config_option.FrameworkOption)]
    framework_options = [o for o in current_config.option_list
            if isinstance(o, config_option.FrameworkOption)]

    # Load non-framework config options
    for option in non_framework_options:
        load_option(option, mode, newConfig, instanceConfig)

    has_one_framework = False
    verbose_for_frameworks = False
    while not has_one_framework:
        # Load framework config options
        if verbose_for_frameworks and mode == 'quiet':
            framework_mode = 'verbose'
        else:
            framework_mode = mode
        for option in framework_options:
            load_option(option, framework_mode, newConfig, instanceConfig)
            if option.has_value():
                has_one_framework = True

        if not has_one_framework:
            errstr = 'DIGITS requires at least one DL backend to run.'
            if mode == 'force':
                raise RuntimeError(errstr)
            else:
                print errstr
                # try again prompting all
                verbose_for_frameworks = True

    for option in current_config.option_list:
        option.apply()

    if newConfig.dirty() and newConfig.can_write():
        newConfig.save()
        print 'Saved config to %s' % newConfig.filename()
dataset/ETHPy150Open NVIDIA/DIGITS/digits/config/load.py/load_config/original