Add a entity, or list of entities to the set. `entities` may be Backbone Entitys or raw JavaScript objects to be converted to Entitys, or any combination of the two.
331797
function(entities, options) {
      return this.set(entities, langx.mixin({merge: false}, options, addOptions));
    }
112557
def expand_entity(self, entity):
        
        if self.name in entity:
            return entity
        for key, value in entity.items():
            if isinstance(value, dict):
                if self.name in value:
                    return value
        raise KeyError("The field %s (%s) not found in %s" % (self.name, self._rule['type'], entity))
639105
def add(self, item):
        
        if self._is_stringable(item) or self._is_qstring(item):
            self.items.append(PlainText(item))
        elif isinstance(item, MessageElement):
            self.items.append(item)
        elif item is None or (hasattr(item, 'isNull') and item.isNull()):
            self.items.append(PlainText(
                tr('Null (None) found from the data.')))
        elif isinstance(item, tuple) or isinstance(item, list):
            for i in item:
                # Recursive call
                self.add(i)
        else:
            raise InvalidMessageItemError(item, item.__class__)
1241575
def add_entity(self, entity, second=False):
        ''' 
        '''
        if not entity in self._entities:
            if second:
                self._entities.append(entity)
            else:
                entity.set_world(self)
        else:
            raise DuplicateEntityError(entity)
58306
def add(self, entity):
        
        characteristic = self.extract_traits(entity)
        if not characteristic.traits:
            return

        if characteristic.is_matching:
            self.add_match(entity, *characteristic.traits)
        else:
            self.add_mismatch(entity, *characteristic.traits)
394771
async def add(self, *instances, using_db=None) -> None:
        
        if not instances:
            return
        if self.instance.id is None:
            raise OperationalError(
                "You should first call .save() on {model}".format(model=self.instance)
            )
        db = using_db if using_db else self.model._meta.db
        through_table = Table(self.field.through)
        select_query = (
            db.query_class.from_(through_table)
            .where(getattr(through_table, self.field.backward_key) == self.instance.id)
            .select(self.field.backward_key, self.field.forward_key)
        )
        query = db.query_class.into(through_table).columns(
            getattr(through_table, self.field.forward_key),
            getattr(through_table, self.field.backward_key),
        )

        if len(instances) == 1:
            criterion = getattr(through_table, self.field.forward_key) == instances[0].id
        else:
            criterion = getattr(through_table, self.field.forward_key).isin(
                [i.id for i in instances]
            )

        select_query = select_query.where(criterion)

        already_existing_relations_raw = await db.execute_query(str(select_query))
        already_existing_relations = {
            (r[self.field.backward_key], r[self.field.forward_key])
            for r in already_existing_relations_raw
        }

        insert_is_required = False
        for instance_to_add in instances:
            if instance_to_add.id is None:
                raise OperationalError(
                    "You should first call .save() on {model}".format(model=instance_to_add)
                )
            if (self.instance.id, instance_to_add.id) in already_existing_relations:
                continue
            query = query.insert(instance_to_add.id, self.instance.id)
            insert_is_required = True
        if insert_is_required:
            await db.execute_query(str(query))
656246
def _set_value(self, entity, value):
    
    if entity._projection:
      raise ReadonlyPropertyError(
          'You cannot set property values of a projection entity')
    if self._repeated:
      if not isinstance(value, (list, tuple, set, frozenset)):
        raise datastore_errors.BadValueError('Expected list or tuple, got %r' %
                                             (value,))
      value = [self._do_validate(v) for v in value]
    else:
      if value is not None:
        value = self._do_validate(value)
    self._store_value(entity, value)
76208
@Override
    public <T> Iterable<Key<T>> insert(final Iterable<T> entities) {
        return insert(entities, new InsertOptions()
                                    .writeConcern(defConcern));
    }
1046627
def extend(self, collection):
        
        if type(collection) is list:
            if self._col_dict is None and self._col_list is None:
                self._col_list = collection
            else:
                self._col_list += collection
            self._sync_list_to_dict(collection)
        elif type(collection) is dict:
            if self._col_dict is None and self._col_list is None:
                self._col_dict = collection
                self._col_list = collection.values()
            else:
                for key, value in collection.items():
                    self._set_key(key, value)
        else:
            raise NotImplementedError()
287655
def add_entity_info( data_api, struct_inflator):
    
    for entity in data_api.entity_list:
        struct_inflator.set_entity_info(entity["chainIndexList"],
                                        entity["sequence"],
                                        entity["description"],
                                        entity["type"])
705812
def add(self, attr, item):
        
        return self.set(attr, operation.Add([item]))
1361404
def _insert_entity(entity):
    '''
    
    '''
    _validate_entity(entity)

    request = HTTPRequest()
    request.method = 'POST'
    request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
                        _DEFAULT_PREFER_HEADER,
                        _DEFAULT_ACCEPT_HEADER]
    request.body = _get_request_body(_convert_entity_to_json(entity))

    return request
528630
function( model ) {
			var modelColl = model.collection;
			var coll = this.getCollection( model );
			coll && coll._add( model );
			model.collection = modelColl;
		}
1074687
def add(self, model):
        """"""
        def foo(m, p, i):
            if m[i][0].name == model.name:
                raise ValueError("Model already exists")
            return
        # checks if already existing
        self.foreach(foo)
        
        self.append((model,))
        return
542062
public void setEntities(final String entities) {
        if (entities == null && this.entities == null) {
            return;
        } else if (entities == null) {
            removeChild(this.entities);
            this.entities = null;
        } else if (this.entities == null) {
            this.entities = new KeyValueNode<String>(CommonConstants.CS_ENTITIES_TITLE, entities);
            appendChild(this.entities, false);
        } else {
            this.entities.setValue(entities);
        }
    }
55442
function(entity, options) {
      options = options ? langx.clone(options) : {};
      var wait = options.wait;
      entity = this._prepareEntity(entity, options);
      if (!entity) return false;
      if (!wait) this.add(entity, options);
      var collection = this;
      var success = options.success;
      options.success = function(m, resp, callbackOpts) {
        if (wait) collection.add(m, callbackOpts);
        if (success) success.call(callbackOpts.context, m, resp, callbackOpts);
      };
      entity.save(null, options);
      return entity;
    }
1113668
public EntityBuilder addSubEntities(List<Entity> entities) {
    	if(entities == null) {
    		throw new IllegalArgumentException("entities cannot be null.");
    	}
    	for (Entity entity : entities) {
            addSubEntity(entity);
        }
        return this;
    }