                                   new_opt, ".".join([section, item]))
                  helptext = config.format_help(options["helptext"], is_section=False)
                  new_config.set(section, helptext)
                  new_config.set(section, item, str(new_opt))
          config.config = new_config
          config.save_config()
          logger.info("Saved config: '%s'", config.configfile)
 
</s> remove         helptext = '# {}'.format(helptext.replace("\n", "\n# "))
 </s> add         formatted = ""
        for hlp in helptext.split("\n"):
            subsequent_indent = "\t\t" if hlp.startswith("\t") else ""
            hlp = f"\t- {hlp[1:].strip()}" if hlp.startswith("\t") else hlp
            formatted += textwrap.fill(hlp,
                                       100,
                                       tabsize=4,
                                       subsequent_indent=subsequent_indent) + "\n"
        helptext = '# {}'.format(formatted[:-1].replace("\n", "\n# "))  # Strip last newline </s> remove                 opt_value = self.config.get(section, item)
                if opt_value.lower() == "none" and any(choice.lower() == "none"
                                                       for choice in opt["choices"]):
                    continue
                if opt_value not in opt["choices"]:
                    default = str(opt["default"])
                    logger.warning("'%s' is not a valid config choice for '%s': '%s'. Defaulting "
                                   "to: '%s'", opt_value, section, item, default)
                    self.config.set(section, item, default)
 </s> add                 if opt["type"] == list:  # Multi-select items
                    opt_value = self._parse_list(section, item)
                    if not opt_value:  # No option selected
                        continue
                    if not all(val in opt["choices"] for val in opt_value):
                        invalid = [val for val in opt_value if val not in opt["choices"]]
                        valid = ", ".join(val for val in opt_value if val in opt["choices"])
                        logger.warning("The option(s) %s are not valid selections for '%s': '%s'. "
                                       "setting to: '%s'", invalid, section, item, valid)
                        self.config.set(section, item, valid)
                else:  # Single-select items
                    opt_value = self.config.get(section, item)
                    if opt_value.lower() == "none" and any(choice.lower() == "none"
                                                           for choice in opt["choices"]):
                        continue
                    if opt_value not in opt["choices"]:
                        default = str(opt["default"])
                        logger.warning("'%s' is not a valid config choice for '%s': '%s'. "
                                       "Defaulting to: '%s'", opt_value, section, item, default)
                        self.config.set(section, item, default) </s> remove                 logger.debug("Adding option: (item: '%s', opt: '%s'", item, opt)
 </s> add                 logger.debug("Adding option: (item: '%s', opt: '%s')", item, opt)
                if options["type"] == list:  # Comma seperate multi select options
                    new_opt = ", ".join(new_opt if isinstance(new_opt, list) else new_opt.split())
                                   new_opt, ".".join([section, item]))
                  helptext = config.format_help(options["helptext"], is_section=False)
                  new_config.set(section, helptext)
                if options["type"] == list:  # Comma seperate multi select options
                    new_opt = ", ".join(new_opt if isinstance(new_opt, list) else new_opt.split())
                  new_config.set(section, item, str(new_opt))
          config.config = new_config
          config.save_config()
          logger.info("Saved config: '%s'", config.configfile)
keep keep add keep keep keep keep
 scripts.train - Add freeze weights option
lib.config:
  - Better formatting for .ini files
  - Support multi-select options
gui - Add support for multi-select config items 
lib/gui/popup_configure.py