Pull certain fields out of the controller and add to the data hash.
511925
def extract_and_merge_controller_data(data)
      if @controller
        data[:request] = {
          params:      @controller.request.parameters.to_hash,
          rails_root:  defined?(Rails) && defined?(Rails.root) ? Rails.root : "Rails.root not defined. Is this a test environment?",
          url:         @controller.complete_request_uri
        }
        data[:environment].merge!(@controller.request.env.to_hash)

        @controller.session[:fault_in_session]
        data[:session] = {
          key:         @controller.request.session_options[:id],
          data:        @controller.session.to_hash
        }
      end
    end
234463
def get_fields(self, request, obj=None):
        
        fields = self.fields[:]
        if not obj:
            fields.remove('value')
        return fields
37392
function loadFields(list, callback) {
  list.forEach(loadMethods)

  function loadMethods(field) {
    var module = require('./fields/' + field + '.js')
      , methods

    if (typeof module === 'function' || typeof module === 'string') {
      methods = {}
      methods[field] = module
    }
    else {
      methods = module
    }

    callback(methods)
  }
}
317807
def conditions_to_fields(conditions)
      conditions.inject({}) do |fields, (key, value)|
        fields.merge(key => value)
      end
    end
468813
def update_resource_fields(self, data, data_to_add):
        
        for key, value in data_to_add.items():
            if not data.get(key):
                data[key] = value

        return data
1254609
private function bring()
    {
        foreach ($this->_keptData as $key => $value) {
            $this->$key = $value;
        }
        //
        $this->_keyValue = $this->_keptData[$this->_keyName];
        //
        $this->_keptData = null;
        $this->_kept = false;
    }
78186
def add_data(self, request, pk=None):
        """"""
        # add data to entity
        resp = super().add_data(request, pk)

        # add data to collections in which entity is
        entity = self.get_object()
        for collection in entity.collections.all():
            collection.data.add(*request.data['ids'])

        return resp
938365
private void processData() {
    List<VariableElement> dataFields = ElementFilter
        .fieldsIn(component.getEnclosedElements())
        .stream()
        .filter(field -> field.getAnnotation(Data.class) != null)
        .collect(Collectors.toList());

    if (dataFields.isEmpty()) {
      return;
    }

    dataFields.forEach(collectionFieldsValidator::validateComponentDataField);

    this.fieldsToMarkAsData.addAll(dataFields);
  }
570248
def add_fields(store_name, field_names):
    
    def decorate(cls):
        def _add(index, name):
            def _set_dir(self, value): getattr(self, store_name)[index] = value
            def _get_dir(self): return getattr(self, store_name)[index]
            setattr(cls, name, property(_get_dir, _set_dir))

        for index, field_name in enumerate(field_names):
            _add(index, field_name)

        return cls

    return decorate
722490
def clean(self):
        ''''''
        if not self.urlhash or 'url' in self._get_changed_fields():
            self.urlhash = hash_url(self.url)
        super(Reuse, self).clean()
887415
def select(*fields)
      raise OData::NotSupportedError.new("You cannot call both the `links` method and the `select` method in the same query.") if @links_navigation_property
      raise OData::NotSupportedError.new("You cannot call both the `count` method and the `select` method in the same query.") if @count

      @select |= fields

      expands =  fields.find_all { |f| /\// =~ f }
      expands.each do |e|
        parts = e.split '/'
        @expands |= [parts[0...-1].join('/')]
      end

      self
    end
768614
function fieldsToMongo(fields) {
    if (!fields) return null
    var hash = {}
    fields.split(',').forEach(function(field) {
        hash[field.trim()] = 1
    })
    return hash
}
32698
void mergeFields() {
        for (int k = 0; k < fields.size(); ++k) {
            HashMap fd = ((AcroFields)fields.get(k)).getFields();
            mergeWithMaster(fd);
        }
    }
1354518
def get_fields(self):
        """"""
        fields = super(CollectionSerializer, self).get_fields()

        if self.request.method == "GET":
            fields['data'] = serializers.SerializerMethodField()
        else:
            fields['data'] = serializers.PrimaryKeyRelatedField(many=True, read_only=True)

        return fields
840596
function addToFields(fieldName, options) {
	if (inFields(fieldName, options)) return;
	options.fields = options.fields.concat([fieldName]);
}
562221
def _populate_validated_data_with_sub_field_data(self, validated_data):
        
        for fieldname, field in self.get_fields().items():
            if isinstance(field, ModelSubSerializer):
                field_data = validated_data.pop(fieldname, None)
                if field_data:
                    validated_data.update(field_data)
748277
def _init_fields(self):
        """"""
        if self.opts.fields:
            available_field_names = self.set_class(self.opts.fields)
        else:
            available_field_names = self.set_class(self.declared_fields.keys())
            if self.opts.additional:
                available_field_names |= self.set_class(self.opts.additional)

        invalid_fields = self.set_class()

        if self.only is not None:
            # Return only fields specified in only option
            field_names = self.set_class(self.only)

            invalid_fields |= field_names - available_field_names
        else:
            field_names = available_field_names

        # If "exclude" option or param is specified, remove those fields.
        exclude_field_names = set(self.opts.exclude) | set(self.exclude)
        if exclude_field_names:
            # Note that this isn't available_field_names, since we want to
            # apply "only" for the actual calculation.
            field_names = field_names - exclude_field_names

            invalid_fields |= exclude_field_names - available_field_names

        if invalid_fields:
            message = 'Invalid fields for {}: {}.'.format(self, invalid_fields)
            raise ValueError(message)

        fields_dict = self.dict_class()
        for field_name in field_names:
            field_obj = self.declared_fields.get(field_name, ma_fields.Inferred())
            self._bind_field(field_name, field_obj)
            fields_dict[field_name] = field_obj

        dump_data_keys = [
            obj.data_key or name for name, obj in iteritems(fields_dict) if not obj.load_only
        ]
        if len(dump_data_keys) != len(set(dump_data_keys)):
            data_keys_duplicates = {x for x in dump_data_keys if dump_data_keys.count(x) > 1}
            raise ValueError(
                'The data_key argument for one or more fields collides '
                "with another field's name or data_key argument. "
                'Check the following field names and '
                'data_key arguments: {}'.format(list(data_keys_duplicates)),
            )

        load_attributes = [
            obj.attribute or name for name, obj in iteritems(fields_dict) if not obj.dump_only
        ]
        if len(load_attributes) != len(set(load_attributes)):
            attributes_duplicates = {x for x in load_attributes if load_attributes.count(x) > 1}
            raise ValueError(
                'The attribute argument for one or more fields collides '
                "with another field's name or attribute argument. "
                'Check the following field names and '
                'attribute arguments: {}'.format(list(attributes_duplicates)),
            )

        return fields_dict