Get a sorted events array from a score
352838
function events (obj, build, compare) {
  var e = []
  forEachTime(function (time, obj) {
    e.push(build ? build(time, obj) : [time, obj])
  }, null, obj)
  return e.sort(compare || function (a, b) { return a[0] - b[0] })
}
253858
def get_events(object_key: str) -> List[Event]:
    """"""
    events_data = _get_events_data(object_key)
    return [Event.from_config(event_dict) for event_dict in events_data]
738367
function decode(events) {
  let indexList = [];
  let eventsByte = parseInt(events, 16);

  if(eventsByte & APPEARANCE_MASK) {
    indexList.push(APPEARANCE);
  }
  if(eventsByte & DISPLACEMENT_MASK) {
    indexList.push(DISPLACEMENT);
  }
  if(eventsByte & PACKETS_MASK) {
    indexList.push(PACKETS);
  }
  if(eventsByte & KEEPALIVE_MASK) {
    indexList.push(KEEPALIVE);
  }
  if(eventsByte & DISAPPEARANCE_MASK) {
    indexList.push(DISAPPEARANCE);
  }

  return indexList;
}
1235352
def get_events_in_both_arrays(events_one, events_two):
    
    events_one = np.ascontiguousarray(events_one)  # change memory alignement for c++ library
    events_two = np.ascontiguousarray(events_two)  # change memory alignement for c++ library
    event_result = np.empty_like(events_one)
    count = analysis_functions.get_events_in_both_arrays(events_one, events_two, event_result)
    return event_result[:count]
460784
function sortedByScoreDesc(players) {
		return players.slice().sort(function(a, b) {
			if (b.score == a.score)
				return a.name.localeCompare(b.name);		// stabalize the sort
			return b.score - a.score;

		});
	}
695791
function() {
      var sortedInputEvents = this.getSortedInputEvents();
      var protoIRs = this.findProtoIRs(sortedInputEvents);
      protoIRs = this.postProcessProtoIRs(protoIRs);
      this.checkAllInputEventsHandled(sortedInputEvents, protoIRs);

      var irs = [];
      var model = this.model;
      protoIRs.forEach(function(protoIR) {
        var ir = protoIR.createInteractionRecord(model);
        if (ir)
          irs.push(ir);
      });
      return irs;
    }
188345
def get_stage_events(cls, crawler, stage_name, start, end, level=None):
        """"""
        key = make_key(crawler, "events", stage_name, level)
        return cls.event_list(key, start, end)
321906
function(sortedInputEvents) {
      var animationEvents = this.modelHelper.browserHelper.
          getAllAsyncSlicesMatching(function(event) {
            return ((event.title === CSS_ANIMATION_TITLE) &&
                    (event.duration > 0));
      });

      var animationRanges = [];
      animationEvents.forEach(function(event) {
        animationRanges.push({
          min: event.start,
          max: event.end,
          event: event
        });
      });

      function merge(ranges) {
        var protoIR = new ProtoIR(ProtoIR.ANIMATION_TYPE, CSS_IR_NAME);
        ranges.forEach(function(range) {
          protoIR.pushEvent(range.event);
        });
        return protoIR;
      }

      return tr.b.mergeRanges(animationRanges,
                              ANIMATION_MERGE_THRESHOLD_MS,
                              merge);
    }
992663
function cacheTracksArray(self) {
  self.tracksInOrder = Object.keys(self.playlist).map(trackById);
  self.tracksInOrder.sort(asc);
  self.tracksInOrder.forEach(function(track, index) {
    track.index = index;
  });

  function asc(a, b) {
    return operatorCompare(a.sortKey, b.sortKey);
  }
  function trackById(id) {
    return self.playlist[id];
  }
}
124165
def score_events(self, obs, pstates):
        
        pstates_idx = np.array([self.e[p] for p in pstates])

        framelogprob = self._compute_log_likelihood(obs, pstates_idx)
        _, fwdlattice = self._do_forward_pass(framelogprob, pstates_idx)
        L = logsumexp(fwdlattice, axis=1)
        return np.concatenate([L[[0]], np.diff(L)])
565396
def import_events(self, source='wonambi'):
        """"""
        if self.annot is None:  # remove if buttons are disabled
            self.parent.statusBar().showMessage('No score file loaded')
            return

        if 'wonambi' == source:
            format_str = 'CSV File (*.csv)'
            rec_start = None
        
        elif 'remlogic' == source:
            format_str = 'Text file (*.txt)'
            rec_start = self.parent.info.dataset.header['start_time']
            
        
        fn, _ = QFileDialog.getOpenFileName(self, 'Import events',
                                            None, format_str)
        
        if fn == '':
            return
        
        fn = Path(fn).resolve()

        self.annot.import_events(fn, source=source, rec_start=rec_start,
                                 parent=self.parent)
        self.display_notes()
577481
function sort(array, compare) {
  for (var i = 1; i < array.length; i++) {
    var item = array[i];
    var indexHole = i;
    while (indexHole > 0 && compare(array[indexHole - 1], item) > 0) {
      array[indexHole] = array[--indexHole];
    }
    array[indexHole] = item;
    if (sortExternal.shiftObserver) {
      sortExternal.shiftObserver(i, indexHole);
    }
  }

  return array;
}
1161385
def slot_availability_array(events, slots):
    
    array = np.ones((len(events), len(slots)))
    for row, event in enumerate(events):
        for col, slot in enumerate(slots):
            if slot in event.unavailability or event.duration > slot.duration:
                array[row, col] = 0
    return array
387850
def extract_sort(self, params):
        ''''''
        sorts = params.pop('sort', [])
        sorts = [sorts] if isinstance(sorts, basestring) else sorts
        sorts = [(s[1:], 'desc')
                 if s.startswith('-') else (s, 'asc')
                 for s in sorts]
        self.sorts = [
            {self.adapter.sorts[s]: d}
            for s, d in sorts if s in self.adapter.sorts
        ]
682845
public function getAllActiveEvents(): array
    {
        $activeEvents = [];
        foreach (self::$eventsMap as $eventName => $eventClass) {
            if (!class_exists($eventClass)) {
                continue;
            }

            $activeEvents[] = $eventName;
        }

        $listeners = $this->eventDispatcher->getListeners();
        $activeEvents = array_unique(array_merge($activeEvents, array_keys($listeners)));

        asort($activeEvents);

        return $activeEvents;
    }
575655
def _get_events(self, result):
        """""""
        events = []

        for event_data in result:
            event = Event.factory(event_data)

            if event is not None:
                events.append(event)

                if isinstance(event, DeviceStateChangedEvent):
                    # change device state
                    if self.__devices[event.device_url] is None:
                        raise Exception(
                            "Received device change " +
                            "state for unknown device '" +
                            event.device_url + "'")

                    self.__devices[event.device_url].set_active_states(
                        event.states)

        return events
773733
private int scorerIndex(int n)
   {
      int lo = 0; // search starts array
      int hi = scorers.length - 1; // for first element less

      while (hi >= lo)
      {
         int mid = (lo + hi) >> 1;
         int midValue = starts[mid];
         if (n < midValue)
         {
            hi = mid - 1;
         }
         else if (n > midValue)
         {
            lo = mid + 1;
         }
         else
         { // found a match
            while (mid + 1 < scorers.length && starts[mid + 1] == midValue)
            {
               mid++; // scan to last match
            }
            return mid;
         }
      }
      return hi;
   }