Adds item to DEPQ as highest priority. The default
        starting priority is 0, the default new priority is
        self.high(). Performance: O(1)
978517
def addfirst(self, item, new_priority=None):
        """"""

        with self.lock:

            self_data = self.data

            try:
                priority = self_data[0][1]
                if new_priority is not None:
                    if new_priority < priority:
                        raise ValueError('Priority must be >= '
                                         'highest priority.')
                    else:
                        priority = new_priority
            except IndexError:
                priority = 0 if new_priority is None else new_priority

            self_data.appendleft((item, priority))
            self_items = self.items
            maxlen = self._maxlen

            try:
                self_items[item] += 1
            except TypeError:
                self_items[repr(item)] += 1

            if maxlen is not None and maxlen < len(self_data):
                self._poplast()
480871
public void addPriorityOverride (PriorityOverride override)
    {
        if (_overrides == null) {
            _overrides = new ComparableArrayList<PriorityOverride>();
        }
        _overrides.insertSorted(override);
    }
152876
public boolean add(E key, double priority) {
//    System.err.println("Adding " + key + " with priority " + priority);
    if (add(key)) {
      relaxPriority(key, priority);
      return true;
    }
    return false;
  }
972515
public static PriorityAttribute createPriorityAttribute(long priority)
			throws IllegalArgumentException {
		PriorityAttribute attribute = new PriorityAttribute();

		attribute.setPriority(priority);

		return attribute;
	}
1010878
def put(self, iocb):
        """"""
        if _debug: IOQueue._debug("put %r", iocb)

        # requests should be pending before being queued
        if iocb.ioState != PENDING:
            raise RuntimeError("invalid state transition")

        # save that it might have been empty
        wasempty = not self.notempty.isSet()

        # add the request to the end of the list of iocb's at same priority
        priority = iocb.ioPriority
        item = (priority, iocb)
        self.queue.insert(bisect_left(self.queue, (priority+1,)), item)

        # point the iocb back to this queue
        iocb.ioQueue = self

        # set the event, queue is no longer empty
        self.notempty.set()

        return wasempty
652716
public boolean changePriority(E key, double priority) {
    Entry<E> entry = getEntry(key);
    if (entry == null) {
      entry = makeEntry(key);
    }
    if (compare(priority, entry.priority) == 0) {
      return false;
    }
    entry.priority = priority;
    heapify(entry);
    return true;
  }
733048
def add_item(self, item):
        

        self.beginInsertRows(QtCore.QModelIndex(),
                             self.rowCount(),
                             self.rowCount())

        item["parent"] = self
        item = Item(**item)
        self.items.append(item)
        self.endInsertRows()

        item.__datachanged__.connect(self._dataChanged)

        return item
351001
def reprioritize(self, priority, element):
        
        if element not in self.element_finder:
            raise ValueError("No such element in the priority queue.")
        entry = self.element_finder[element]
        self.add_element(priority, element, entry[1])
        entry[1] = self.INVALID
1171294
def priority=(new_val)
      return nil if new_val == @priority
      new_val = DEFAULT_PRIORITY if new_val.nil? || (new_val == '')
      raise JSS::InvalidDataError, ":priority must be one of: #{PRIORITIES.join ', '}" unless PRIORITIES.include? new_val
      @priority = new_val
      @need_to_update = true
    end
1170428
public function add(PriorityQueueItem $item) {
        $priority = $item->getPriority();
        if (!isset($this->items[$priority])) {
            $this->items[$priority] = array($item);
        } else {
            $this->items[$priority][] = $item;
        }
        return $this;
    }
714438
public int getDefaultPriority()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getDefaultPriority");
    
    int priority = aliasDest.getDefaultPriority();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getDefaultPriority", new Integer(priority));
    
    return priority;
  }
997015
def prioritize():
    

    while True:
        hp_qs = Message.objects.high_priority().using('default')
        mp_qs = Message.objects.medium_priority().using('default')
        lp_qs = Message.objects.low_priority().using('default')
        while hp_qs.count() or mp_qs.count():
            while hp_qs.count():
                for message in hp_qs.order_by("when_added"):
                    yield message
            while hp_qs.count() == 0 and mp_qs.count():
                yield mp_qs.order_by("when_added")[0]
        while hp_qs.count() == 0 and mp_qs.count() == 0 and lp_qs.count():
            yield lp_qs.order_by("when_added")[0]
        if Message.objects.non_deferred().using('default').count() == 0:
            break
63599
def set_max_priority(self, infohash_list):
        
        data = self._process_infohash_list(infohash_list)
        return self._post('command/topPrio', data=data)
381121
def update_priority(self, tree_idx_list, priority_list):
        
        for tree_idx, priority, segment_tree in zip(tree_idx_list, priority_list, self.segment_trees):
            segment_tree.update(tree_idx, priority)
955494
def sort_by_priority(iterable, reverse=False, default_priority=10):
    
    return sorted(iterable, reverse=reverse, key=lambda o: getattr(o, 'priority', default_priority))
1339454
public void addSort(Object object, int sort, int priority) {
        key.addPrimitiveValue(String.format(SORT_LABEL, priority), object, sort, priority);
    }
1158070
def insert(self, item, priority):
        
        heappush(self.heap, HeapItem(item, priority))