Return a new tree with value associated at index.
339781
def assoc(self, index, value):
        ''''''
        newnode = LookupTreeNode(index, value)
        newtree = LookupTree()
        newtree.root = _assoc_down(self.root, newnode, 0)
        return newtree
1268143
def get(index)
      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?
          return node.values[index]
        else
          # Descend into the right child node to add the value to.
          cidx = (node.offsets.bsearch_index { |o| o > index } ||
                  node.offsets.length) - 1
          if (index -= node.offsets[cidx]) < 0
            node.fatal "Index (#{index}) became negative"
          end
          node = node.children[cidx]
        end
      end

      PEROBS.log.fatal "Could not find proper node to get from while " +
        "looking for index #{index}"
    end
942475
def _add_to_index(index, obj):
    """"""
    id_set = index.value_map.setdefault(indexed_value(index, obj), set())
    if index.unique:
        if len(id_set) > 0:
            raise UniqueConstraintError()
    id_set.add(obj.id)
533144
def assoc(self, index, value):
        ''''''
        newvec = ImmutableVector()
        newvec.tree = self.tree.assoc(index, value)
        if index >= self._length:
            newvec._length = index+1
        else:
            newvec._length = self._length
        return newvec
910631
def parent(self, index):
        

        if not index.isValid():
            return QModelIndex()

        node = self.get_node(index)
        parent_node = node.parent
        if not parent_node:
            return QModelIndex()

        if parent_node == self.__root_node:
            return QModelIndex()

        row = parent_node.row()
        return self.createIndex(row, 0, parent_node) if row is not None else QModelIndex()
103987
def visit_Index(self, node: ast.Index) -> Any:
        """"""
        result = self.visit(node=node.value)

        self.recomputed_values[node] = result
        return result
12969
private Object fleeceValueToObject(int index) {
        check(index);
        final FLValue value = values.get(index);
        if (value == null) { return null; }
        final MRoot root = new MRoot(context, value, false);
        synchronized (rs.getQuery().getDatabase().getLock()) {
            return root.asNative();
        }
    }
1056162
def _create_tree(self, endpoint=None, index=0):
        
        tab = ''  # '\t' * index
        ret = ''
        if endpoint:
            name = endpoint.path.split('.', 1)[1].replace('.', '/') + '/'
            ret += tab + name + '\n'
            ret += endpoint.method_calls(' ' * len(tab + name))
        else:
            endpoint = self

        for child_name in endpoint._endpoints:
            child = getattr(endpoint, child_name, None)
            if child:
                ret += self._create_tree(child, index + 1)
        return ret
1138886
def etree(self, data, root=None):
        ''''''
        result = self.list() if root is None else root
        if isinstance(data, (self.dict, dict)):
            for key, value in data.items():
                if isinstance(value, (self.dict, dict)):
                    elem = self.element(key)
                    if elem is None:
                        continue
                    result.append(elem)

                    if 'attributes' in value:
                        for k, v in value['attributes'].items():
                            elem.set(k, self._tostring(v))
                    # else:
                    #     raise ValueError('Cobra requires "attributes" key for each element')

                    if 'children' in value:
                        for v in value['children']:
                            self.etree(v, root=elem)
                else:
                    elem = self.element(key)
                    if elem is None:
                        continue
                    elem.text = self._tostring(value)
                    result.append(elem)
        else:
            if root is not None:
                root.text = self._tostring(data)
            else:
                elem = self.element(self._tostring(data))
                if elem is not None:
                    result.append(elem)

        return result
778970
public void buildTree(INDArray x) {
        this.X = x;
        for(int i = 0; i < x.rows(); i++) {
            root.getIndices().add(i);
        }



        RPUtils.buildTree(this,root,rpHyperPlanes,
                x,maxSize,0,similarityFunction);
    }
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)
800472
def mutate(self, node, index):
        """"""
        assert index == 0
        assert isinstance(node, ForStmt)

        empty_list = parso.parse(' []')
        node.children[3] = empty_list
        return node
735935
def at(self, root):
        
        leafs = root.strip(" ").split('.')
        for leaf in leafs:
            if leaf:
                self._json_data = self.__get_value_from_data(leaf, self._json_data)
        return self
425559
def indexTupleFromItem(self, treeItem): # TODO: move to BaseTreeItem?
        
        if not treeItem:
            return (QtCore.QModelIndex(), QtCore.QModelIndex())

        if not treeItem.parentItem: # TODO: only necessary because of childNumber?
            return (QtCore.QModelIndex(), QtCore.QModelIndex())

        # Is there a bug in Qt in QStandardItemModel::indexFromItem?
        # It passes the parent in createIndex. TODO: investigate

        row =  treeItem.childNumber()
        return (self.createIndex(row, 0, treeItem),
                self.createIndex(row, self.columnCount() - 1, treeItem))
735838
def create_from(value):
        
        """
        def convert(val):
            if isinstance(val, tuple):
                return tuple(convert(v) for v in val)
            elif isinstance(val, list):
                return [convert(v) for v in val]
            elif isinstance(val, (dict, ElasticDict)):
                return ElasticDict({k: convert(v) for k, v in val.iteritems()})
            else:
                return val

        return convert(value)
662369
function() {
                var e, expressions = [];

                e = $(this.expression);
                while (e) {
                    expressions.push(e);
                    if (! $(',')) { break; }
                    e = $(this.expression);
                }

                if (expressions.length > 1) {
                    return new tree.Value(expressions.map(function(e) {
                        return e.value[0];
                    }));
                } else if (expressions.length === 1) {
                    return new tree.Value(expressions);
                }
            }
1077233
function getTree(root, deps) {
  var tree;

  tree = {};

  populateItem(tree, root, deps);

  return tree;
}