Bulk index a list of objects.
516792
def index_objects(self, objects, index="default"):
        """"""
        if not objects:
            return

        index_name = index
        index = self.app_state.indexes[index_name]
        indexed = set()

        with index.writer() as writer:
            for obj in objects:
                document = self.get_document(obj)
                if document is None:
                    continue

                object_key = document["object_key"]
                if object_key in indexed:
                    continue

                writer.delete_by_term("object_key", object_key)
                try:
                    writer.add_document(**document)
                except ValueError:
                    # logger is here to give us more infos in order to catch a weird bug
                    # that happens regularly on CI but is not reliably
                    # reproductible.
                    logger.error("writer.add_document(%r)", document, exc_info=True)
                    raise
                indexed.add(object_key)
1673
def _add_to_bulk(self, bulkobj):
        """"""
        bulkobj.add_update(self._filter, self._doc, False, self._upsert,
                           collation=self._collation)
1180253
def get_bulk(self, create=False):
        """"""
        result = []
        op_type = "index"
        if create:
            op_type = "create"
        meta = self._meta
        cmd = {op_type: {"_index": meta.index, "_type": meta.type}}
        if meta.parent:
            cmd[op_type]['_parent'] = meta.parent
        if meta.version:
            cmd[op_type]['_version'] = meta.version
        if meta.id:
            cmd[op_type]['_id'] = meta.id
        result.append(json.dumps(cmd, cls=self._meta.connection.encoder))
        result.append("\n")
        result.append(json.dumps(self, cls=self._meta.connection.encoder))
        result.append("\n")
        return ''.join(result)
281372
public void bulkLoad(DBIDs ids) {
    if(ids.size() == 0) {
      return;
    }
    assert (root == null) : "Tree already initialized.";
    DBIDIter it = ids.iter();
    DBID first = DBIDUtil.deref(it);
    // Compute distances to all neighbors:
    ModifiableDoubleDBIDList candidates = DBIDUtil.newDistanceDBIDList(ids.size() - 1);
    for(it.advance(); it.valid(); it.advance()) {
      candidates.add(distance(first, it), it);
    }
    root = bulkConstruct(first, Integer.MAX_VALUE, candidates);
  }
258330
def run_bulk(t, first, last, incr = 1)
                retry_until { DRMAA.run_bulk_jobs(t.ptr, first, last, incr) }
            end
246385
def _index_list_of_values(d, k):
    """"""
    v = d[k]
    if isinstance(v, list):
        return v
    return [v]
931527
function ( obj ) {
		var indexed = [];

		utility.iterate( obj, function ( v ) {
			indexed.push( v );
		});

		return indexed;
	}
866910
def process_lists(self):
        """"""
        for l1_idx, obj1 in enumerate(self.l1):
            for l2_idx, obj2 in enumerate(self.l2):
                if self.equal(obj1, obj2):
                    self.matches.add((l1_idx, l2_idx))
934023
def insert_many(cls, documents):
        """"""
        from mongoframes.queries import to_refs

        # Ensure all documents have been converted to frames
        frames = cls._ensure_frames(documents)

        # Send insert signal
        signal('insert').send(cls, frames=frames)

        # Prepare the documents to be inserted
        documents = [to_refs(f._document) for f in frames]

        # Bulk insert
        ids = cls.get_collection().insert_many(documents).inserted_ids

        # Apply the Ids to the frames
        for i, id in enumerate(ids):
            frames[i]._id = id

        # Send inserted signal
        signal('inserted').send(cls, frames=frames)

        return frames
1274813
def cli(obj):
    """"""
    for k, v in obj.items():
        if isinstance(v, list):
            v = ', '.join(v)
        click.echo('{:20}: {}'.format(k, v))
160748
def _format_list_objects(result):
    """"""

    all_keys = set()
    for item in result:
        all_keys = all_keys.union(item.keys())

    all_keys = sorted(all_keys)
    table = Table(all_keys)

    for item in result:
        values = []
        for key in all_keys:
            value = iter_to_table(item.get(key))
            values.append(value)

        table.add_row(values)

    return table
152120
private void indexDense(DBIDRef ref, V obj) {
    double len = 0.;
    for(int dim = 0, max = obj.getDimensionality(); dim < max; dim++) {
      final double val = obj.doubleValue(dim);
      if(val == 0. || val != val) {
        continue;
      }
      len += val * val;
      getOrCreateColumn(dim).add(val, ref);
    }
    length.put(ref, FastMath.sqrt(len));
  }
851913
def multi_bulk(self, args):
        '''
        '''
        return null_array if args is None else b''.join(self._pack(args))
591542
def dump_bulk(cls, parent=None, keep_ids=True):
        """"""

        cls = get_result_class(cls)

        # Because of fix_tree, this method assumes that the depth
        # and numchild properties in the nodes can be incorrect,
        # so no helper methods are used
        qset = cls._get_serializable_model().objects.all()
        if parent:
            qset = qset.filter(path__startswith=parent.path)
        ret, lnk = [], {}
        for pyobj in serializers.serialize('python', qset):
            # django's serializer stores the attributes in 'fields'
            fields = pyobj['fields']
            path = fields['path']
            depth = int(len(path) / cls.steplen)
            # this will be useless in load_bulk
            del fields['depth']
            del fields['path']
            del fields['numchild']
            if 'id' in fields:
                # this happens immediately after a load_bulk
                del fields['id']

            newobj = {'data': fields}
            if keep_ids:
                newobj['id'] = pyobj['pk']

            if (not parent and depth == 1) or\
               (parent and len(path) == len(parent.path)):
                ret.append(newobj)
            else:
                parentpath = cls._get_basepath(path, depth - 1)
                parentobj = lnk[parentpath]
                if 'children' not in parentobj:
                    parentobj['children'] = []
                parentobj['children'].append(newobj)
            lnk[path] = newobj
        return ret
1171367
function bulksDoc (docs, qs0, callback0) {
      const { opts, callback } = getCallback(qs0, callback0)
      return relax({
        db: dbName,
        path: '_bulk_docs',
        body: docs,
        method: 'POST',
        qs: opts
      }, callback)
    }
999631
def create_index(group, chunk_size, compression=None, compression_opts=None):
    """"""
    dtype = np.int64
    if chunk_size == 'auto':
        chunks = True
    else:
        chunks = (nb_per_chunk(np.dtype(dtype).itemsize, 1, chunk_size),)

    group.create_dataset(
        'index', (0,), dtype=dtype,
        chunks=chunks, maxshape=(None,),
        compression=compression, compression_opts=compression_opts)
579444
def _update_indexes_for_deleted_object(collection, obj):
    """"""
    for index in _db[collection].indexes.values():
        _remove_from_index(index, obj)