Replay events, building up the state of the aggregate.
 Used by Repository.
978206
def apply_events(events)
      events.each do |event|
        method_name = event_handler(event)
        public_send(method_name, event.data) if respond_to?(method_name)
      end
      @revision = events.last&.revision.to_i if events.last.respond_to?(:revision)
    end
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
450510
def getEvents(self, repo_user, repo_name, until_id=None):
        """"""
        done = False
        page = 0
        events = []
        while not done:
            new_events = yield self.api.makeRequest(
                    ['repos', repo_user, repo_name, 'events'],
                    page)

            # terminate if we find a matching ID
            if new_events:
                for event in new_events:
                    if event['id'] == until_id:
                        done = True
                        break
                    events.append(event)
            else:
                done = True

            page += 1
        defer.returnValue(events)
393734
def emulate_repeat(self, value, timeval):
        """"""
        repeat_event = self.create_event_object(
            "Repeat",
            2,
            value,
            timeval)
        return repeat_event
952833
def start_record():
    
    global record, playback, current
    if record:
        raise StateError("Already recording.")
    if playback:
        raise StateError("Currently playing back.")
    record = True
    current = ReplayData()
    install(RecordingHTTPConnection, RecordingHTTPSConnection)
626724
def train_on_replay_memory(self, batch_info):
        
        self.model.train()

        # Algo will aggregate data into this list:
        batch_info['sub_batch_data'] = []

        for i in range(self.settings.training_rounds):
            sampled_rollout = self.env_roller.sample(batch_info, self.model, self.settings.training_steps)

            batch_result = self.algo.optimizer_step(
                batch_info=batch_info,
                device=self.device,
                model=self.model,
                rollout=sampled_rollout.to_device(self.device)
            )

            self.env_roller.update(rollout=sampled_rollout, batch_info=batch_result)

            batch_info['sub_batch_data'].append(batch_result)

        batch_info.aggregate_key('sub_batch_data')
979385
def aggregate(self, event):
        """"""

        total = event.null()
        for function in compat_itervalues(self.functions):
            try:
                total = event.aggregate(total, function[event])
            except UndefinedEvent:
                return
        self[event] = total
1042580
public void replay(ReplayCallback replayCallback)
  {
    TempBuffer tReadBuffer = TempBuffer.createLarge();
    byte []readBuffer = tReadBuffer.buffer();
    int bufferLength = readBuffer.length;

    try (InStore jIn = _blockStore.openRead(_startAddress, getSegmentSize())) {
      Replay replay = readReplay(jIn);

      if (replay == null) {
        return;
      }
      
      long address = replay.getCheckpointStart();
      long next;
      
      setSequence(replay.getSequence());

      TempBuffer tBuffer = TempBuffer.create();
      byte []tempBuffer = tBuffer.buffer();
      
      jIn.read(getBlockAddress(address), readBuffer, 0, bufferLength);
      ReadStream is = new ReadStream();
      
      while (address < _tailAddress
             && (next = scanItem(jIn, address, readBuffer, tempBuffer)) > 0) {
        boolean isOverflow = getBlockAddress(address) != getBlockAddress(next);
        
        // if scanning has passed the buffer boundary, need to re-read
        // the initial buffer
        if (isOverflow) {
          jIn.read(getBlockAddress(address), readBuffer, 0, bufferLength);
        }
      
        ReplayInputStream rIn = new ReplayInputStream(jIn, readBuffer, address);
        
        is.init(rIn);

        try {
          replayCallback.onItem(is);
        } catch (Exception e) {
          e.printStackTrace();
          log.log(Level.FINER, e.toString(), e);
        }
      
        address = next;
        
        if (isOverflow) {
          jIn.read(getBlockAddress(address), readBuffer, 0, bufferLength);
        }
        
        _index = address;
        _flushIndex = address;
      }
    }
  }
638468
def Reload(self):
    
    with self._generator_mutex:
      for event in self._generator.Load():
        self._ProcessEvent(event)
    return self
1299479
def run(self):
        """"""
        while True:
            try:
                cursor = JSON_CLIENT.json_client['local']['oplog.rs'].find(
                    {'ts': {'$gt': self.last_timestamp}})
            except TypeError:
                # filesystem, so .json_client is a bool and not iterable
                pass
            else:
                # http://stackoverflow.com/questions/30401063/pymongo-tailing-oplog
                cursor.add_option(2)  # tailable
                cursor.add_option(8)  # oplog_replay
                cursor.add_option(32)  # await data
                self._retry()
                for doc in cursor:
                    self.last_timestamp = doc['ts']
                    if doc['ns'] in self.receivers:
                        self._run_namespace(doc)
            time.sleep(1)
394835
def replay(self, start_block=1, end_block=None, filter_by=list(), **kwargs):
        
        return self.stream(
            filter_by=filter_by,
            start=start_block,
            stop=end_block,
            mode=self.mode,
            **kwargs
        )
476785
def capture_update_records(records):
    """"""
    for rec in records:
        data = cloudwatch.get_historical_base_info(rec)
        group = describe_group(rec, cloudwatch.get_region(rec))

        if len(group) > 1:
            raise Exception(f'[X] Multiple groups found. Record: {rec}')

        if not group:
            LOG.warning(f'[?] No group information found. Record: {rec}')
            continue

        group = group[0]

        # Determine event data for group - and pop off items that are going to the top-level:
        LOG.debug(f'Processing group. Group: {group}')
        data.update({
            'GroupId': group['GroupId'],
            'GroupName': group.pop('GroupName'),
            'VpcId': group.pop('VpcId', None),
            'arn': get_arn(group.pop('GroupId'), cloudwatch.get_region(rec), group.pop('OwnerId')),
            'Region': cloudwatch.get_region(rec)
        })

        data['Tags'] = pull_tag_dict(group)

        # Set the remaining items to the configuration:
        data['configuration'] = group

        # Set the version:
        data['version'] = VERSION

        LOG.debug(f'[+] Writing Dynamodb Record. Records: {data}')
        current_revision = CurrentSecurityGroupModel(**data)
        current_revision.save()
1054796
public function replay()
    {
        $mockClassName = parent::replay();

        $mockClassReflector = new \ReflectionClass($mockClassName);
        return $mockClassReflector->newInstanceArgs($this->constructor_arguments);
    }
1108815
def build
      # handle recuring events
      @local_event.tap do |le|
        if @event.rrule.present?
          @rrule = @event.rrule.first # only support recurrence on one schedule
          # set out new event's basic rucurring properties
          le.attributes = recurrence_attributes

          set_date_exclusion
          frequency_set
        else # make sure we remove this if it changed
          le.attributes = non_recurrence_attributes
        end
      end
    end
878837
def replay_data(self, replay_path):
    """"""
    with gfile.Open(self.abs_replay_path(replay_path), "rb") as f:
      return f.read()
219525
def geist_replay(wrapped, instance, args, kwargs):
    """"""
    path_parts = []
    file_parts = []

    if hasattr(wrapped, '__module__'):
        module = wrapped.__module__
        module_file = sys.modules[module].__file__
        root, _file = os.path.split(module_file)
        path_parts.append(root)
        _file, _ = os.path.splitext(_file)
        file_parts.append(_file)
    if hasattr(wrapped, '__objclass__'):
        file_parts.append(wrapped.__objclass__.__name__)
    elif hasattr(wrapped, '__self__'):
        file_parts.append(wrapped.__self__.__class__.__name__)
    file_parts.append(wrapped.__name__ + '.log')
    path_parts.append('_'.join(file_parts))
    filename = os.path.join(*path_parts)

    if is_in_record_mode():
        platform_backend = get_platform_backend()
        backend = RecordingBackend(
            source_backend=platform_backend,
            recording_filename=filename
        )
    else:
        backend = PlaybackBackend(
            recording_filename=filename
        )
    gui = GUI(backend)
    return wrapped(gui, *args, **kwargs)
629860
def on_batch_end(self):
        
        for callback in self.callbacks:
            callback.on_batch_end(self)

        # Even with all the experience replay, we count the single rollout as a single batch
        self.epoch_info.result_accumulator.calculate(self)