docstr: Modify the path passed so that it can be executed on the remote host
  
  path = path to modify
  regexp_substitution - if true, exclude \g<...> from substitution
docstr_tok: ["Modify","the","path","passed","so","that","it","can","be","executed","on","the","remote","host","path","=","path","to","modify","regexp_substitution","-","if","true",",","exclude","\\g","<","...",">","from","substitution"]
code: def alter_path(self, path, **varargs):
      """Modify the path passed so that it can be executed on the remote host
  
      path = path to modify
      regexp_substitution - if true, exclude \g<...> from substitution
      """
      regexp_substitution = varargs.get("regexp_substitution", False)
      for mapping in self.mappings:
          local_directory = mapping.local_directory.value
          remote_directory = mapping.remote_directory.value
          if regexp_substitution:
              local_directory = local_directory.replace("\\", "\\\\")
              remote_directory = remote_directory.replace("\\", "\\\\")
  
          if sys.platform.startswith("win"):
              # Windows is case-insensitive so do case-insensitive mapping
              if path.upper().startswith(local_directory.upper()):
                  path = remote_directory + path[len(local_directory) :]
          else:
              if path.startswith(local_directory):
                  path = remote_directory + path[len(local_directory) :]
      if self.remote_host_is_windows.value:
          path = path.replace("/", "\\")
      elif regexp_substitution:
          path = re.subn("\\\\\\\\", "/", path)[0]
          path = re.subn("\\\\(?!g<[^>]*>)", "/", path)[0]
      else:
          path = path.replace("\\", "/")
      return path
  
imports: import logging
  import os
  import re
  import sys
  import zlib
  import numpy
  from cellprofiler_core.constants.measurement import F_BATCH_DATA_H5
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.pipeline import Pipeline
  from cellprofiler_core.preferences import get_absolute_path
  from cellprofiler_core.preferences import get_default_image_directory
  from cellprofiler_core.preferences import get_default_output_directory
  from cellprofiler_core.preferences import get_headless
  from cellprofiler_core.preferences import set_default_image_directory
  from cellprofiler_core.preferences import set_default_output_directory
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import Divider
  from cellprofiler_core.setting import Setting
  from cellprofiler_core.setting import SettingsGroup
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.do_something import DoSomething
  from cellprofiler_core.setting.do_something import RemoveSettingButton
  from cellprofiler_core.setting.text import Text, Integer
  from cellprofiler_core.workspace import Workspace
  import cellprofiler
label_desc: Use image node_id 18 for calling the CreateBatchFiles obj's underlying member method code with example usage: obj.alter_path(path) and returns: path