Take a previously assembled document and reassemble the given set of
        fields for it in place.
336985
def reassemble(cls, fields, document):
        
        for field_name in cls._instructions:
            if field_name in fields:
                maker = cls._instructions[field_name]
                with maker.target(document):
                    document[field_name] = maker()
617943
def update_doc(input, **params):
    
    PARAM_SOURCE = 'source'
    SOURCE_COL = 'src.col'
    SOURCE_FIELD = 'src.field'
    PARAM_RESULT = 'result'

    res = input[params.get(PARAM_RESULT)]
    for src in params.get(PARAM_SOURCE):
        res[src[SOURCE_FIELD]] = input[src[SOURCE_COL]][src[SOURCE_FIELD]]
    return res
665542
def copy_fields(layer, fields_to_copy):
    
    for field in fields_to_copy:

        index = layer.fields().lookupField(field)
        if index != -1:

            layer.startEditing()

            source_field = layer.fields().at(index)
            new_field = QgsField(source_field)
            new_field.setName(fields_to_copy[field])

            layer.addAttribute(new_field)

            new_index = layer.fields().lookupField(fields_to_copy[field])

            for feature in layer.getFeatures():
                attributes = feature.attributes()
                source_value = attributes[index]
                layer.changeAttributeValue(
                    feature.id(), new_index, source_value)

            layer.commitChanges()
            layer.updateFields()
1118092
function( documents ) {
    
    documents = this.map( documents )
    
    for( var key in documents ) {
      this.documents[ key ] = documents[ key ]
    }
    
  }
243873
def _remap_fields(cls, kwargs):
        """"""
        mapped = {}
        for key in kwargs:
            if key in cls._remap:
                mapped[cls._remap[key]] = kwargs[key]
            else:
                mapped[key] = kwargs[key]
        return mapped
138629
function model (doc, fields) {
    if (!(this instanceof model))
      return new model(doc, fields);
    Model.call(this, doc, fields);
  }
958227
def reload(self, **kwargs):
        """"""
        frame = self.one({'_id': self._id}, **kwargs)
        self._document = frame._document
713459
private Tuple3<ReadOnlyStyledDocument<PS, SEG, S>, RichTextChange<PS, SEG, S>, MaterializedListModification<Paragraph<PS, SEG, S>>> replace(
            BiIndex start, BiIndex end, UnaryOperator<ReadOnlyStyledDocument<PS, SEG, S>> f) {
        int pos = tree.getSummaryBetween(0, start.major).map(s -> s.length() + 1).orElse(0) + start.minor;

        List<Paragraph<PS, SEG, S>> removedPars =
                getParagraphs().subList(start.major, end.major + 1);

        return end.map(this::split).map((l0, r) -> {
            return start.map(l0::split).map((l, removed) -> {
                ReadOnlyStyledDocument<PS, SEG, S> replacement = f.apply(removed);
                ReadOnlyStyledDocument<PS, SEG, S> doc = l.concatR(replacement).concat(r);
                RichTextChange<PS, SEG, S> change = new RichTextChange<>(pos, removed, replacement);
                List<Paragraph<PS, SEG, S>> addedPars = doc.getParagraphs().subList(start.major, start.major + replacement.getParagraphCount());
                MaterializedListModification<Paragraph<PS, SEG, S>> parChange =
                        MaterializedListModification.create(start.major, removedPars, addedPars);
                return t(doc, change, parChange);
            });
        });
    }
1241133
private Map<String, Object> toFieldsMap(Map<String, DocumentField> fields) {
		Map<String, Object> result = new HashMap<>();
		for (Entry<String, DocumentField> entry : fields.entrySet()) {
			if (entry.getValue().getValues().size() > 1) {
				result.put(entry.getKey(), entry.getValue().getValues());
			} else {
				result.put(entry.getKey(), entry.getValue().getValue());
			}

		}
		return result;
	}
1238899
def prepare_full_update(model)
      document = document_for_full_update(model)
      setup = setup_for_object(model)
      if boost = setup.document_boost_for(model)
        document.attrs[:boost] = boost
      end
      setup.all_field_factories.each do |field_factory|
        field_factory.populate_document(document, model)
      end
      document
    end
28668
def process_fields(self, fields):
		""""""
		
		result = []
		strip = ''.join(self.PREFIX_MAP)
		
		for field in fields:
			direction = self.PREFIX_MAP['']
			
			if field[0] in self.PREFIX_MAP:
				direction = self.PREFIX_MAP[field[0]]
				field = field.lstrip(strip)
			
			result.append((field, direction))
		
		return result
492979
void refresh()
    {
        ListIterator<Document<K>> listIterator = documents_.listIterator();
        while (listIterator.hasNext())
        {
            if (listIterator.next() == null)
                listIterator.remove();
        }
    }
1315847
def _collect_fields(field_parts_list, include_parents):
    """"""
    fields = []
    subpart_lists = defaultdict(list)

    for parts in field_parts_list:
        field, subparts = parts[0], parts[1:]
        if subparts:
            if include_parents and field not in fields:
                fields.append(field)
            subpart_lists[field].append(subparts)
        else:
            fields.append(field)

    subfields = dict((field, _collect_fields(subparts, include_parents))
                     for field, subparts in six.iteritems(subpart_lists))

    return ParsedFieldList(fields, subfields)
677389
def upsert(self, doc, namespace, timestamp, update_spec=None):
        """"""
        index, doc_type = self._index_and_mapping(namespace)
        # No need to duplicate '_id' in source document
        doc_id = u(doc.pop("_id"))
        metadata = {
            'ns': namespace,
            '_ts': timestamp
        }

        # Index the source document, using lowercase namespace as index name.
        action = {
            '_op_type': 'index',
            '_index': index,
            '_type': doc_type,
            '_id': doc_id,
            '_source': self._formatter.format_document(doc)
        }
        # Index document metadata with original namespace (mixed upper/lower).
        meta_action = {
            '_op_type': 'index',
            '_index': self.meta_index_name,
            '_type': self.meta_type,
            '_id': doc_id,
            '_source': bson.json_util.dumps(metadata)
        }

        self.index(action, meta_action, doc, update_spec)

        # Leave _id, since it's part of the original document
        doc['_id'] = doc_id
265331
def set(self, field, clusters, value, add_to_stack=True):
        """"""
        # Add the field if it doesn't exist.
        if field not in self._fields:
            self.add_field(field)
        assert field in self._fields

        clusters = _as_list(clusters)
        for cluster in clusters:
            if cluster not in self._data:
                self._data[cluster] = {}
            self._data[cluster][field] = value

        up = UpdateInfo(description='metadata_' + field,
                        metadata_changed=clusters,
                        metadata_value=value,
                        )
        undo_state = self.emit('request_undo_state', up)

        if add_to_stack:
            self._undo_stack.add((clusters, field, value, up, undo_state))
            self.emit('cluster', up)

        return up
1345837
void recomposeAttributeSets(ElemAttributeSet attrSet)
  {
    ArrayList attrSetList = (ArrayList) m_attrSets.get(attrSet.getName());

    if (null == attrSetList)
    {
      attrSetList = new ArrayList();

      m_attrSets.put(attrSet.getName(), attrSetList);
    }

    attrSetList.add(attrSet);
  }
126780
def refetch_fields(self, missing_fields):
        
        db_fields = self.mongokat_collection.find_one({"_id": self["_id"]}, fields={k: 1 for k in missing_fields})

        self._fetched_fields += tuple(missing_fields)

        if not db_fields:
            return

        for k, v in db_fields.items():
            self[k] = v