Pushes multiple elements to a list in an atomic way until it reaches certain size
            Once limit is reached, the function will lpop the oldest elements
            This operation runs in LUA, so is always atomic
162569
def multi_rpush_limit(self, queue, values, limit=100000):
        ''' 
        '''

        lua = '''
        local queue = KEYS[1]
        local max_size = tonumber(KEYS[2])
        local table_len = tonumber(table.getn(ARGV))
        local redis_queue_len = tonumber(redis.call('LLEN', queue))
        local total_size = redis_queue_len + table_len
        local from = 0

        if total_size >= max_size then
            -- Delete the same amount of data we are inserting. Even better, limit the queue to the specified size
            redis.call('PUBLISH', 'DEBUG', 'trim')
            if redis_queue_len - max_size + table_len > 0 then
                from = redis_queue_len - max_size + table_len
            else
                from = 0
            end
            redis.call('LTRIM', queue, from, redis_queue_len)
        end
        for _,key in ipairs(ARGV) do
            redis.call('RPUSH', queue, key)
        end
        return 1

        '''

        # Check that what we receive is iterable
        if hasattr(values, '__iter__'):
            if len(values) > limit:
                raise ValueError('The iterable size is bigger than the allowed limit ({1}): {0}'.format(len(values), limit))
            try:
                self.multi_rpush_limit_script([queue, limit], values)
            except AttributeError:
                if self.logger:
                    self.logger.info('Script not registered... registering')
                # If the script is not registered, register it
                self.multi_rpush_limit_script = self.register_script(lua)
                self.multi_rpush_limit_script([queue, limit], values)
        else:
            raise ValueError('Expected an iterable')
354913
function copyFromBuffer(n, list) {
	  var ret = Buffer.allocUnsafe(n);
	  var p = list.head;
	  var c = 1;
	  p.data.copy(ret);
	  n -= p.data.length;
	  while (p = p.next) {
	    var buf = p.data;
	    var nb = n > buf.length ? buf.length : n;
	    buf.copy(ret, ret.length - n, 0, nb);
	    n -= nb;
	    if (n === 0) {
	      if (nb === buf.length) {
	        ++c;
	        if (p.next) list.head = p.next;else list.head = list.tail = null;
	      } else {
	        list.head = p;
	        p.data = buf.slice(nb);
	      }
	      break;
	    }
	    ++c;
	  }
	  list.length -= c;
	  return ret;
	}
944709
def push(self, item, priority):
        '''
        
        '''
        data = self._encode_item(item)
        pairs = {data: -priority}
        self.server.zadd(self.key, **pairs)
856075
function push(to) {
    var actions = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        actions[_i - 1] = arguments[_i];
    }
    for (var _a = 0, actions_1 = actions; _a < actions_1.length; _a++) {
        var set = actions_1[_a];
        for (var _b = 0, set_1 = set; _b < set_1.length; _b++) {
            var action = set_1[_b];
            to.push(action);
        }
    }
}
254604
function sqPush(queue, index, count, item) {
  queue[count] = item
  index[item]  = count
}
432424
function( fn ){
      var self = this;
      var _p = self._private;
      var subsize = self.spreadSize(); // number of pass eles to handle in each thread
      var pass = _p.pass.shift().concat([]); // keep a copy
      var runPs = [];

      for( var i = 0; i < this.length; i++ ){
        var thread = this[i];
        var slice = pass.splice( 0, subsize );

        var runP = thread.pass( slice ).run( fn );

        runPs.push( runP );

        var doneEarly = pass.length === 0;
        if( doneEarly ){ break; }
      }

      return $$.Promise.all( runPs ).then(function( thens ){
        var postpass = new Array();
        var p = 0;

        // fill postpass with the total result joined from all threads
        for( var i = 0; i < thens.length; i++ ){
          var then = thens[i]; // array result from thread i

          for( var j = 0; j < then.length; j++ ){
            var t = then[j]; // array element

            postpass[ p++ ] = t;
          }
        }

        return postpass;
      });
    }
542504
def push(object)
      raise ClosedQueueError, "queue closed" if @close
      if (waiter = @waiters.shift)
        future = LightIO::Future.new
        LightIO::IOloop.current.add_callback {
          waiter.transfer(object)
          future.transfer
        }
        future.value
      else
        @queue << object
      end
      self
    end
837087
public void push(long x) {
    if (this.queueSize == this.maxSize) {
      assert this.last == this.first;
      this.sumOfQueue -= this.elems.get(this.last);
      if ((++this.last) == this.maxSize)
        this.last = 0;
    } else
      this.queueSize++;
    this.sumOfQueue += x;
    this.elems.set(this.first, x);
    if ((++this.first) == this.maxSize) {
      this.first = 0;
      this.last = 0;
    }
  }
188566
function(fn) {
    var n = this.elements.length, k = n, i;
    do { i = k - n;
      fn(this.elements[i], i+1);
    } while (--n);
  }
1151369
def push(self, record, shard):
        
        heapq.heappush(self.heap, heap_item(self.clock, record, shard))
1022708
function push(arr) {
    var args = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        args[_i - 1] = arguments[_i];
    }
    arr = arr.concat(flatten.apply(void 0, args));
    return {
        array: arr,
        val: arr.length
    };
}
193784
def move_to_limit(self, position):
        
        cmd = 'MOVE', [Float, Integer]
        self._write(cmd, position, 1)
445814
function() {
				if ( list ) {
					// First, we save the current length
					var start = list.length;
					(function add( args ) {
						jQuery.each( args, function( _, arg ) {
							var type = jQuery.type( arg );
							if ( type === "function" ) {
								if ( !options.unique || !self.has( arg ) ) {
									list.push( arg );
								}
							} else if ( arg && arg.length && type !== "string" ) {
								// Inspect recursively
								add( arg );
							}
						});
					})( arguments );
					// Do we need to add the callbacks to the
					// current firing batch?
					if ( firing ) {
						firingLength = list.length;
					// With memory, if we're not firing then
					// we should call right away
					} else if ( memory ) {
						firingStart = start;
						fire( memory );
					}
				}
				return this;
			}
1337650
def push(x, n = 1)
      x = [x] unless x.is_a? Array
      x.each { |value| _digest(value, n) }
    end
375072
public boolean pushAll(V firstValue, V... moreValues) {
        check();
        context.getValueStack().pushAll(firstValue, moreValues);
        return true;
    }
164486
def push(self, el):
        
        count = next(self.counter)
        heapq.heappush(self._queue, (el, count))
516690
def add_atomic_pull(document)
      document.flagged_for_destroy = true
      (delayed_atomic_pulls[document.association_name.to_s] ||= []).push(document)
    end