Loot at the event property for a function to see if it should be run at this stage.
976282
def _runable_for_event(f, tag, stage):
    

    if not hasattr(f, '__ambry_event__'):
        return False

    f_tag, f_stage = f.__ambry_event__

    if stage is None:
        stage = 0

    if tag != f_tag or stage != f_stage:
        return False

    return True
1276135
def _run_event_methods(self, tag, stage=None):
        
        import inspect
        from ambry.bundle.events import _runable_for_event

        funcs = []

        for func_name, f in inspect.getmembers(self, predicate=inspect.ismethod):
            if _runable_for_event(f, tag, stage):
                funcs.append(f)

        for func in funcs:
            func()
840186
function(obj, func, items, func2){
					each(items, function(i, item){
						when(obj, func, item, func2)
					})
				}
904069
function checkThreshold(item, ctx) {
		if (item.count >= item.opts.minRequestCount) {
			const rate = item.failures / item.count;
			if (rate >= item.opts.threshold)
				trip(item, ctx);
		}
	}
690291
function track(property, thisArg){
    if(!(property in trackedProperties)){
      trackedProperties[property] = true;
      values[property] = model[property];
      Object.defineProperty(model, property, {
        get: function () { return values[property]; },
        set: function(newValue) {
          var oldValue = values[property];
          values[property] = newValue;
          getListeners(property).forEach(function(callback){
            callback.call(thisArg, newValue, oldValue);
          });
        }
      });
    }
  }
978185
function Event (type, optionalProperties) {
  Object.defineProperty(this, 'type', { writable: false, value: type, enumerable: true })
  if (optionalProperties) {
    for (var f in optionalProperties) {
      if (optionalProperties.hasOwnProperty(f)) {
        Object.defineProperty(this, f, { writable: false, value: optionalProperties[f], enumerable: true })
      }
    }
  }
}
262987
function shouldSkip(name, value) {
  var attrType = properties[name];
  return value == null ||
    (attrType === types.BOOLEAN && !value) ||
    (attrType === types.OVERLOADED_BOOLEAN && value === false);
}
1156478
def should_collect(self, value):
        """"""
        return (
            # decorated with @transition
            isinstance(value, TransitionWrapper)
            # Relates to a compatible transition
            and value.trname in self.workflow.transitions
            # Either not bound to a state field or bound to the current one
            and (not value.field or value.field == self.state_field))
1088464
function onEvent(e) {
    const eventData = e.detail;

    if (ignoreFiredEvents === true) {
      return;
    }

    fireEvent(e.currentTarget, eventData);
  }
371578
function enqueueEvent( self, eventItem ) {
   if( self.eventQueue_.length === 0 ) {
      self.nextTick_( () => {
         const queuedEvents = self.eventQueue_;

         self.eventQueue_ = [];

         processWaitingPublishPromises( self, processQueue( self, queuedEvents ) );
      } );
   }
   self.eventQueue_.push( eventItem );
}
847929
private void track(Event<T> windowEvent) {
        evictionPolicy.track(windowEvent);
        triggerPolicy.track(windowEvent);
    }
1004994
function Event() {
    SelectableItem.call(this, this /* modelItem */);
    this.guid_ = tr.b.GUID.allocate();
    this.selectionState = SelectionState.NONE;
    this.associatedAlerts = new tr.model.EventSet();
    this.info = undefined;
  }
1266335
def is_running(fun):
    '''
    
    '''
    run = running()
    ret = []
    for data in run:
        if fnmatch.fnmatch(data.get('fun', ''), fun):
            ret.append(data)
    return ret
819638
def enterEvent( self, event ):
        
        item = self.trackerItem()
        if ( item ):
            item.setVisible(True)
1255159
function _runCallback(eventName, data) {
      for (var id in _mappings[eventName].callbacks) {
        var callbackObject = _mappings[eventName].callbacks[id];

        if (typeof callbackObject.cb === 'function') callbackObject.cb(data);
        if (typeof callbackObject.once === 'boolean' && callbackObject.once === true) _self.off(eventName, callbackObject.cb);
      }
    }
1150640
function processItemAsync(runner, currentValidation, key, context) {
  return Promise.resolve(true).then(function() {
    return processItem(runner, currentValidation, key, context)
  });
}
270831
function forOwn(object, callback) {
    for (var key in object) {
      if (hasOwnProperty.call(object, key)) {
        callback(object[key], key, object);
      }
    }
  }