Create a new event which is a copy of this one but with a new index.
352263
def split(self, new_index):
        
        new_event = Event(new_index, self.user_data)
        new_event.time = self.time
        new_event.step_size = self.step_size
        return new_event
149395
function createEvent(config) {
  const { type, target } = config;
  const eventObject = new Event(type);

  if (target) {
    eventObject.target = target;
    eventObject.srcElement = target;
    eventObject.currentTarget = target;
  }

  return eventObject;
}
1017875
def event(self, name, owner=None, **kwargs):
        
        return Event(self.tcex, name, owner=owner, **kwargs)
522918
def new_event(self, event_data: str) -> None:
        """"""
        event = self.parse_event_xml(event_data)

        if EVENT_OPERATION in event:
            self.manage_event(event)
1134841
def _copy_with_changed_callback(self, new_callback):
        '''  '''
        return PeriodicCallback(self._document, new_callback, self._period, self._id)
477885
function( index ) {
			var cloneChildren = this.children.splice( index, this.children.length - index ),
				clone = this.clone();

			for ( var i = 0; i < cloneChildren.length; ++i )
				cloneChildren[ i ].parent = clone;

			clone.children = cloneChildren;

			if ( cloneChildren[ 0 ] )
				cloneChildren[ 0 ].previous = null;

			if ( index > 0 )
				this.children[ index - 1 ].next = null;

			this.parent.add( clone, this.getIndex() + 1 );

			return clone;
		}
521110
public void put(int index, Scriptable start, Object value) {
        if (start == this) {
            synchronized (this) {
                indexedProps.put(new Integer(index), value);
            }
        } else {
            start.put(index, start, value);
        }
    }
460055
def create_event(self, last_state, state, clean_server_name, replset_name):
        """"""

        status = self.get_state_description(state)
        short_status = self.get_state_name(state)
        last_short_status = self.get_state_name(last_state)
        hostname = self.hostname_for_event(clean_server_name)
        msg_title = "%s is %s for %s" % (hostname, short_status, replset_name)
        msg = "MongoDB %s (%s) just reported as %s (%s) for %s; it was %s before."
        msg = msg % (hostname, clean_server_name, status, short_status, replset_name, last_short_status)

        self.event(
            {
                'timestamp': int(time.time()),
                'source_type_name': self.SOURCE_TYPE_NAME,
                'msg_title': msg_title,
                'msg_text': msg,
                'host': hostname,
                'tags': [
                    'action:mongo_replset_member_status_change',
                    'member_status:' + short_status,
                    'previous_member_status:' + last_short_status,
                    'replset:' + replset_name,
                ],
            }
        )
1362852
def on(self, event, handler=None):
        """"""
        if isinstance(event, str) and ' ' in event:  # event is list str-based
            self.on(event.split(' '), handler)
        elif isinstance(event, list):  # many events contains same handler
            for each in event:
                self.on(each, handler)
        elif isinstance(event, dict):  # event is a dict of <event, handler>
            for key, value in event.items():
                self.on(key, value)
        elif isinstance(handler, list):  # handler is a list of handlers
            for each in handler:
                self.on(event, each)
        elif isinstance(handler, Event):  # handler is Event object
            self.events[event] = handler  # add or update an event
            setattr(self, event, self.events[event])  # self.event.trigger()
        elif event in self.events:  # add a handler to an existing event
            self.events[event].on(handler)
        else:  # create new event with a handler attached
            self.on(event, Event(handler))
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)
197990
def create(cls, receiver_id, user_id=None):
        """"""
        event = cls(id=uuid.uuid4(), receiver_id=receiver_id, user_id=user_id)
        event.payload = event.receiver.extract_payload()
        return event
247578
def create(*events):
    
    or_event = threading.Event()

    def changed():
        if any([event.is_set() for event in events]):
            or_event.set()
        else:
            or_event.clear()

    for e in events:
        orify(e, changed)

    changed()
    return or_event
565910
def copy_many_times_events(self, other):
        '''
        '''
        events = self.events()
        other_events = other.events()
        if events and other_events:
            for name, event in other_events.items():
                handlers = event.handlers()
                if not event.onetime() and handlers:
                    ev = events.get(name)
                    # If the event is available add it
                    if ev:
                        for callback in handlers:
                            ev.bind(callback)
1053427
def add_event(self, key, event):
        """"""
        if key in self.keys or key in self.events:
            raise EventStore.EventKeyAlreadyExistError(
                "The key already existed: {0}".format(key))
        self.keys.append(key)
        # Important no exceptions happen between these lines!
        self.events[key] = event
1125874
def copy(self, overrides=None, locked=False):
        """"""
        other = copy.copy(self)

        if overrides is not None:
            other.overrides = overrides

        other.locked = locked

        other._uncache()
        return other
1336356
def create_index(self, key, reindex=True, sparse=False):
        
        warnings.warn('Index support is currently very alpha and is not guaranteed')
        if isinstance(key, (list, tuple)):
            index_name = ','.join(key)
            index_columns = ', '.join('%s text' % f for f in key)
        else:
            index_name = key
            index_columns = '%s text' % key

        table_name = '[%s{%s}]' % (self.name, index_name)
        reindex = reindex or not self._object_exists('table', table_name)

        # Create a table store for the index data
        self.db.execute("""
            create table if not exists {table} (
                id integer primary key,
                {columns},
                foreign key(id) references {collection}(id) on delete cascade on update cascade
            )
        """.format(
            table=table_name,
            collection=self.name,
            columns=index_columns
        ))

        # Create the index
        self.db.execute("""
            create index if not exists [idx.{collection}{{index}}] on {table}({index})
        """.format(
            collection=self.name,
            index=index_name,
            table=table_name,
        ))

        if reindex:
            self.reindex(key)
660913
public void add(int index, XEvent event) {
		try {
			events.insert(event, index);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}