Updates the counters.

    Args:
      event (EventObject): event.
420633
def _UpdateCounters(self, event):
    
    self._session.parsers_counter['total'] += 1

    # Here we want the name of the parser or plugin not the parser chain.
    parser_name = getattr(event, 'parser', '')
    _, _, parser_name = parser_name.rpartition('/')
    if not parser_name:
      parser_name = 'N/A'
    self._session.parsers_counter[parser_name] += 1
62114
def on_event(self, event):
        
        self._queue.append((event))
        if not self._active and self.plot.document:
            self.plot.document.add_timeout_callback(self.process_on_event, 50)
            self._active = True
884857
def timerEvent(self, event):
        
        if event.timerId() == self._hide_timer.timerId():
            self._hide_timer.stop()
            self.hide()
515669
def trigger(self, event, **kwargs):
        
        with self._handlers.trigger_mutex:
            event = prime_event(event, self.__class__.__name__, **kwargs)

            for handler in self._handlers.async_handlers[event]:
                asynchronous(handler, event)
            for handler in self._handlers.sync_handlers[event]:
                synchronous(handler, event)
78200
def _update_event_type(self_, watcher, event, triggered):
        
        if triggered:
            event_type = 'triggered'
        else:
            event_type = 'changed' if watcher.onlychanged else 'set'
        return Event(what=event.what, name=event.name, obj=event.obj, cls=event.cls,
                     old=event.old, new=event.new, type=event_type)
1038418
def _updateEndpoints(self,*args,**kwargs):
        

        sender = self.sender()
        if not self.ignoreEvents:
            self.ignoreEvents = True

            for binding in self.bindings.values():
                if binding.instanceId == id(sender):
                    continue
                
                if args: 
                    binding.setter(*args,**kwargs)
                else:
                    binding.setter(self.bindings[id(sender)].getter())

            self.ignoreEvents = False
245652
def update_event(self, event, action, flags):
        
        if action == PYCBC_EVACTION_UNWATCH:
            if event.flags & LCB_READ_EVENT:
                self.reactor.removeReader(event)
            if event.flags & LCB_WRITE_EVENT:
                self.reactor.removeWriter(event)

        elif action == PYCBC_EVACTION_WATCH:
            if flags & LCB_READ_EVENT:
                self.reactor.addReader(event)
            if flags & LCB_WRITE_EVENT:
                self.reactor.addWriter(event)

            if flags & LCB_READ_EVENT == 0:
                self.reactor.removeReader(event)
            if flags & LCB_WRITE_EVENT == 0:
                self.reactor.removeWriter(event)
678992
def time( event )
      sync {stats[event].mark}
      yield
    ensure
      sync {stats[event].tick}
    end
357233
def set_event(self, event):
        
        self._lock.acquire()
        try:
            self._event = event
            # Make sure the event starts in `set` state if we appear to already
            # be closed; otherwise, if we start in `clear` state & are closed,
            # nothing will ever call `.feed` and the event (& OS pipe, if we're
            # wrapping one - see `Channel.fileno`) will permanently stay in
            # `clear`, causing deadlock if e.g. `select`ed upon.
            if self._closed or len(self._buffer) > 0:
                event.set()
            else:
                event.clear()
        finally:
            self._lock.release()
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
601504
def _event_funcs(self, event: str) -> Iterable[Callable]:
        
        for func in self._events[event]:
            yield func
504584
def on(self, event: str) -> Callable:
        

        def outer(func):
            self.add_event(func, event)

            @wraps(func)
            def wrapper(*args, **kwargs):
                return func(*args, **kwargs)

            return wrapper

        return outer
94323
def update_counts(self, current):
        
        for item in current:
            try:
                self.counts[item] += 1
            except KeyError:
                self.counts[item] = 1
474976
async def trigger(self, event, kwargs):
        
        await self._queue.put((event, kwargs))
        self._resume_processing.set()
269709
def put(self, event, *args, **kwargs):
        
        self._queue.put((event, args, kwargs))
5673
def update_callback(self, handle, events):
        """"""
        if self._poll is None:
            raise RuntimeError('poll instance is closed')
        if not has_callback(self, handle):
            raise ValueError('no such callback')
        if events & ~(READABLE|WRITABLE):
            raise ValueError('illegal event mask: {}'.format(events))
        if handle.extra == events:
            return
        if handle.extra & READABLE:
            self._readers -= 1
        if handle.extra & WRITABLE:
            self._writers -= 1
        if events & READABLE:
            self._readers += 1
        if events & WRITABLE:
            self._writers += 1
        handle.extra = events
        self._sync()
1066131
def set_event_handler(self, event_handler):
        '''
        
        '''
        assert not self._run_io_loop_sync

        if not self.cpub:
            self.connect_pub()

        self.subscriber.callbacks.add(event_handler)
        if not self.subscriber.reading:
            # This will handle reconnects
            return self.subscriber.read_async()