Sets data at *index* to *value* in underlying data structure

        See :qtdoc:`QAbstractItemModel<QAbstractItemModel.setData>`, 
        and :qtdoc:`subclassing<qabstractitemmodel.subclassing>`
553573
def setData(self, index, value, role):
        
        if role == QtCore.Qt.EditRole:
            if isinstance(value, QtCore.QVariant):
                value = value.toPyObject()
            if index.column() == 0:
                test = self._testmodel.test(index.row())
                test.setUserTag(str(value))
                return True
            if index.column() == 2:
                test = self._testmodel.test(index.row())
                test.setRepCount(value)
                return True
        return False
1202486
function lset(index, value) {
  if(index < 0) index = this._data.length + index;
  // command should validate the index
  if(index < 0 || index >= this._data.length) return null;
  this._data[index] = value;
}
512931
public void set(int index, double value) {
        checkIndex(index);

        IndexValue item = new IndexValue(index, 0);
        int valueIndex = Collections.binarySearch(values, item, comp);
        if (valueIndex >= 0 && value != 0d) {
            // Replace a currently existing item with a non zero value.
            values.get(valueIndex).value = value;
        } else if (value != 0d) {
            // Add a new cell item into this row.
            item.value = value;
            values.add((valueIndex + 1) * -1, item);
        } else if (valueIndex >= 0) {
            // Remove the value since it's now zero.
            values.remove(valueIndex);
        }
    }
1139303
def index(self, value):
		
		for i in xrange(len(self.parentNode)):
			if getattr(self.parentNode[i], self.Name) == value:
				return i
		raise ValueError(value)
701885
def value_index(idx)
      node = self
      while node.parent
        idx += node.parent.offsets[node.index_in_parent_node]
        node = node.parent
      end

      idx
    end
563448
@Override
    public void setValue(int attributeIndex, double d) {
        int index = locateIndex(attributeIndex);
        if (index(index) == attributeIndex) {
            this.attributeValues[index] = d;
        } else {
            // We need to add the value
        }
    }
686853
def set_index(data,col_index):
    
    if col_index in data:
        data=data.reset_index().set_index(col_index)
        if 'index' in data:
            del data['index']
        return data
    elif data.index.name==col_index:
        return data
    else:
        logging.error("something's wrong with the df")
        df2info(data)
891314
def setData(self, index, value, role=QtCore.Qt.UserRole):
        
        if role == QtCore.Qt.EditRole:
            if isinstance(value, QtCore.QVariant):
                value = value.toPyObject()
            elif isinstance(value, QtCore.QString):
                value = str(value)
            self.model.setVerifiedValue(index.row(), self._headers[index.column()], value)
            self.countChanged.emit()
        elif role == QtCore.Qt.UserRole:
            row = index.row()
            if row == -1:
                row = self.rowCount() -1
            self.model.overwriteParam(row, value)
        return True
815195
def add_value(self, value, index_point):
        """"""
        if index_point not in self.index:
            self.values.append(value)
            self.index.append(index_point)
981320
def setData(self, index, value, role=Qt.EditRole):
        """"""
        if not index.isValid() or self.readonly:
            return False
        i = index.row()
        j = index.column()
        value = from_qvariant(value, str)
        dtype = self._data.dtype.name
        if dtype == "bool":
            try:
                val = bool(float(value))
            except ValueError:
                val = value.lower() == "true"
        elif dtype.startswith("string") or dtype.startswith("bytes"):
            val = to_binary_string(value, 'utf8')
        elif dtype.startswith("unicode") or dtype.startswith("str"):
            val = to_text_string(value)
        else:
            if value.lower().startswith('e') or value.lower().endswith('e'):
                return False
            try:
                val = complex(value)
                if not val.imag:
                    val = val.real
            except ValueError as e:
                QMessageBox.critical(self.dialog, "Error",
                                     "Value error: %s" % str(e))
                return False
        try:
            self.test_array[0] = val  # will raise an Exception eventually
        except OverflowError as e:
            print("OverflowError: " + str(e))  # spyder: test-skip
            QMessageBox.critical(self.dialog, "Error",
                                 "Overflow error: %s" % str(e))
            return False

        # Add change to self.changes
        self.changes[(i, j)] = val
        self.dataChanged.emit(index, index)
        if not is_string(val):
            if val > self.vmax:
                self.vmax = val
            if val < self.vmin:
                self.vmin = val
        return True
1318197
def set_index(self, index):
        
        for df in self.get_DataFrame(data=True, with_population=False):
            df.index = index
159237
def setData(self, column, role, value):
        
        assert isinstance(column, int)
        assert isinstance(role, int)

        # make sure that the right row is selected, this is not always the case for checkboxes and
        # combo boxes because they are items on top of the tree structure
        if isinstance(value, (QtWidgets.QComboBox, QtWidgets.QCheckBox)):
            self.treeWidget().setCurrentItem(self)

        # if row 2 (editrole, value has been entered)
        if role == 2 and column == 1:

            if isinstance(value, str):
                value = self.cast_type(value) # cast into same type as valid values

            if isinstance(value, QtCore.QVariant):
                value = self.cast_type(value.toString())  # cast into same type as valid values

            if isinstance(value, QtWidgets.QComboBox):
                value = self.cast_type(value.currentText())

            if isinstance(value, QtWidgets.QCheckBox):
                value = bool(int(value.checkState()))  # checkState() gives 2 (True) and 0 (False)

            # save value in internal variable
            self.value = value

        elif column == 0:
            # labels should not be changed so we set it back
            value = self.name

        if value is None:
            value = self.value

        # 180327(asafira) --- why do we need to do the following lines? Why not just always call super or always
        # emitDataChanged()?
        if not isinstance(value, bool):
            super(B26QTreeItem, self).setData(column, role, value)

        else:
            self.emitDataChanged()
741492
def insert(self, index, value):
		
		if value in self:
			raise ValueError
		index = self._fix_neg_index(index)
		self._dict[value] = index
		for elem in self._list[index:]:
			self._dict[elem] += 1
		self._list.insert(index, value)
1356062
def setData(self, index, value, role=Qt.EditRole):
        """"""
        if not index.isValid():
            return False
        if index.column() < 3:
            return False
        value = display_to_value(value, self.get_value(index),
                                 ignore_errors=True)
        self.set_value(index, value)
        self.dataChanged.emit(index, index)
        return True
1103465
def set(index, value)
      node = self

      # Traverse the tree to find the right node to add or replace the value.
      while node do
        # Once we have reached a leaf node we can insert or replace the value.
        if node.is_leaf?
          if index >= node.values.size
            node.fatal "Set index (#{index}) larger than values array " +
              "(#{node.values.size})."
          end
          node.values[index] = value
          return
        else
          # Descend into the right child node to add the value to.
          cidx = node.search_child_index(index)
          index -= node.offsets[cidx]
          node = node.children[cidx]
        end
      end

      node.fatal "Could not find proper node to set the value while " +
        "looking for index #{index}"
    end
861717
def set_index(self, index):
        
        item = index.internalPointer()
        note = item.internal_data()
        self.content_lb.setText(note.content)
        self.created_dte.setDateTime(dt_to_qdatetime(note.date_created))
        self.updated_dte.setDateTime(dt_to_qdatetime(note.date_updated))
        self.username_lb.setText(note.user.username)
791135
def set_data(self, data):
        

        if not isinstance(data, basestring):
            raise ValueError("data must an instance of basestring")
        self._data = data
        self._current = 0