:param events: list of event types

    Only calls wrapped function if given event_type is in list of events
511964
def for_events(*events):
    
    events = set(events)

    def wrap(func):
        func.event_types = events
        return func

    return wrap
732296
def _events(self):
        
        with self.app.events_lock:
            res = self.app.get_events()
        return serialize(res, True)
1366571
function (type, handler) {

            // Validate arguments
            if (typeof type !== 'undefined' && typeof type !== 'string') {
                throw new Error('Type must be a string or undefined');
            }
            if (typeof handler !== 'undefined' && typeof handler !== 'function') {
                throw new Error('Handler must be a function or undefined');
            }

            // If no type is given, remove all handlers
            if (!type) {
                return delete this._events;
            }

            // Check for presence of event store
            if (!this._events || !this._events[type]) {
                return;
            }

            // If no handler is given, remove all handlers for this type
            if (!handler) {
                return delete this._events[type];
            }

            // Do we have a matching handler?
            var handlers = this._events[type];
            var i = arrayIndexOf(handlers, handler);
            if (i === -1) {
                return;
            }

            // Remove handler
            handlers.splice(i, 1);

        }
1243527
def find_handlers(event_name, registry=HANDLER_REGISTRY):
    
    handlers = []

    # event_name can be a BaseEvent or the string representation
    if isinstance(event_name, basestring):
        matched_events = [event for event in registry.keys()
            if fnmatch.fnmatchcase(event_name, event)]
        for matched_event in matched_events:
            handlers.extend(registry.get(matched_event))
    else:
        handlers = registry.get(find_event(event_name), [])

    return handlers
820302
def _attach_handler_events(self, handler, events=None):
        
        if not events:
            events = self
        for name in events:
            meth = getattr(handler, name, None)
            if meth:
                self.events[name] += meth
356910
def event_return(events):
    '''
    
    '''

    for event in events:
        ret = event.get('data', False)

        if ret:
            returner(ret)
880137
private List<Event> filterEvents(List<Event> events) {
        List<Event> filteredEvents = new ArrayList<Event>();
        for (Event event : events) {
            if (!filter(event)) {
                filteredEvents.add(event);
            }
        }
        return filteredEvents;
    }
509434
def _setup_events(plugin):
    

    events = plugin.events

    if events and isinstance(events, (list, tuple)):
        for event in [e for e in events if e in _EVENT_VALS]:
            register('event', event, plugin)
357572
def OrEvent(*events):
    '''
    
    '''
    or_event = threading.Event()

    def changed():
        '''
        Set ``or_event`` if any of the specified events have been set.
        '''
        bools = [event_i.is_set() for event_i in events]
        if any(bools):
            or_event.set()
        else:
            or_event.clear()
    for event_i in events:
        # Override ``set`` and ``clear`` methods on event to update state of
        # `or_event` after performing default behaviour.
        orify(event_i, changed)

    # Set initial state of `or_event`.
    changed()
    return or_event
1267919
def get_events(self):
        '''
        
        '''
        ret = []
        while True:
            event = self.event.get_event(wait=1, full=True)
            if event is None:
                return ret
            ret.append(event)
366045
def bind_events(self, events):
        '''
        '''
        evs = self._events
        if evs and events:
            for event in evs.values():
                if event.name in events:
                    event.bind(events[event.name])
184950
def get_listeners(self, event_type: str) -> List[Callable]:
        """"""
        if event_type not in self.events:
            raise ValueError(f'No event {event_type} in system.')
        return self.events.get_listeners(event_type)
1181460
def event_type(self, event, cameo_code) -> List[str]:
        
        key = self.event_name[event]
        entry = self.mapping.get(cameo_code)
        result = None
        if entry:
            result = entry[key]
            if result is None or result == "":
                return None
            elif not isinstance(result, list):
                result = [result]
        return result
842420
def trigger (self, event, *args, **kwargs):
        
        if self._events.has_key(event):
            for _callback in self._events[event]:
                try:
                    _callback(args, kwargs)
                except TypeError:
                    _callback()
434497
def __callback(self, event, *args, **kwargs):
        # type: (str, *Any, **Any) -> Any
        
        comp_callback = self.context.get_callback(event)
        if not comp_callback:
            # No registered callback
            return True

        # Call it
        result = comp_callback(self.instance, *args, **kwargs)
        if result is None:
            # Special case, if the call back returns nothing
            return True

        return result
261328
function(typeEvents) {
    var elemClasses, elemClass;

    // Iterate over previously passed elements to check for any delegated events
    var activePathLength = activePath.length;
    for (var i = 0; i < activePathLength; i++) {
      elemClasses = activePath[i].classes;
      // Once stopPropagation is called stop
      if (!evt.isPropagationStopped()) {
        var elemClassesLength = elemClasses.length;
        for (var j = 0; j < elemClassesLength; j++) {
          elemClass = elemClasses[j];
          if (typeEvents[elemClass]) {
            triggerEventFunctions(activePath[i].element, typeEvents[elemClass], elemClass, elem);
          }
        }
      }
    }

    // Check for any non-delegated events
    if (!evt.isPropagationStopped() && typeEvents.self) {
      triggerEventFunctions(elem, typeEvents.self);
    }
  }
743952
function(type, event, handler) {
        _.parsers.forEach(function(parser) {
            type = type.replace(parser[0], function() {
                var args = _.slice(arguments, 1);
                args.unshift(event, handler);
                return parser[1].apply(event, args) || '';
            });
        });
        return type ? event.type = type : type;
    }