Make a variable name unique by appending a number if needed.
177741
def unique(self, name):
    """"""
    # Make sure the name is valid
    name = self.valid(name)
    # Make sure it's not too long
    name = self.trim(name)
    # Now make sure it's unique
    unique_name = name
    i = 2
    while unique_name in self.names:
      unique_name = name + str(i)
      i += 1
    self.names.add(unique_name)
    return unique_name
1200402
def constant(self, name, value):
        """"""
        assert is_iterable_typed(name, basestring)
        assert is_iterable_typed(value, basestring)
        self.registry.current().add_constant(name[0], value)
1037907
function replaceValuesWithVariableNames (variables, prefix) {
  const map = {}

  Object.keys(variables || {}).forEach((variableName) => {
    map[variableName] = `var(${formatVariableName(variableName, prefix)})`
  })

  return map
}
982862
def unique_string(length=UUID_LENGTH):
    ''''''
    # We need a string at least as long as length
    string = str(uuid4()) * int(math.ceil(length / float(UUID_LENGTH)))
    return string[:length] if length else string
83070
def p_variable(self, p):
        """"""
        p[0] = [_Segment(_BINDING, p[2])]
        if len(p) > 4:
            p[0].extend(p[4])
        else:
            p[0].append(_Segment(_TERMINAL, '*'))
            self.segment_count += 1
        p[0].append(_Segment(_END_BINDING, ''))
618135
def add_input_variable(self, var):
        """"""
        assert(isinstance(var, Variable))
        self.input_variable_list.append(var)
818275
def make_varname(tree):
    
    if tree.tag == 'identifier':
        return tree.attrib['name']

    if tree.tag in ('string', 'boolean'):
        return tree.text

    if tree.tag == 'number':
        return tree.attrib['value']

    if tree.tag in ('property', 'object'):
        return make_varname(_xpath_one(tree, '*'))

    if tree.tag.endswith('accessor'):
        kind = tree.tag[:-len('accessor')]
        obj = make_varname(_xpath_one(tree, 'object'))
        prop = make_varname(_xpath_one(tree, 'property'))
        if kind == 'dot':
            fmt = '%s.%s'
        elif kind == 'bracket':
            fmt = '%s[%s]'
        else:
            raise ValueError("Unknown accessor: %s" % tree.tag)
        return fmt % (obj, prop)

    raise ValueError("Unknown tag: %s" % tree.tag)
723150
def declare_local_variable(self, raw_name, type=None, prepend=False):
        '''
        
        '''
        # Get unique ID for the new variable
        onnx_name = self.get_unique_variable_name(raw_name)

        # Create the variable
        variable = Variable(raw_name, onnx_name, self.name, type)
        self.variables[onnx_name] = variable

        if raw_name in self.variable_name_mapping:
            # Hide existing variables with the same raw_name
            if not prepend:
                self.variable_name_mapping[raw_name].append(onnx_name)
            else:
                self.variable_name_mapping[raw_name].insert(0, onnx_name)
        else:
            self.variable_name_mapping[raw_name] = [onnx_name]
        return variable
820328
def uniqueName(self, name):
        
        try:
            suffix = self.name_suffixes[name]
        except KeyError:
            self.name_suffixes[name] = 0
            return name

        suffix += 1
        self.name_suffixes[name] = suffix

        return "%s%i" % (name, suffix)
1277695
def change_by(cls, name, num):
        """"""
        count = cls.count(name)
        if count + num < 0:
            raise CounterValueError('Counter[%s] will be negative '
                                    'after %+d.' % (name, num))

        counter = cls.collection.find_and_modify(
            {'name': name},
            {'$inc': {'seq': num}},
            new=True,
            upsert=True
        )
        return counter['seq']
593520
def unique_append(self, value):
    
    if value not in self:
        try:
            super(self.__class__, self).append(Uri(value))
        except AttributeError as err:
            if isinstance(value, MODULE.rdfclass.RdfClassBase):
                super(self.__class__, self).append(value)
            else:
                raise err
1012284
def __set_name(self, value):
        '''
        
        '''
        if not value or not len(value):
            raise ValueError("Invalid name.")

        self.__name = value
769361
def _unique_name(name, seen):
        """"""
        if name in seen:
            n = seen[name]
            while (name + ".%d" % n) in seen:
                n += 1
            seen[name] = n + 1
            name += ".%d" % n
        seen[name] = 1
        return name
827085
function makeTempVariableName(flags) {
                if (flags && !(tempFlags & flags)) {
                    var name_24 = flags === 268435456 /* _i */ ? "_i" : "_n";
                    if (isUniqueName(name_24)) {
                        tempFlags |= flags;
                        return name_24;
                    }
                }
                while (true) {
                    var count = tempFlags & 268435455 /* CountMask */;
                    tempFlags++;
                    // Skip over 'i' and 'n'
                    if (count !== 8 && count !== 13) {
                        var name_25 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26);
                        if (isUniqueName(name_25)) {
                            return name_25;
                        }
                    }
                }
            }
15499
function uniqueAdd(val, arr) {
  if(arr.indexOf(val)===-1){
    arr.push(val);
  }
  return arr;
}
754321
def Name(self, number):
    """"""
    if number in self._enum_type.values_by_number:
      return self._enum_type.values_by_number[number].name
    raise ValueError('Enum %s has no name defined for value %d' % (
        self._enum_type.name, number))
557046
def fix_var_name(var_name):
    """"""
    name = var_name.strip()
    for char in '(). /#,':
        name = name.replace(char, '_')
    name = name.replace('+', 'pos_')
    name = name.replace('-', 'neg_')
    if name.endswith('_'):
        name = name[:-1]
    return name