Iterates (in chronological order) over all events that are occuring during `instant`.

        Args:
            instant (Arrow object)
160576
def at(self, instant):
        

        for event in self:
            if event.begin <= instant <= event.end:
                yield event
651520
def _trigger_event(self, event):
    

    if event is None or event not in self.__listeners:
      raise ValueError('invalid event type: {0!r}'.format(event))

    # Check the event has not already been triggered, then mark
    # the event as triggered.
    if event in self.__event_set:
      raise RuntimeError('event already triggered: {0!r}'.format(event))
    self.__event_set.add(event)
    listeners = self.__listeners[event] + self.__listeners[None]

    # Remove one-off listeners.
    self.__listeners[event][:] = (l for l in self.__listeners[event] if not l.once)
    self.__listeners[None][:] = (l for l in self.__listeners[None] if not l.once)

    for listener in listeners:
      # XXX: What to do on exceptions? Catch and make sure all listeners
      # run through? What to do with the exception(s) then?
      listener.callback(self, event)
641164
def each
      begin
        loop do
          event = read
          if event
            next unless ALLOWED_EVENT_TYPES.include?(event.type)
            yield event
          end
        end
      rescue Errno::ENODEV
      end
    end
1178825
def events(self):
        # type: () -> Generator[Event, None, None]
        
        while self._events:
            yield self._events.popleft()

        try:
            for frame in self._proto.received_frames():
                if frame.opcode is Opcode.PING:
                    assert frame.frame_finished and frame.message_finished
                    yield Ping(payload=frame.payload)

                elif frame.opcode is Opcode.PONG:
                    assert frame.frame_finished and frame.message_finished
                    yield Pong(payload=frame.payload)

                elif frame.opcode is Opcode.CLOSE:
                    code, reason = frame.payload
                    if self.state is ConnectionState.LOCAL_CLOSING:
                        self._state = ConnectionState.CLOSED
                    else:
                        self._state = ConnectionState.REMOTE_CLOSING
                    yield CloseConnection(code=code, reason=reason)

                elif frame.opcode is Opcode.TEXT:
                    yield TextMessage(
                        data=frame.payload,
                        frame_finished=frame.frame_finished,
                        message_finished=frame.message_finished,
                    )

                elif frame.opcode is Opcode.BINARY:
                    yield BytesMessage(
                        data=frame.payload,
                        frame_finished=frame.frame_finished,
                        message_finished=frame.message_finished,
                    )
        except ParseFailed as exc:
            yield CloseConnection(code=exc.code, reason=str(exc))
643655
public void printTo(StringBuilder buf, long instant) {
        try {
            printTo((Appendable) buf, instant);
        } catch (IOException ex) {
            // StringBuilder does not throw IOException
        }
    }
1294791
def add_event(self, event, prepend=False):
        
        if prepend:
            self._events.insert(0, event)
        else:
            self._events.append(event)
952331
function createTimeline(numEvents, baseIndex) {
    if (numEvents === undefined) {
        numEvents = 3;
    }
    if (baseIndex === undefined) {
        baseIndex = 1;
    }

    // XXX: this is a horrid hack
    const timelineSet = { room: { roomId: ROOM_ID }};
    timelineSet.room.getUnfilteredTimelineSet = function() {
        return timelineSet;
    };

    const timeline = new EventTimeline(timelineSet);

    // add the events after the baseIndex first
    addEventsToTimeline(timeline, numEvents - baseIndex, false);

    // then add those before the baseIndex
    addEventsToTimeline(timeline, baseIndex, true);

    expect(timeline.getBaseIndex()).toEqual(baseIndex);
    return timeline;
}
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)
1352012
def run(self, once=True):
        
        print(Color("{autored}\n====== System round %s ======{/red}" % self.turn))
        print(Color("{autoblue}== Updating actors events...{/blue}"))
        # Handling OUT messages
        for a in self.actors:
            if self.turn < len(a.events):
                es = a.events[self.turn]
                for e in es:
                    if e.e_type == Actor.Event.EventType.OUT:
                        # register
                        # print("Sending from %s to %s %s" % (a.name, e.target, a.get_kv()))
                        if e.target is "*":
                            print("Broadcasting")
                            for ac in self.actors:
                                self.coms["%s->%s" % (a.name, ac.name)].append(copy.deepcopy(a.get_kv()))
                        else:
                            self.coms["%s->%s" % (a.name, e.target)].append(copy.deepcopy(a.get_kv()))

        # Handling IN messages
        for a in self.actors:
            if self.turn < len(a.events):
                es = a.events[self.turn]
                for e in es:
                    if e.e_type == Actor.Event.EventType.IN:
                        # Update KV and check pop the send
                        print("%s received a message from %s ..." % (a.name, e.target))
                        if len(self.coms["%s->%s" % (e.target, a.name)]) > 0:
                            a.update_kv(self.coms["%s->%s" % (e.target, a.name)].pop(0))
                            print(" - IN %s %s" % (a.name, a.get_kv()))
                        else:
                            print(" - Error %s trying to receive a message from %s that was not sent by %s" % (a.name, e.target, e.target))

        print(Color("{autoblue}\n== Running monitors on each actor...{/blue}"))
        for a in self.actors:
            for i in range(a.speed):
                a.run(once=once)
        self.turn += 1
1170293
def run_once(self):
        
        packet = _parse_irc_packet(next(self.lines)) #Get next line from generator

        for event_handler in list(self.on_packet_received):
            event_handler(self, packet)

        if packet.command == "PRIVMSG":
            if packet.arguments[0].startswith("#"):
                for event_handler in list(self.on_public_message):
                    event_handler(self, packet.arguments[0], packet.prefix.split("!")[0], packet.arguments[1])
            else:
                for event_handler in list(self.on_private_message):
                    event_handler(self, packet.prefix.split("!")[0], packet.arguments[1])
        elif packet.command == "PING":
            self.send_line("PONG :{}".format(packet.arguments[0]))

            for event_handler in list(self.on_ping):
                event_handler(self)
        elif packet.command == "433" or packet.command == "437":
            #Command 433 is "Nick in use"
            #Add underscore to the nick

            self.set_nick("{}_".format(self.nick))
        elif packet.command == "001":
            for event_handler in list(self.on_welcome):
                event_handler(self)
        elif packet.command == "JOIN":
            for event_handler in list(self.on_join):
                event_handler(self, packet.arguments[0], packet.prefix.split("!")[0])
        elif packet.command == "PART":
            for event_handler in list(self.on_leave):
                event_handler(self, packet.arguments[0], packet.prefix.split("!")[0])
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)
1246940
def ObjectInitializedEventHandler(obj, event):
    

    # only snapshot supported objects
    if not supports_snapshots(obj):
        return

    # object has already snapshots
    if has_snapshots(obj):
        return

    # take a new snapshot
    take_snapshot(obj, action="create")
495444
function instantSearch() {

    const q = $("#searchbox").val();
    if (q === '')
        return;

    const matcher = "/matcher?beginsWith=" + q;
    const request = host + matcher;

    console.debug(request);

    $.getJSON(request, '', {})
        .done(data => {

            $("#searchbox").autocomplete({
                source: data,
                select: (event) => {
                    event.stopPropagation();
                    $("#search").trigger("click");
                }
            });
        })
        .fail((d, textStatus, error) => {

            const err = d.status + " " + error + " -> message: " + d.responseText;
            bootstrapAlert.error(err);
            console.error(`Search request failed: \n ${err}`);
        });
}
1291975
def trigger_event(event=None, **kwargs):
    '''
    
    '''

    res = {'result': False, 'message': 'Something went wrong'}

    data = {}
    for value in ('value1', 'value2', 'value3',
                  'Value1', 'Value2', 'Value3'):
        if value in kwargs:
            data[value.lower()] = kwargs[value]
    data['occurredat'] = time.strftime("%B %d, %Y %I:%M%p", time.localtime())
    result = _query(event=event,
                    method='POST',
                    data=salt.utils.json.dumps(data)
                    )
    if 'status' in result:
        if result['status'] == 200:
            res['result'] = True
            res['message'] = result['text']
        else:
            if 'error' in result:
                res['message'] = result['error']
    return res
1282632
public void doEvents() {
		while (!isInterrupted()) {
			Iterator<Map.Entry<Timer, Runnable>> it = timerMap.entrySet().iterator();
			if (it.hasNext()) {
				long timeout = it.next().getKey().uptime - System.currentTimeMillis();
				doEvents(timeout > 0 ? timeout : 0);
			} else {
				doEvents(-1);
			}
		}
	}
354609
def operate_and_get_next(event):
    
    buff = event.current_buffer
    new_index = buff.working_index + 1

    # Accept the current input. (This will also redraw the interface in the
    # 'done' state.)
    buff.accept_action.validate_and_handle(event.cli, buff)

    # Set the new index at the start of the next run.
    def set_working_index():
        if new_index < len(buff._working_lines):
            buff.working_index = new_index

    event.cli.pre_run_callables.append(set_working_index)
1144164
void init(long index, Instant instant, ServerStateMachineContext.Type type) {
    context.update(index, instant, type);
  }