original_docstring: Validate and if necessary uniquify name
  
      Args:
          data (dict): what to validate
          data_files(list): simulation files already in the folder
      
docstring: Validate and if necessary uniquify name
docstring_tokens: Validate and if necessary uniquify name
code: def validate_name(data, data_files, max_copies):
      """Validate and if necessary uniquify name
  
      Args:
          data (dict): what to validate
          data_files(list): simulation files already in the folder
      """
      s = data.models.simulation
      sim_id = s.simulationId
      n = s.name
      f = s.folder
      starts_with = pkcollections.Dict()
      for d in data_files:
          n2 = d.models.simulation.name
          if n2.startswith(n) and d.models.simulation.simulationId != sim_id:
              starts_with[n2] = d.models.simulation.simulationId
      i = 2
      n2 = data.models.simulation.name
      while n2 in starts_with:
          n2 = '{} {}'.format(data.models.simulation.name, i)
          i += 1
      assert i - 1 <= max_copies, util.err(n, 'Too many copies: {} > {}', i - 1, max_copies)
      data.models.simulation.name = n2
code_tokens: def validate_name ( data , data_files , max_copies ) : s = data . models . simulation sim_id = s . simulationId n = s . name f = s . folder starts_with = pkcollections . Dict ( ) for d in data_files : n2 = d . models . simulation . name if n2 . startswith ( n ) and d . models . simulation . simulationId != sim_id : starts_with [ n2 ] = d . models . simulation . simulationId i = 2 n2 = data . models . simulation . name while n2 in starts_with : n2 = '{} {}' . format ( data . models . simulation . name , i ) i += 1 assert i - 1 <= max_copies , util . err ( n , 'Too many copies: {} > {}' , i - 1 , max_copies ) data . models . simulation . name = n2
short_docstring: Validate and if necessary uniquify name
short_docstring_tokens: Validate and if necessary uniquify name
comment: """Validate and if necessary uniquify name
  
      Args:
          data (dict): what to validate
          data_files(list): simulation files already in the folder
      """