Find the best trigger for this request, or go away.
960059
async def _find_trigger(self,
                            request: Request,
                            origin: Optional[Text]=None,
                            internal: bool=False) \
            -> Tuple[
                Optional[BaseTrigger],
                Optional[Type[BaseState]],
                Optional[bool],
            ]:
        

        reg = request.register

        if not origin:
            origin = reg.get(Register.STATE)
            logger.debug('From state: %s', origin)

        results = await asyncio.gather(*(
            x.rank(request, origin)
            for x
            in self.transitions
            if x.internal == internal
        ))

        if len(results):
            score, trigger, state, dnr = max(results, key=lambda x: x[0])

            if score >= settings.MINIMAL_TRIGGER_SCORE:
                return trigger, state, dnr

        return None, None, None
497908
def close(self):
        """"""
        if self.call is None:
            return

        self._request_queue.put(None)
        self.call.cancel()
        self._request_generator = None
582119
function(name, callback, context) {
    if (eventsApi(this, 'stopReplying', name)) {
      return this;
    }

    // Remove everything if there are no arguments passed
    if (!name && !callback && !context) {
      delete this._requests;
    } else if (!removeHandlers(this._requests, name, callback, context)) {
      Radio.debugLog('Attempted to remove the unregistered request', name, this.channelName);
    }

    return this;
  }
709301
function (event, query, handler, context) {
        return on(this, event, query, handler, context, false);
    }
238673
function abortXHRRequest(uid, fn) {
  if (reqs.hasOwnProperty(uid)) {
    if (!reqs[uid]) return;

    if (fn) {
      fn();
    } else {
      reqs[uid].abort();
    }
    delete reqs[uid];
    return reqs;
  }
}
32730
function () {
		this.stop();
		this.listenTo(this.items, EVENT_ADD, this.triggerAdd);
		this.listenTo(this.items, EVENT_REMOVE, this.triggerRemove);
		this.listenTo(this.items, EVENT_SORT, this.triggerSort);
		this.listenTo(this.items, EVENT_ADD, this.updateLength);
		this.listenTo(this.items, EVENT_REMOVE, this.updateLength);
		this.listenTo(this.items, EVENT_ADD, this.watchItem);
		this.listenTo(this.items, EVENT_REMOVE, this.unwatchItem);
	}
673406
def trigger(self, event, *args):
        """"""
        for handler in self._event_handlers[event]:
            handler(*args)
769287
private void disposeTriggersAndDataProviders() {
        for (final Map.Entry<T, List<DP>> entry : triggersToDataProviders.entrySet()) {
            // Disconnect from trigger
            unhookFromTrigger(entry.getKey());

            // Dispose trigger itself
            final T trigger = entry.getKey();
            if (trigger instanceof Disposable) {
                ((Disposable) trigger).dispose();
            }

            // Dispose data providers
            final List<DP> dataProviders = entry.getValue();
            if (dataProviders != null) {
                for (final DP dataProvider : dataProviders) {
                    if (dataProvider instanceof Disposable) {
                        ((Disposable) dataProvider).dispose();
                    }
                }
            }
        }

        // Clears all triggers
        triggersToDataProviders.clear();
    }
1236945
def conditions(self, trigger_id):
        
        response = self._get(self._service_url(['triggers', trigger_id, 'conditions']))
        return  Condition.list_to_object_list(response)
980415
function stop(options, callback) {
  const args = utils.getArgs(options, [config], callback);
  const url = `http://${args.options.ip}:${args.options.port}/stop`;

  return request.get(url, function(err) {
    if (err && err.code !== "ECONNREFUSED") {
      return args.callback(err);
    }
    return args.callback(null);
  });
}
441952
async def handler(event):
    """"""
    query = urllib.parse.quote(event.pattern_match.group(1))
    await asyncio.wait([
        event.delete(),
        event.respond(SEARCH.format(query), reply_to=event.reply_to_msg_id)
    ])
658975
public boolean stopReporting() {

        // quit the bounce proxy heartbeat but let a possibly running request
        // finish
        if (scheduledFuture != null) {
            return scheduledFuture.cancel(false);
        }

        executorService.shutdown();
        executorService = null;
        return false;
    }
549539
private void triggerQueuedRequests() {
		if (triggerRequestQueued) {
			triggerRequestQueued = false;

			// trigger the checkpoint from the trigger timer, to finish the work of this thread before
			// starting with the next checkpoint
			if (periodicScheduling) {
				if (currentPeriodicTrigger != null) {
					currentPeriodicTrigger.cancel(false);
				}
				currentPeriodicTrigger = timer.scheduleAtFixedRate(
						new ScheduledTrigger(),
						0L, baseInterval, TimeUnit.MILLISECONDS);
			}
			else {
				timer.execute(new ScheduledTrigger());
			}
		}
	}
502300
public Trigger<? super S> getDeleteTrigger() {
        ForDelete<S> forDelete = mForDelete;
        return forDelete.isEmpty() ? null : forDelete;
    }
777185
def delete_request(self, user_id, request_id):
        """"""
        return self.request(
            "{0}_{1}".format(request_id, user_id), method="DELETE"
        )
318153
void terminateRequest() {
        int oldVal = state;
        if (allAreSet(oldVal, FLAG_REQUEST_TERMINATED)) {
            // idempotent
            return;
        }
        if (requestChannel != null) {
            requestChannel.requestDone();
        }
        this.state = oldVal | FLAG_REQUEST_TERMINATED;
        if (anyAreSet(oldVal, FLAG_RESPONSE_TERMINATED)) {
            invokeExchangeCompleteListeners();
        }
    }
200162
def has_ist_trigger(self):
        """"""
        triggers = self.template['spec'].get('triggers', [])
        if not triggers:
            return False
        for trigger in triggers:
            if trigger['type'] == 'ImageChange' and \
                    trigger['imageChange']['from']['kind'] == 'ImageStreamTag':
                return True
        return False