Takes an event dict.  Logs the event if needed and cleans up the dict
        such as setting the index needed for composits.
494389
def dispatch_event(self, event):
        
        if self.config["debug"]:
            self.py3_wrapper.log("received event {}".format(event))

        # usage variables
        event["index"] = event.get("index", "")
        instance = event.get("instance", "")
        name = event.get("name", "")

        # composites have an index which is passed to i3bar with
        # the instance.  We need to separate this out here and
        # clean up the event.  If index
        # is an integer type then cast it as such.
        if " " in instance:
            instance, index = instance.split(" ", 1)
            try:
                index = int(index)
            except ValueError:
                pass
            event["index"] = index
            event["instance"] = instance

        if self.config["debug"]:
            self.py3_wrapper.log(
                'trying to dispatch event to module "{}"'.format(
                    "{} {}".format(name, instance).strip()
                )
            )

        # guess the module config name
        module_name = "{} {}".format(name, instance).strip()

        default_event = False
        module_info = self.output_modules.get(module_name)
        module = module_info["module"]
        # execute any configured i3-msg command
        # we do not do this for containers
        # modules that have failed do not execute their config on_click
        if module.allow_config_clicks:
            button = event.get("button", 0)
            on_click = self.on_click.get(module_name, {}).get(str(button))
            if on_click:
                task = EventClickTask(module_name, event, self, on_click)
                self.py3_wrapper.timeout_queue_add(task)
            # otherwise setup default action on button 2 press
            elif button == 2:
                default_event = True

        # do the work
        task = EventTask(module_name, event, default_event, self)
        self.py3_wrapper.timeout_queue_add(task)
1333169
def __clean_relatedevent(self, related_events):
        

        response = []
        for event in related_events:
            ev = {
                'info': event['Event']['info'],
                'id': event['Event']['id']
            }
            response.append(ev)

        return response
225031
def handle(event):
        
        def dec(func):
            if not hasattr(func, '_handle_events'):
                func._handle_events = set()
            func._handle_events.add(event)
            return func

        return dec
647395
def lambda_handler(event, context):
    ''' 
    '''
    # event is a dict containing a base64 string gzipped
    event = json.loads(gzip.GzipFile(fileobj=StringIO(event['awslogs']['data'].decode('base64'))).read())

    account = event['owner']
    region = context.invoked_function_arn.split(':', 4)[3]

    log_events = event['logEvents']

    for log_event in log_events:
        message = json.loads(log_event['message'])
        ts = log_event['timestamp'] / 1000
        _process_rds_enhanced_monitoring_message(ts, message, account, region)

    stats.flush()
    return {'Status': 'OK'}
1050812
def paintEvent(self, event):
        
        super(EncodingPanel, self).paintEvent(event)
        if self.isVisible():
            # fill background
            painter = QtGui.QPainter(self)
            self._background_brush = QtGui.QBrush(self._color)
            painter.fillRect(event.rect(), self._background_brush)
503744
def process_log_event(event, context):
    
    init()
    # Grab the actual error log payload
    serialized = event['awslogs'].pop('data')
    data = json.loads(zlib.decompress(
        base64.b64decode(serialized), 16 + zlib.MAX_WBITS))
    msg = get_sentry_message(config, data)
    if msg is None:
        return
    if config['sentry_dsn']:
        # Deliver directly to sentry
        send_sentry_message(config['sentry_dsn'], msg)
    elif config['sentry_sqs']:
        # Delivery indirectly via sqs
        sqs.send_message(
            QueueUrl=config['sentry_sqs'])
600513
private void onUpdate(EventLog log)
    {
        if (updateEvents == null)
        {
            updateEvents = new ConcurrentHashMap<Object, EventLog>();

        }

        updateEvents.put(log.getEntityId(), log);
    }
637687
def process_event(event_filter, callback, timeout_callback, timeout, args,
                      start_time=None):
        
        try:
            events = event_filter.get_all_entries()
            if events:
                callback(events[0], *args)
                return True

        except (ValueError, Exception) as err:
            # ignore error, but log it
            logger.debug(f'Got error grabbing keeper events: {str(err)}')

        if timeout:
            elapsed = int(datetime.now().timestamp()) - start_time
            if elapsed > timeout:
                if timeout_callback:
                    timeout_callback(*args)
                else:
                    callback(None, *args)

                return True

        return False
1203755
@Subscribe
    public void handleIndexSetCreation(final IndexSetCreatedEvent event) {
        final String indexSetId = event.indexSet().id();
        // We are NOT using IndexSetRegistry#get(String) here because of this: https://github.com/Graylog2/graylog2-server/issues/4625
        final Optional<IndexSetConfig> optionalIndexSet = indexSetService.get(indexSetId);

        if (optionalIndexSet.isPresent()) {
            schedule(mongoIndexSetFactory.create(optionalIndexSet.get()));
        } else {
            LOG.warn("Couldn't find newly created index set <{}>", indexSetId);
        }
    }
300934
def eventFilter( self, object, event ):
        
        if event.type() == event.Resize:
            self.resize(event.size())
            
        elif event.type() == event.Move:
            self.move(event.pos())
        
        elif event.type() == event.Close:
            self.setParent(None)
            self.deleteLater()
        
        return False
197538
protected void processEvent (DEvent event)
    {
        // look up the target object
        DObject target = _objects.get(event.getTargetOid());
        if (target == null) {
            log.debug("Event target no longer exists", "event", event);
            return;
        }

        // check the event's permissions
        if (!target.checkPermissions(event)) {
            log.warning("Event failed permissions check", "event", event, "target", target);
            return;
        }

        if (dispatchEvent(event, target)) {
            // unless requested not to, notify any proxies
            target.notifyProxies(event);
        }
    }
967203
def handle_event(self, event):
        
        result_id, ptr, method, args = event[1]
        obj = None
        result = None
        try:
            obj, handler = bridge.get_handler(ptr, method)
            result = handler(*[v for t, v in args])
        except bridge.BridgeReferenceError as e:
            #: Log the event, don't blow up here
            msg = "Error processing event: {} - {}".format(
                  event, e).encode("utf-8")
            print(msg)
            self.show_error(msg)
        except:
            #: Log the event, blow up in user's face
            msg = "Error processing event: {} - {}".format(
                  event, traceback.format_exc()).encode("utf-8")
            print(msg)
            self.show_error(msg)
            raise
        finally:
            if result_id:
                if hasattr(obj, '__nativeclass__'):
                    sig = getattr(type(obj), method).__returns__
                else:
                    sig = type(result).__name__

                self.send_event(
                    bridge.Command.RESULT,  #: method
                    result_id,
                    bridge.msgpack_encoder(sig, result)  #: args
                )
548047
def process(event_name, data):
    
    deserialized = loads(data)
    event_cls = find_event(event_name)
    event = event_cls(event_name, deserialized)
    try:
        event.clean()
    except ValidationError as exc:
        if os.environ.get('EVENTLIB_RAISE_ERRORS'):
            raise
        else:
            logger.warning(
                "The event system just got an exception while cleaning "
                "data for the event '{}'\ndata: {}\nexc: {}".format(
                    event_name, data, str(exc)))
            return

    for handler in find_handlers(event_name):
        try:
            handler(deserialized)
        except Exception as exc:
            logger.warning(
                (u'One of the handlers for the event "{}" has failed with the '
                 u'following exception: {}').format(event_name, str(exc)))
            if getsetting('DEBUG'):
                raise exc
    event._broadcast()
429020
def filter_event(tag, data, defaults):
    '''
    
    '''
    ret = {}
    keys = []
    use_defaults = True

    for ktag in __opts__.get('filter_events', {}):
        if tag != ktag:
            continue
        keys = __opts__['filter_events'][ktag]['keys']
        use_defaults = __opts__['filter_events'][ktag].get('use_defaults', True)

    if use_defaults is False:
        defaults = []

    # For PY3, if something like ".keys()" or ".values()" is used on a dictionary,
    # it returns a dict_view and not a list like in PY2. "defaults" should be passed
    # in with the correct data type, but don't stack-trace in case it wasn't.
    if not isinstance(defaults, list):
        defaults = list(defaults)

    defaults = list(set(defaults + keys))

    for key in defaults:
        if key in data:
            ret[key] = data[key]

    return ret
57492
def handle(self, event):
        
        callback = getattr(self, 'on_{event}'.format(event=event.event), None)
        callback(event)
861526
private void onDelete(EventLog log)
    {
        if (deleteEvents == null)
        {
            deleteEvents = new ConcurrentHashMap<Object, EventLog>();
        }

        deleteEvents.put(log.getEntityId(), log);

    }
956146
def rebase_event(self, event):
        
        new_event = copy(event)
        if isinstance(new_event, MouseEvent):
            origin = self._canvas.origin
            new_event.x -= origin[0]
            new_event.y -= origin[1] - self._canvas.start_line
        logger.debug("New event: %s", new_event)
        return new_event