Set the quantity for an instance of Item
773111
public function setQuantity($quantity) {
        if (!is_integer($quantity)) {
            throw new \Exception ("quantity must be an Integer");
        }
        if ($quantity < 0) {
            throw new \Exception ("quantity cannot be less than zero");
        }
        $this->quantity = $quantity;
    }
850222
@Override
  public final void setItem(final SeGoods pItem) {
    this.item = pItem;
    if (getItsId() == null) {
      setItsId(new SeGoodsSpecificsId());
    }
    getItsId().setItem(this.item);
  }
694927
def set(self, instance, value, **kw):
        
        return self._set(instance, value, **kw)
357186
def set_items(self, items):
        """"""
        res = []
        max_value = max(sum((rec[1] for rec in items)), 1)
        for key, val in items:
            res.append((key, val, val * 1.0 / max_value))
        self._items = res
29424
def add(item, quantity: 1, unique: true)
      raise 'expecting an acts_as_purchasable object' unless item.kind_of?(ActsAsPurchasable)

      existing = (
        if unique.kind_of?(Proc)
          cart_items.find { |cart_item| instance_exec(item, cart_item.purchasable, &unique) }
        elsif unique.kind_of?(Symbol) || (unique.kind_of?(String) && unique != 'true')
          raise "expected item to respond to unique #{unique}" unless item.respond_to?(unique)
          cart_items.find { |cart_item| cart_item.purchasable.respond_to?(unique) && item.send(unique) == cart_item.purchasable.send(unique) }
        elsif unique.present?
          find(item)
        end
      )

      if existing
        if unique || (existing.unique.present?)
          existing.assign_attributes(purchasable: item, quantity: quantity, unique: existing.unique)
        else
          existing.quantity = existing.quantity + quantity
        end
      end

      if item.quantity_enabled? && (existing ? existing.quantity : quantity) > item.quantity_remaining
        raise EffectiveOrders::SoldOutException, "#{item.purchasable_name} is sold out"
      end

      existing ||= cart_items.build(purchasable: item, quantity: quantity, unique: (unique.to_s unless unique.kind_of?(Proc)))
      save!
    end
206296
def setitem(self, key, value):
        
        with self.lock:
            self.tbl[key] = value
319024
def add_item(xml, item, index)
      xml.Item :num => index do
        xml.Code item[:sku]
        xml.Quantity item[:quantity]
      end
    end
706700
def _insert_item(self, key, new_item, instance, is_after):
        """"""
        index = self._get_index_for_insert(key, instance)
        index = index + 1 if is_after else index
        self.__items = self.__items[:index] + new_item + self.__items[index:]
        # Make sure indexing works with new items
        for new_key, new_value in new_item:
            if new_key in self:
                value_list = [val for k, val in self.__items if k == new_key]
                dict_setitem(self, new_key, value_list)
            else:
                dict_setitem(self, new_key, [new_value])
1333136
def set_quantity(self, twig=None, value=None, **kwargs):
        
        # TODO: handle twig having parameter key (value@, default_unit@, adjust@, etc)
        # TODO: does this return anything (update the docstring)?
        return self.get_parameter(twig=twig, **kwargs).set_quantity(value=value, **kwargs)
843324
public function setQuantity($quantity) {
        if (empty($quantity))
            throw new Exception('Quantity must be set and cannot be empty.');

        $this->quantity = trim($quantity);

        return $this;
    }
705812
def add(self, attr, item):
        
        return self.set(attr, operation.Add([item]))
120869
public void increment(T item, double amount) {
    counts.put(item, counts.get(item) + amount);
    totalCount += amount;
  }
469095
def set_item(key,value):
    """"""
    CACHED_KEY_FILE = os.path.join(CURRENT_DIR, key)

    open(CACHED_KEY_FILE, "wb").write(json.dumps({"_": value}).encode('UTF-8'))

    return value
1284163
public function setQuantity( $quantity )
	{
		if( !is_numeric( $quantity ) ) {
			throw new MShop_Order_Exception( 'Quantity is invalid. Please enter a positive integer' );
		}

		$quantity = (int) $quantity;

		if( $quantity == $this->getQuantity() ) { return; }

		if( $quantity < 1 || $quantity > 2147483647 ) {
			throw new MShop_Order_Exception( sprintf( 'Quantity must be a positive integer and must not exceed %1$d', 2147483647 ) );
		}

		$this->_values['quantity'] = $quantity;
		$this->setModified();
	}
1297148
def sub(self, quantity):
        
        newvalue = self._value - quantity
        self.set(newvalue.deg)
1342633
def set(self, item_name, item_value):
		
		if self.prefix:
			item_name = self.prefix + self.seperator + item_name
		item_names = item_name.split(self.seperator)
		item_last = item_names.pop()
		node = self._storage
		for item_name in item_names:
			if not item_name in node:
				node[item_name] = {}
			node = node[item_name]
		node[item_last] = item_value
		return
1028480
function (basketItem, element, quantity, cb) {
                this.extendElementWithLinks(element);

                basketItem.set({
                    element: element,
                    quantity: quantity
                });

                basketItem.save(null, cb);
            }