def __call__(self, *args, **kwargs):
        """ __call__(**kwargs)
        Invoke all callbacks for this emitter.

        Emit a new event object, created with the given keyword
        arguments, which must match with the input arguments of the
        corresponding event class. Note that the 'type' argument is
        filled in by the emitter.

        Alternatively, the emitter can also be called with an Event
        instance as the only argument. In this case, the specified
        Event will be used rather than generating a new one. This allows
        customized Event instances to be emitted and also allows EventEmitters
        to be chained by connecting one directly to another.

        Note that the same Event instance is sent to all callbacks.
        This allows some level of communication between the callbacks
        (notably, via Event.handled) but also requires that callbacks
        be careful not to inadvertently modify the Event.
        """
        # This is a VERY highly used method; must be fast!
        blocked = self._blocked
        if self._emitting:
            raise RuntimeError('EventEmitter loop detected!')

        # create / massage event as needed
        event = self._prepare_event(*args, **kwargs)

        # Add our source to the event; remove it after all callbacks have been
        # invoked.
        event._push_source(self.source)
        self._emitting = True
        try:
            if blocked.get(None, 0) > 0:  # this is the same as self.blocked()
                return event

            rem = []
            for cb in self._callbacks:
                if isinstance(cb, tuple):
                    obj = cb[0]()
                    if obj is None:
                        rem.append(cb)
                        continue
                    cb = getattr(obj, cb[1], None)
                    if cb is None:
                        continue
                
                if blocked.get(cb, 0) > 0:
                    continue
                
                self._invoke_callback(cb, event)
                if event.blocked:
                    break
                
            # remove callbacks to dead objects
            for cb in rem:
                self.disconnect(cb)
        finally:
            self._emitting = False
            if event._pop_source() != self.source:
                raise RuntimeError("Event source-stack mismatch.")

        return event
def __call__ ( self , * args , ** kwargs ) : blocked = self . _blocked if self . _emitting : raise RuntimeError ( 'EventEmitter loop detected!' ) event = self . _prepare_event ( * args , ** kwargs ) event . _push_source ( self . source ) self . _emitting = True try : if blocked . get ( None , 0 ) > 0 : return event rem = [ ] for cb in self . _callbacks : if isinstance ( cb , tuple ) : obj = cb [ 0 ] ( ) if obj is None : rem . append ( cb ) continue cb = getattr ( obj , cb [ 1 ] , None ) if cb is None : continue if blocked . get ( cb , 0 ) > 0 : continue self . _invoke_callback ( cb , event ) if event . blocked : break for cb in rem : self . disconnect ( cb ) finally : self . _emitting = False if event . _pop_source ( ) != self . source : raise RuntimeError ( "Event source-stack mismatch." ) return event
__call__(**kwargs)
        Invoke all callbacks for this emitter.

        Emit a new event object, created with the given keyword
        arguments, which must match with the input arguments of the
        corresponding event class. Note that the 'type' argument is
        filled in by the emitter.

        Alternatively, the emitter can also be called with an Event
        instance as the only argument. In this case, the specified
        Event will be used rather than generating a new one. This allows
        customized Event instances to be emitted and also allows EventEmitters
        to be chained by connecting one directly to another.

        Note that the same Event instance is sent to all callbacks.
        This allows some level of communication between the callbacks
        (notably, via Event.handled) but also requires that callbacks
        be careful not to inadvertently modify the Event.