move deltas to on-disk storage, and new_deltas to deltas
497744
def tick_deltas
      unless @delta.empty?
        merge_to_db(@delta)
        @tick_delta.concat(@delta.values) if accumulate_tick_deltas
        @delta.clear
      end
      unless @new_delta.empty?
        # We allow @new_delta to contain duplicates but eliminate them here. We
        # can't just allow duplicate delta tuples because that might cause
        # spurious infinite delta processing loops.
        @new_delta.reject! {|key, val| self[key] == val}

        @delta = @new_delta
        @new_delta = {}
      end
      return !(@delta.empty?)
    end
404385
def updateSynapses(self, synapses, delta):
    
    reached0 = False

    if delta > 0:
      for synapse in synapses:
        self.syns[synapse][2] = newValue = self.syns[synapse][2] + delta

        # Cap synapse permanence at permanenceMax
        if newValue > self.tp.permanenceMax:
          self.syns[synapse][2] = self.tp.permanenceMax

    else:
      for synapse in synapses:
        self.syns[synapse][2] = newValue = self.syns[synapse][2] + delta

        # Cap min synapse permanence to 0 in case there is no global decay
        if newValue <= 0:
          self.syns[synapse][2] = 0
          reached0 = True

    return reached0
370120
def _get_delta(self, stds, dists):
        
        delta = np.maximum((0.1-0.001*dists.repi), np.zeros_like(dists.repi))
        return delta
1014000
def record_diff(lhs, rhs):
    ""
    delta = {}
    for k in set(lhs).union(rhs):
        from_ = lhs[k]
        to_ = rhs[k]
        if from_ != to_:
            delta[k] = {'from': from_, 'to': to_}

    return delta
324174
def delta(a, b):
    
    diff = a - b
    return numpy.einsum("i...,i...->...", diff, diff)
530585
def __update_offset_table(self, fileobj, fmt, atom, delta, offset):
        """"""
        if atom.offset > offset:
            atom.offset += delta
        fileobj.seek(atom.offset + 12)
        data = fileobj.read(atom.length - 12)
        fmt = fmt % cdata.uint_be(data[:4])
        offsets = struct.unpack(fmt, data[4:])
        offsets = [o + (0, delta)[offset < o] for o in offsets]
        fileobj.seek(atom.offset + 16)
        fileobj.write(struct.pack(fmt, *offsets))
1039665
def update(self, deltat=1.0):
        ''''''
        DNFZ.update(self, deltat)
        self.lifetime -= deltat
        if self.lifetime <= 0:
            self.randpos()
            self.lifetime = random.uniform(300,600)
1363014
def deltas(last, now):
    """"""
    return {
        xy: RouterDiagnostics(*((n - l) & 0xFFFFFFFF
                                for l, n in zip(last[xy], now[xy])))
        for xy in last
    }
359213
def _compress_for_consolidate(max_vol, plan, **kwargs):
    
    target = None
    new_target = None
    d_vol = 0
    temp_aspirates = []
    new_transfer_plan = []

    def _append_aspirates():
        nonlocal d_vol, temp_aspirates, new_transfer_plan, target
        if not temp_aspirates:
            return
        for a in temp_aspirates:
            new_transfer_plan.append({
                'aspirate': {
                    'location': a['location'], 'volume': a['volume']
                }
            })
        new_transfer_plan.append({
            'dispense': {
                'location': target, 'volume': d_vol
            }
        })
        d_vol = 0
        temp_aspirates = []

    for i, p in enumerate(plan):
        this_vol = p['aspirate']['volume']
        new_target = p['dispense']['location']
        if (new_target is not target) or (this_vol + d_vol > max_vol):
            _append_aspirates()
        target = new_target
        d_vol += this_vol
        temp_aspirates.append(p['aspirate'])
    _append_aspirates()
    return new_transfer_plan
1338409
def advance_time_delta(timedelta):
    """"""
    assert(utcnow.override_time is not None)
    try:
        for dt in utcnow.override_time:
            dt += timedelta
    except TypeError:
        utcnow.override_time += timedelta
75010
def generate_data(self, data_dir, tmp_dir=None, task_id=-1):
    """"""
    if not self._rollouts_by_epoch_and_split[self.current_epoch]:
      # Data not loaded from disk.
      self._split_current_epoch()

    rollouts_by_split = self._rollouts_by_epoch_and_split[self.current_epoch]
    splits_and_paths = self.splits_and_paths(data_dir)

    for (split, paths) in splits_and_paths:
      rollouts = rollouts_by_split[split]
      num_frames = self._calc_num_frames(rollouts)
      shard_size = num_frames // len(paths)

      frame_gen = self._generate_frames(rollouts)
      for (path_index, path) in enumerate(paths):
        limit = shard_size
        # Put the remainder in the last shard to preserve the ordering.
        if path_index == len(paths) - 1:
          limit = None
        generator_utils.generate_files(
            itertools.islice(frame_gen, limit), [path],
            cycle_every_n=float("inf")
        )
970342
def apply(self,vbase,deltas,utc=None):
    ""
    if vbase!=len(self.increments): raise BadBaseV(vbase,len(self.increments))
    if not all(isinstance(d,diff.Delta) for d in deltas): raise TypeError('not_delta')
    utc=utc or misc.utcnow()
    # note: intentionally *not* checking that utc is monotonic because I don't want clock drift to ruin life
    reduce(apply_splice,deltas,self.generate()) # i.e. if this fails we have a problem
    return VDList(self.increments+[Increment(utc,deltas)])
1161073
protected void accumulatePersistedRepositoryChanges(long delta)
   {
      long dataSize = 0;
      try
      {
         dataSize = quotaPersister.getRepositoryDataSize(rName);
      }
      catch (UnknownDataSizeException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace(e.getMessage(), e);
         }
      }

      long newDataSize = Math.max(dataSize + delta, 0); // to avoid possible inconsistency
      quotaPersister.setRepositoryDataSize(rName, newDataSize);
   }
959384
def commit_deltas_from(other_repo, ref = "master", other_ref = "master")
      # TODO: we should be able to figure out the branch point, rather than
      # rev-list'ing the whole thing
      repo_refs       = self.git.rev_list({}, ref).strip.split("\n")
      other_repo_refs = other_repo.git.rev_list({}, other_ref).strip.split("\n")

      (other_repo_refs - repo_refs).map do |refn|
        Commit.find_all(other_repo, refn, {:max_count => 1}).first
      end
    end
1326629
def extend_back(self, missing_dts):
        
        delta = len(missing_dts)

        if not delta:
            raise ValueError(
                'missing_dts must be a non-empty index',
            )

        self._window += delta

        self._pos += delta

        self.date_buf = self.date_buf.copy()
        self.date_buf.resize(self.cap)
        self.date_buf = np.roll(self.date_buf, delta)

        old_vals = self.buffer.values
        shape = old_vals.shape
        nan_arr = np.empty((shape[0], delta, shape[2]))
        nan_arr.fill(np.nan)

        new_vals = np.column_stack(
            (nan_arr,
             old_vals,
             np.empty((shape[0], delta * (self.cap_multiple - 1), shape[2]))),
        )

        self.buffer = pd.Panel(
            data=new_vals,
            items=self.items,
            minor_axis=self.minor_axis,
            major_axis=np.arange(self.cap),
            dtype=self.dtype,
        )

        # Fill the delta with the dates we calculated.
        where = slice(self._start_index, self._start_index + delta)
        self.date_buf[where] = missing_dts
616912
def patch(self, delta):
        ""
        # Create a temp file in which to store our synced copy. We will handle
        # deleting it manually, since we may move it instead.
        with (tempfile.NamedTemporaryFile(prefix='.sync',
              suffix=os.path.basename(self.path),
              dir=os.path.dirname(self.path), delete=False)) as output:
            try:
                # Open the local file, data may be read from it.
                with open(self.path, 'rb') as reference:
                    # Patch the local file into our temporary file.
                    r = librsync.patch(reference, delta, output)
                    os.rename(output.name, self.path)
                    return r
            finally:
                try:
                    os.remove(output.name)
                except OSError as e:
                    if e.errno != errno.ENOENT:
                        raise
1068873
def append_delta_index(self, ts_data=None, data_delta=None, key=KEY_DATA):
        """"""
        reasign = False
        if data_delta is None:
            if self.data is not None:
                data_delta = self.data[key]
            else:
                self.printif('NO HAY DATOS PARA AÑADIR DELTA', 'error')
                return None
            reasign = True
        data_delta['delta'] = data_delta.index.tz_convert('UTC')
        if ts_data is not None:
            data_delta['delta'] = (data_delta['delta'] - data_delta['delta'].shift(1)).fillna(ts_data)
            data_delta['delta_T'] = data_delta['delta'].apply(lambda x: pd.Timedelta(x).seconds) / ts_data
        else:
            data_delta['delta'] = (data_delta['delta'] - data_delta['delta'].shift(1)).fillna(0)
        if reasign:
            self.data[key] = data_delta
        else:
            return data_delta