Add a copy of the DynamicField "field" to the current instance using the
        "field_name" name
547643
def _add_dynamic_field_to_instance(self, field, field_name):
        
        # create the new field
        new_field = field._create_dynamic_version()
        new_field.name = field_name
        new_field._attach_to_instance(self)

        # add the field to the list to avoid doing all of this again
        if field_name not in self._fields:  # (maybe already in it via the class)
            if id(self._fields) == id(self.__class__._fields):
                # unlink the list from the class
                self._fields = list(self._fields)
            self._fields.append(field_name)

        # if the field is an hashable field, add it to the list to allow calling
        # hmget on these fields
        if isinstance(field, limpyd_fields.InstanceHashField):
            if id(self._instancehash_fields) == id(self.__class__._instancehash_fields):
                # unlink the link from the class
                self._instancehash_fields = list(self._instancehash_fields)
            self._instancehash_fields.append(field_name)

        # set it as an attribute on the instance, to be reachable
        setattr(self, field_name, new_field)

        return new_field
505746
def set_custom_value(self, field_name, value):
        
        custom_field = self.get_custom_field(field_name)
        custom_value = CustomFieldValue.objects.get_or_create(
            field=custom_field, object_id=self.id)[0]
        custom_value.value = value
        custom_value.save()
46243
def get_instance_field(self, field_name):
        
        try:
            field = super(ModelWithDynamicFieldMixin, self).get_instance_field(field_name)
        except AttributeError:
            # the "has_field" returned True but getattr raised... we have a DynamicField
            dynamic_field = self._get_dynamic_field_for(field_name)  # it's a model bound field
            dynamic_field = self.get_field(dynamic_field.name)  # we now have an instance bound field
            field = self._add_dynamic_field_to_instance(dynamic_field, field_name)

        return field
1113547
public void add(final Field _field)
    {
        this.fields.put(_field.getId(), _field);
        this.fieldName2Field.put(_field.getName(), _field);
        if (_field.getReference() != null && _field.getReference().length() > 0) {
            final String ref = _field.getReference();
            int index;
            int end = 0;
            while ((index = ref.indexOf("$<", end)) > 0) {
                index += 2;
                end = ref.indexOf(">", index);
                addFieldExpr(ref.substring(index, end));
            }
        }
        _field.setCollectionUUID(getUUID());
    }
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()
154780
def before_add_field(self, field):
        
        if self.extract_fields and field.name == '*':
            field.ignore = True
            fields = [model_field.column for model_field in self.model._meta.fields]
            self.add_fields(fields)
168352
def add_local(self, field_name, field):
        
        self._dlog("adding local '{}'".format(field_name))
        field._pfp__name = field_name
        # TODO do we allow clobbering of locals???
        self._curr_scope["vars"][field_name] = field
562676
def add_composite_field(self, name, field):
        
        self.composite_fields[name] = field
        self._init_composite_field(name, field)
145292
function addSourceInstanceName(
  { node, getNode, loadNodeContent, actions, createNodeId, reporter },
  pluginOptions
) {
  const { createNodeField } = actions;

  const parent = getNode(node.parent);

  const sourceInstanceName =
    parent && parent.sourceInstanceName ? parent.sourceInstanceName : 'unknown';

  // Add node field
  createNodeField({
    node,
    name: 'sourceName',
    value: sourceInstanceName
  });

  // console.error('adding', sourceInstanceName, node.fields.sourceInstanceName)

  // if (!parent) {
  //   // Node has already been processed.
  //   console.error('Ocular markdown node has no parent', JSON.stringify(node.parent), JSON.stringify(node.sourceInstanceName), node.relativePath);
  //   return;
  // }

  if (parent) {
    addMissingFrontmatter(node, sourceInstanceName);
  }
}
537322
def create_from(cls, another, **kwargs):
        
        reused_fields = {}
        for field, value in another.get_fields():
            if field in cls.FIELDS:
                reused_fields[field] = value
        reused_fields.update(kwargs)
        return cls(**reused_fields)
1002821
def add_field(self, field_name: str, field: Field, vocab: Vocabulary = None) -> None:
        
        self.fields[field_name] = field
        if self.indexed:
            field.index(vocab)
1218712
public static Field cloneField(Field field) {
    return new Field(field.name(), field.schema(), field.doc(),
        field.defaultValue());
  }
1069482
private void loadInstanceField(XField instanceField, Instruction obj) {
        if (RLE_DEBUG) {
            System.out.println("[loadInstanceField for field " + instanceField + " in instruction " + handle);
        }

        ValueNumberFrame frame = getFrame();

        try {
            ValueNumber reference = frame.popValue();

            AvailableLoad availableLoad = new AvailableLoad(reference, instanceField);
            if (RLE_DEBUG) {
                System.out.println("[getfield of " + availableLoad + "]");
            }
            ValueNumber[] loadedValue = frame.getAvailableLoad(availableLoad);

            if (loadedValue == null) {
                // Get (or create) the cached result for this instruction
                ValueNumber[] inputValueList = new ValueNumber[] { reference };
                loadedValue = getOutputValues(inputValueList, getNumWordsProduced(obj));

                // Make the load available
                frame.addAvailableLoad(availableLoad, loadedValue);
                if (RLE_DEBUG) {
                    System.out.println("[Making load available " + availableLoad + " <- " + vlts(loadedValue) + "]");
                }
            } else {
                // Found an available load!
                if (RLE_DEBUG) {
                    System.out.println("[Found available load " + availableLoad + " <- " + vlts(loadedValue) + "]");
                }
            }

            pushOutputValues(loadedValue);

            if (VERIFY_INTEGRITY) {
                checkConsumedAndProducedValues(obj, new ValueNumber[] { reference }, loadedValue);
            }
        } catch (DataflowAnalysisException e) {
            throw new InvalidBytecodeException("Error loading from instance field", e);
        }
    }
219867
def _add_field(self, field_type, name, value):
        
        try:
            self.__getattribute__(field_type).update({name: value})
        except:
            raise ValueError('Problem with field_type %s'  %field_type)
        #  Note that if process has attribute name, this will trigger The
        # setter method for that attribute
        self.__setattr__(name, value)
1107014
def copyFrom(bitfield)
      raise "Source bitfield is too small (#{bitfield.length} < #{length})" if bitfield.length < length
      (@data.length).times do |i|
        @data[i] = bitfield.data[i]
      end
    end
196752
def add_previous_name(self, name):
        
        self._ensure_field('name', {})
        self.obj['name'].setdefault('previous_names', []).append(name)
990703
def add_fields(self, field_dict):
    
    for key, field in field_dict.items():
      self.add_field(key, field)