parameters: (s, id_set)
docstring: Some parts of .wxs need an Id attribute (for example: The File and
      Directory directives. The charset is limited to A-Z, a-z, digits,
      underscores, periods. Each Id must begin with a letter or with a
      underscore. Google for "CNDL0015" for information about this.
  
      Requirements:
       * the string created must only contain chars from the target charset.
       * the string created must have a minimal editing distance from the
         original string.
       * the string created must be unique for the whole .wxs file.
  
      Observation:
       * There are 62 chars in the charset.
  
      Idea:
       * filter out forbidden characters. Check for a collision with the help
         of the id_set. Add the number of the number of the collision at the
         end of the created string. Furthermore care for a correct start of
         the string.
docstring_summary: Some parts of .wxs need an Id attribute (for example: The File and
      Directory directives. The charset is limited to A-Z, a-z, digits,
      underscores, periods. Each Id must begin with a letter or with a
      underscore. Google for "CNDL0015" for information about this.
docstring_tokens: Some parts of . wxs need an Id attribute ( for example : The File and Directory directives . The charset is limited to A - Z a - z digits underscores periods . Each Id must begin with a letter or with a underscore . Google for CNDL0015 for information about this .
function: def convert_to_id(s, id_set):
      """ Some parts of .wxs need an Id attribute (for example: The File and
      Directory directives. The charset is limited to A-Z, a-z, digits,
      underscores, periods. Each Id must begin with a letter or with a
      underscore. Google for "CNDL0015" for information about this.
  
      Requirements:
       * the string created must only contain chars from the target charset.
       * the string created must have a minimal editing distance from the
         original string.
       * the string created must be unique for the whole .wxs file.
  
      Observation:
       * There are 62 chars in the charset.
  
      Idea:
       * filter out forbidden characters. Check for a collision with the help
         of the id_set. Add the number of the number of the collision at the
         end of the created string. Furthermore care for a correct start of
         the string.
      """
      charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.'
      if s[0] in '0123456789.':
          s = '_' + s
      id = ''.join([c for c in s if c in charset])
  
      # did we already generate an id for this file?
      try:
          return id_set[id][s]
      except KeyError:
          # no we did not, so initialize with the id
          if id not in id_set: id_set[id] = { s : id }
          # there is a collision, generate an id which is unique by appending
          # the collision number
          else: id_set[id][s] = id + str(len(id_set[id]))
  
          return id_set[id][s]
function_tokens: def convert_to_id ( s , id_set ) : charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.' if s [ 0 ] in '0123456789.' : s = '_' + s id = '' . join ( [ c for c in s if c in charset ] ) # did we already generate an id for this file? try : return id_set [ id ] [ s ] except KeyError : # no we did not, so initialize with the id if id not in id_set : id_set [ id ] = { s : id } # there is a collision, generate an id which is unique by appending # the collision number else : id_set [ id ] [ s ] = id + str ( len ( id_set [ id ] ) ) return id_set [ id ] [ s ]