Append values to existing construction variables
        in an Environment, if they're not already there.
        If delete_existing is 1, removes existing values first, so
        values move to end.
12217
def AppendUnique(self, delete_existing=0, **kw):
        
        kw = copy_non_reserved_keywords(kw)
        for key, val in kw.items():
            if SCons.Util.is_List(val):
                val = _delete_duplicates(val, delete_existing)
            if key not in self._dict or self._dict[key] in ('', None):
                self._dict[key] = val
            elif SCons.Util.is_Dict(self._dict[key]) and \
                 SCons.Util.is_Dict(val):
                self._dict[key].update(val)
            elif SCons.Util.is_List(val):
                dk = self._dict[key]
                if key == 'CPPDEFINES':
                    tmp = []
                    for i in val:
                        if SCons.Util.is_List(i):
                            if len(i) >= 2:
                                tmp.append((i[0], i[1]))
                            else:
                                tmp.append((i[0],))
                        elif SCons.Util.is_Tuple(i):
                            tmp.append(i)
                        else:
                            tmp.append((i,))
                    val = tmp
                    # Construct a list of (key, value) tuples.
                    if SCons.Util.is_Dict(dk):
                        tmp = []
                        for (k, v) in dk.items():
                            if v is not None:
                                tmp.append((k, v))
                            else:
                                tmp.append((k,))
                        dk = tmp
                    elif SCons.Util.is_String(dk):
                        dk = [(dk,)]
                    else:
                        tmp = []
                        for i in dk:
                            if SCons.Util.is_List(i):
                                if len(i) >= 2:
                                    tmp.append((i[0], i[1]))
                                else:
                                    tmp.append((i[0],))
                            elif SCons.Util.is_Tuple(i):
                                tmp.append(i)
                            else:
                                tmp.append((i,))
                        dk = tmp
                else:
                    if not SCons.Util.is_List(dk):
                        dk = [dk]
                if delete_existing:
                    dk = [x for x in dk if x not in val]
                else:
                    val = [x for x in val if x not in dk]
                self._dict[key] = dk + val
            else:
                dk = self._dict[key]
                if SCons.Util.is_List(dk):
                    if key == 'CPPDEFINES':
                        tmp = []
                        for i in dk:
                            if SCons.Util.is_List(i):
                                if len(i) >= 2:
                                    tmp.append((i[0], i[1]))
                                else:
                                    tmp.append((i[0],))
                            elif SCons.Util.is_Tuple(i):
                                tmp.append(i)
                            else:
                                tmp.append((i,))
                        dk = tmp
                        # Construct a list of (key, value) tuples.
                        if SCons.Util.is_Dict(val):
                            tmp = []
                            for (k, v) in val.items():
                                if v is not None:
                                    tmp.append((k, v))
                                else:
                                    tmp.append((k,))
                            val = tmp
                        elif SCons.Util.is_String(val):
                            val = [(val,)]
                        if delete_existing:
                            dk = list(filter(lambda x, val=val: x not in val, dk))
                            self._dict[key] = dk + val
                        else:
                            dk = [x for x in dk if x not in val]
                            self._dict[key] = dk + val
                    else:
                        # By elimination, val is not a list.  Since dk is a
                        # list, wrap val in a list first.
                        if delete_existing:
                            dk = list(filter(lambda x, val=val: x not in val, dk))
                            self._dict[key] = dk + [val]
                        else:
                            if not val in dk:
                                self._dict[key] = dk + [val]
                else:
                    if key == 'CPPDEFINES':
                        if SCons.Util.is_String(dk):
                            dk = [dk]
                        elif SCons.Util.is_Dict(dk):
                            tmp = []
                            for (k, v) in dk.items():
                                if v is not None:
                                    tmp.append((k, v))
                                else:
                                    tmp.append((k,))
                            dk = tmp
                        if SCons.Util.is_String(val):
                            if val in dk:
                                val = []
                            else:
                                val = [val]
                        elif SCons.Util.is_Dict(val):
                            tmp = []
                            for i,j in val.items():
                                if j is not None:
                                    tmp.append((i,j))
                                else:
                                    tmp.append(i)
                            val = tmp
                    if delete_existing:
                        dk = [x for x in dk if x not in val]
                    self._dict[key] = dk + val
        self.scanner_map_delete(kw)
95865
public void append(int key, long value) {
        if (mSize != 0 && key <= mKeys[mSize - 1]) {
            put(key, value);
            return;
        }

        int pos = mSize;
        if (pos >= mKeys.length) {
            growKeyAndValueArrays(pos + 1);
        }

        mKeys[pos] = key;
        mValues[pos] = value;
        mSize = pos + 1;
    }
1224776
private void makeIncoming() {
        if (stays == null && move == null) {
            for (BitSet in : ins) {
                in.clear();
            }
            stays = new BitSet();
            move = new BitSet();
            for (int i = 0; i < hosts.length; i++) {
                if (hosts[i] != null && hosts[i].isInstantiated()) {
                    int newPos = hosts[i].getValue();
                    if (oldPos[i] != -1 && newPos != oldPos[i]) {
                        //The VM has move
                        ins[newPos].set(i);
                        move.set(i);
                    } else if (newPos == oldPos[i]) {
                        stays.set(i);
                    }
                }
            }
        }
    }
1156415
def note_addition(self, key, value):
        
        # If we're adding a field we previously deleted, remove the deleted note.
        if key in self._deleted:
            # If the key we're adding back has a different value, then it's a change
            if value != self._deleted[key]:
                self._previous[key] = self._deleted[key]
            del self._deleted[key]
        else:
            self._added.append(key)
331914
def Update(self, env, args=None):
        

        values = {}

        # first set the defaults:
        for option in self.options:
            if not option.default is None:
                values[option.key] = option.default

        # next set the value specified in the options file
        for filename in self.files:
            if os.path.exists(filename):
                dir = os.path.split(os.path.abspath(filename))[0]
                if dir:
                    sys.path.insert(0, dir)
                try:
                    values['__name__'] = filename
                    with open(filename, 'r') as f:
                        contents = f.read()
                    exec(contents, {}, values)
                finally:
                    if dir:
                        del sys.path[0]
                    del values['__name__']

        # set the values specified on the command line
        if args is None:
            args = self.args

        for arg, value in args.items():
            added = False
            for option in self.options:
                if arg in list(option.aliases) + [ option.key ]:
                    values[option.key] = value
                    added = True
            if not added:
                self.unknown[arg] = value

        # put the variables in the environment:
        # (don't copy over variables that are not declared as options)
        for option in self.options:
            try:
                env[option.key] = values[option.key]
            except KeyError:
                pass

        # Call the convert functions:
        for option in self.options:
            if option.converter and option.key in values:
                value = env.subst('${%s}'%option.key)
                try:
                    try:
                        env[option.key] = option.converter(value)
                    except TypeError:
                        env[option.key] = option.converter(value, env)
                except ValueError as x:
                    raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x))


        # Finally validate the values:
        for option in self.options:
            if option.validator and option.key in values:
                option.validator(option.key, env.subst('${%s}'%option.key), env)
1354773
function replaceEnv(node, state, value) {
        utils.catchup(node.range[0], state);
        utils.append(JSON.stringify(value), state);
        utils.move(node.range[1], state);
    }
113546
private void appendValueLength(int value, int index) {
    int previousValue = toIntUnsigned(getValue(index));
    int length = toIntUnsigned(getLength(index));
    int offset = value - previousValue;
    if (offset > length) {
      setLength(index, (short) offset);
    }
  }
301297
def __append_list(append_to, value):
    """"""
    if value is not None:
        if isinstance(value, list):
            append_to.extend(value)
        else:
            append_to.append(value)
1009983
def _append_value(self, v_values, next_value, v_idx=None, n_vals=1):
        """"""
        for _ in range(n_vals):
            if v_idx:
                try:
                    v_i = next(v_idx)
                except StopIteration:
                    # Repeating commas are null-statements and can be ignored
                    # Otherwise, we warn the user that this is a bad namelist
                    if next_value is not None:
                        warnings.warn('f90nml: warning: Value {0} is not assigned to '
                              'any variable and has been removed.'
                              ''.format(next_value))

                    # There are more values than indices, so we stop here
                    break

                v_s = [self.default_start_index if idx is None else idx
                       for idx in v_idx.first]

                if not self.row_major:
                    v_i = v_i[::-1]
                    v_s = v_s[::-1]

                # Multidimensional arrays
                if not self.sparse_arrays:
                    pad_array(v_values, list(zip(v_i, v_s)))

                # We iterate inside the v_values and inspect successively
                # deeper lists within the list tree.  If the requested index is
                # missing, we re-size that particular entry.
                # (NOTE: This is unnecessary when sparse_arrays is disabled.)

                v_subval = v_values
                for (i_v, i_s) in zip(v_i[:-1], v_s[:-1]):
                    try:
                        v_subval = v_subval[i_v - i_s]
                    except IndexError:
                        size = len(v_subval)
                        v_subval.extend([] for _ in range(size, i_v - i_s + 1))
                        v_subval = v_subval[i_v - i_s]

                # On the deepest level, we explicitly assign the value
                i_v, i_s = v_i[-1], v_s[-1]
                try:
                    v_subval[i_v - i_s] = next_value
                except IndexError:
                    size = len(v_subval)
                    v_subval.extend(None for _ in range(size, i_v - i_s + 1))
                    v_subval[i_v - i_s] = next_value
            else:
                v_values.append(next_value)
537877
private void append(final KeyValue column, 
                      final boolean is_count, 
                      final boolean strip_string) {
    // for now assume we properly allocated our qualifiers
    if (is_count) {
      int offset = strip_string ? 
          Internal.getOffsetFromQualifier(column.qualifier(), 
          RollupQuery.COUNT.length + 1) :
            Internal.getOffsetFromQualifier(column.qualifier(), 
                1);
      if (last_count_offset > -1 && offset <= last_count_offset) {
        // only accept equivalent offsets. If somehow we get an earlier one, HBase is broke 
        if (offset == last_count_offset && tsdb.getConfig().fix_duplicates()) {
          if (column.timestamp() < last_count_ts) {
            if (LOG.isDebugEnabled()) {
              LOG.debug("Skipping older duplicate count value for " + column 
              + " of " + offset + " which is = the last offset " + last_count_offset
              + " for " + this);
            }
            return;
          } else { // if it's equal, just use the one we got first
            // roll back the indices
            indices[2] -= 2;
            indices[3] -= Internal.getValueLengthFromQualifier(
                count_qualifiers, indices[2]);
            if (LOG.isDebugEnabled()) {
              LOG.debug("Replacing older duplicate count with " + column 
              + " of " + offset + " which is = the last offset " + last_count_offset
              + " for " + this);
            }
          }
        } else {
          throw new IllegalArgumentException("The count offset for " + column 
              + " of " + offset + " is <= the last offset " + last_count_offset
              + " for " + this);
        }
      }
      last_count_offset = offset;
      last_count_ts = column.timestamp();
      if (strip_string) {
        System.arraycopy(column.qualifier(), RollupQuery.COUNT.length + 1, 
            count_qualifiers, indices[2], 2);
      } else {
        System.arraycopy(column.qualifier(), 1, count_qualifiers, indices[2], 2);
      }
      indices[2] += 2;
      
      if (indices[3] + column.value().length > count_values.length) {
        byte[] buf = new byte[count_values.length * 2];
        System.arraycopy(count_values, 0, buf, 0, count_values.length);
        count_values = buf;
      }
      System.arraycopy(column.value(), 0, count_values, indices[3], 
          column.value().length);
      indices[3] += column.value().length;
    } else {
      int offset = strip_string ? 
          Internal.getOffsetFromQualifier(column.qualifier(), 
              rollup_query.getRollupAggPrefix().length)
          : Internal.getOffsetFromQualifier(column.qualifier(), 1);
      if (last_offset > -1 && offset <= last_offset) {
        // only accept equivalent offsets. If somehow we get an earlier one, HBase is broke
        if (offset == last_offset && tsdb.getConfig().fix_duplicates()) {
          if (column.timestamp() < last_value_ts) {
            if (LOG.isDebugEnabled()) {
              LOG.debug("Skipping older duplicate value for " + column 
              + " of " + offset + " which is = the last offset " + last_count_offset
              + " for " + this);
            }
            return;
          } else { // if it's equal, just use the one we got first
            // roll back the indices
            indices[0] -= 2;
            indices[1] -= Internal.getValueLengthFromQualifier(qualifiers, indices[0]);
            if (LOG.isDebugEnabled()) {
              LOG.debug("Replacing older duplicate value with " + column 
              + " of " + offset + " is = the last offset " + last_count_offset
              + " for " + this);
            }
          }
        } else {
          throw new IllegalDataException("The offset for " + column 
              + " of " + offset + " is <= the last offset " + last_offset
              + " for " + this);
        }
      }
      last_offset = offset;
      last_value_ts = column.timestamp();
      if (strip_string) {
        System.arraycopy(column.qualifier(), 
            rollup_query.getRollupAggPrefix().length, qualifiers, indices[0], 2);
      } else {
        System.arraycopy(column.qualifier(), 1, qualifiers, indices[0], 2);
      }
      indices[0] += 2;
      
      if (indices[1] + column.value().length > values.length) {
        byte[] buf = new byte[values.length * 2];
        System.arraycopy(values, 0, buf, 0, values.length);
        values = buf;
      }
      System.arraycopy(column.value(), 0, values, indices[1], 
          column.value().length);
      indices[1] += column.value().length;
    }
  }
1305302
def remove_provenance_project_variables():
    """"""
    project_context_scope = QgsExpressionContextUtils.projectScope(
        QgsProject.instance())
    existing_variable_names = project_context_scope.variableNames()

    # Save the existing variables that's not provenance variable.
    existing_variables = {}
    for existing_variable_name in existing_variable_names:
        existing_variables[existing_variable_name] = \
            project_context_scope.variable(existing_variable_name)
    for the_provenance in provenance_list:
        if the_provenance['provenance_key'] in existing_variables:
            existing_variables.pop(the_provenance['provenance_key'])

    # Removing generated key from dictionary (e.g.
    # action_checklist__0__item_list__0)
    will_be_removed = []
    for existing_variable in existing_variables:
        for the_provenance in provenance_list:
            if existing_variable.startswith(
                    the_provenance['provenance_key']):
                will_be_removed.append(existing_variable)
                continue
    for variable in will_be_removed:
        existing_variables.pop(variable)

    # Need to change to None, to be able to store it back.
    non_null_existing_variables = {}
    for k, v in list(existing_variables.items()):
        if v is None or (hasattr(v, 'isNull') and v.isNull()):
            non_null_existing_variables[k] = None
        else:
            non_null_existing_variables[k] = v

    # This method will set non_null_existing_variables, and remove the
    # other variable
    QgsExpressionContextUtils.setProjectVariables(
        QgsProject.instance(),
        non_null_existing_variables)
846222
def insert(self, var, value, index=None):
        
        current = self.__get(var)
        if not isinstance(current, list):
            raise KeyError("%s: is not a list" % var)
        if index is None:
            current.append(value)
        else:
            current.insert(index, value)
        if self.auto_save:
            self.save()
450335
def append(self, value):
        
        if self._avm is not None and not self.terminated:
            path = self._last_path
            if path:
                path += '.'
            self[path + LIST_HEAD] = value
            self._last_path = path + LIST_TAIL
            self[self._last_path] = AVM()
        else:
            raise TdlError('Cannot append to a closed list.')
1315064
def append(self, value):
    """"""
    self._values.append(self._type_checker.CheckValue(value))
    if not self._message_listener.dirty:
      self._message_listener.Modified()
836123
def prepend_model(self, value, model):
        
        if '.' not in value:
            direction = ''
            if value.startswith('-'):
                value = value[1:]
                direction = '-'
            value = '%s%s.%s' % (direction, model, value)
        return value
1301401
def _assign_values_to_unbound_vars(unbound_vars, unbound_var_values):
  """"""
  context = {}
  for key, value in six.iteritems(unbound_var_values):
    if key not in unbound_vars:
      raise ValueError('unexpected key: %s. Legal values are: %s' %
                       (key, list(six.iterkeys(unbound_vars))))
    context[unbound_vars[key]] = value
  unspecified = []
  for unbound_var in six.itervalues(unbound_vars):
    if unbound_var not in context:
      if unbound_var.has_default():
        context[unbound_var] = unbound_var.default
      else:
        unspecified.append(unbound_var.key)
  if unspecified:
    raise ValueError('Unspecified keys: %s' % unspecified)
  return context
40550
def __add_variables(self, *args, **kwargs):
        

        for variable in args:
            self.__variables[variable] = None
        self.__variables.update(kwargs)