def edit_config_file(verbose=False):
    suggestions = []
    instanceConfig = config_file.InstanceConfigFile()
    if instanceConfig.can_write():
        suggestions.append(prompt.Suggestion(
            instanceConfig.filename(), 'I',
            desc = 'Instance', default=True))

    def filenameValidator(filename):
        """
        Returns True if this is a valid file to edit
        """
        if os.path.isfile(filename):
            if not os.access(filename, os.W_OK):
                raise config_option.BadValue('You do not have write permission')
            else:
                return filename

        if os.path.isdir(filename):
            raise config_option.BadValue('This is a directory')
        dirname = os.path.dirname(os.path.realpath(filename))
        if not os.path.isdir(dirname):
            raise config_option.BadValue('Path not found: %s' % dirname)
        elif not os.access(dirname, os.W_OK):
            raise config_option.BadValue('You do not have write permission')
        return filename

    filename = prompt.get_input(
            message     = 'Which file do you want to edit?',
            suggestions = suggestions,
            validator   = filenameValidator,
            is_path     = True,
            )

    print 'Editing file at %s ...' % os.path.realpath(filename)
    print

    is_standard_location = False

    if filename == instanceConfig.filename():
        is_standard_location = True
        instanceConfig = None

    configFile = config_file.ConfigFile(filename)

    min_visibility = config_option.Visibility.DEFAULT
    if verbose:
        min_visibility = config_option.Visibility.HIDDEN

    # Loop through the visible options
    for option in [o for o in current_config.option_list
            if o.visibility() >= min_visibility]:
        previous_value = configFile.get(option.config_file_key())
        suggestions = [prompt.Suggestion(None, 'U',
            desc='unset', default=(previous_value is None))]
        if previous_value is not None:
            suggestions.append(prompt.Suggestion(previous_value, '',
                desc = 'Previous', default = True))
        if instanceConfig is not None:
            instance_value = instanceConfig.get(option.config_file_key())
            if instance_value is not None:
                suggestions.append(prompt.Suggestion(instance_value, 'I',
                    desc = 'Instance', default = is_standard_location))
        suggestions += option.suggestions()
        if option.optional():
            suggestions.append(prompt.Suggestion('', 'N',
                desc = 'none', default = True))

        prompt.print_section_header(option.prompt_title())
        value = prompt.get_input(
                message     = option.prompt_message(),
                validator   = option.validate,
                suggestions = suggestions,
                is_path     = option.is_path(),
                )
        print
        configFile.set(option.config_file_key(), value)

    configFile.save()
    print 'New config saved at %s' % configFile.filename()
    print
    print configFile
Prompt the user for which file to edit,
dataset/ETHPy150Open NVIDIA/DIGITS/digits/config/edit.py/edit_config_file