docstr: Adjust the setting values based on the version that saved them
  
          
docstr_tok: ["Adjust","the","setting","values","based","on","the","version","that","saved","them"]
code: def upgrade_settings(
      self, setting_values, variable_revision_number, module_name
  ):
      """Adjust the setting values based on the version that saved them"""
  
      if variable_revision_number == 1:
          # Added aggregate questions
          setting_values = (
              setting_values[:6]
              + ["No", "No", "No"]
              + setting_values[6:]
          )
          variable_revision_number = 2
      if variable_revision_number == 2:
          # Added directory choice questions
          setting_values = (
              setting_values[:9]
              + [DEFAULT_OUTPUT_FOLDER_NAME, "."]
              + setting_values[9:]
          )
          variable_revision_number = 3
      if variable_revision_number == 3:
          # Added "wants everything" setting
          #
          new_setting_values = setting_values[:11] + ["No"]
          for i in range(11, len(setting_values), 3):
              new_setting_values += setting_values[i : i + 3] + ["No"]
  
          setting_values = new_setting_values
          variable_revision_number = 4
  
      if variable_revision_number == 4:
          # Added column selector
          setting_values = (
              setting_values[:12] + ["None|None"] + setting_values[12:]
          )
          variable_revision_number = 5
  
      if variable_revision_number == 5:
          # Combined directory_choice and custom_directory
          # Removed add_indexes
          directory_choice = setting_values[9]
          custom_directory = setting_values[10]
          if directory_choice in (DIR_CUSTOM, DIR_CUSTOM_WITH_METADATA):
              if custom_directory.startswith("."):
                  directory_choice = DEFAULT_OUTPUT_SUBFOLDER_NAME
              elif custom_directory.startswith("&"):
                  directory_choice = DEFAULT_INPUT_SUBFOLDER_NAME
                  custom_directory = "." + custom_directory[1:]
              else:
                  directory_choice = ABSOLUTE_FOLDER_NAME
          directory = Directory.static_join_string(
              directory_choice, custom_directory
          )
          setting_values = (
              setting_values[:3]
              + setting_values[4:9]
              + [directory]
              + setting_values[11:]
          )
          variable_revision_number = 6
  
      if variable_revision_number == 6:
          """Add GenePattern export options
          self.wants_genepattern_file, self.how_to_specify_gene_name,
          self.use_which_image_for_gene_name,self.gene_name_column
          """
          setting_values = (
              setting_values[:9]
              + ["No", GP_NAME_METADATA, "None", "None"]
              + setting_values[9:]
          )
          variable_revision_number = 7
  
      if variable_revision_number == 7:
          # Add nan_representation
          setting_values = (
              setting_values[:SETTING_OG_OFFSET_V7]
              + [NANS_AS_NANS]
              + setting_values[SETTING_OG_OFFSET_V7:]
          )
          variable_revision_number = 8
  
      if variable_revision_number == 8:
          # Removed output file prepend
          setting_values = setting_values[:1] + setting_values[2:]
          variable_revision_number = 9
  
      if variable_revision_number == 9:
          # Added prefix
          setting_values = (
              setting_values[:SETTING_OG_OFFSET_V9]
              + ["No", "MyExpt_"]
              + setting_values[SETTING_OG_OFFSET_V9:]
          )
          variable_revision_number = 10
  
      if variable_revision_number == 10:
          # added overwrite choice - legacy value is "Yes"
          setting_values = (
              setting_values[:SETTING_OG_OFFSET_V10]
              + ["Yes"]
              + setting_values[SETTING_OG_OFFSET_V10:]
          )
          variable_revision_number = 11
  
      if variable_revision_number == 11:
          setting_values = setting_values[:2] + setting_values[3:]
  
          variable_revision_number = 12
      if variable_revision_number == 12:
          # Add "add file path" setting.
          setting_values = (
              setting_values[:2] + ["No"] + setting_values[2:]
          )
          variable_revision_number = 13
  
      # Standardize input/output directory name references
      SLOT_DIRCHOICE = 7
      directory = setting_values[SLOT_DIRCHOICE]
      directory = Directory.upgrade_setting(directory)
      setting_values = (
          setting_values[:SLOT_DIRCHOICE]
          + [directory]
          + setting_values[SLOT_DIRCHOICE + 1 :]
      )
  
      return setting_values, variable_revision_number
  
imports: import base64
  import csv
  import logging
  import os
  import numpy
  from cellprofiler_core.constants.image import C_MD5_DIGEST, C_SCALING, C_HEIGHT, C_WIDTH
  from cellprofiler_core.constants.measurement import EXPERIMENT, IMAGE, AGG_MEAN, AGG_MEDIAN, AGG_STD_DEV, C_URL, C_PATH_NAME, C_FILE_NAME, NEIGHBORS, R_FIRST_IMAGE_NUMBER, R_SECOND_IMAGE_NUMBER, R_FIRST_OBJECT_NUMBER, R_SECOND_OBJECT_NUMBER
  from cellprofiler_core.constants.module import IO_FOLDER_CHOICE_HELP_TEXT, IO_WITH_METADATA_HELP_TEXT, USING_METADATA_HELP_REF, USING_METADATA_TAGS_REF
  from cellprofiler_core.constants.pipeline import EXIT_STATUS
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import ABSOLUTE_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_INPUT_SUBFOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_FOLDER_NAME
  from cellprofiler_core.preferences import DEFAULT_OUTPUT_SUBFOLDER_NAME
  from cellprofiler_core.preferences import get_headless
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import Measurement
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.choice import CustomChoice, Choice
  from cellprofiler_core.setting.do_something import DoSomething, RemoveSettingButton
  from cellprofiler_core.setting.multichoice import MeasurementMultiChoice
  from cellprofiler_core.setting.subscriber import ImageSubscriber, LabelSubscriber
  from cellprofiler_core.setting.text import Directory, Text
  from cellprofiler_core.utilities.core.modules.load_data import is_file_name_feature, is_path_name_feature
  from cellprofiler_core.utilities.measurement import find_metadata_tokens, get_agg_measurement_name
  from cellprofiler.gui.help.content import MEASUREMENT_NAMING_HELP
label_desc: Use image node_id 31 for calling the ExportToSpreadsheet obj's underlying member method code with example usage: obj.upgrade_settings(setting_values, variable_revision_number, module_name) and returns: setting_values,  variable_revision_number