Peeks into first tx and sets self attrs or raise.
16918
def peek(self, deserialized_tx):
        
        self.batch_id = deserialized_tx.object.batch_id
        self.prev_batch_id = deserialized_tx.object.prev_batch_id
        self.producer = deserialized_tx.object.producer
        if self.batch_history.exists(batch_id=self.batch_id):
            raise BatchAlreadyProcessed(
                f"Batch {self.batch_id} has already been processed"
            )
        if self.prev_batch_id != self.batch_id:
            if not self.batch_history.exists(batch_id=self.prev_batch_id):
                raise InvalidBatchSequence(
                    f"Invalid import sequence. History does not exist for prev_batch_id. "
                    f"Got file='{self.filename}', prev_batch_id="
                    f"{self.prev_batch_id}, batch_id={self.batch_id}."
                )
857646
protected void initialize() throws IOException {
    for (int i = 0; i < 3; i++) {
      try {
        LOG.info("Detecting current primary node - attempt " + i);
        detectJournalManager();
        
        LOG.info("Finding oldest segment txid - attempt " + i);
        currentSegmentTxId = findOldestLogSegmentTxid();

        LOG.info("Setting up input stream for txid: " + currentSegmentTxId
            + " - attempt " + i);
        setupIngestStreamWithRetries(currentSegmentTxId);
        return;
      } catch (IOException e) {
        LOG.warn("Initialization exception", e);
        if (i == 2) {
          LOG.error("Initialization failed.");
          throw e;
        }
      }
    }
  }
404466
def inits_t(wrap):
    
    return Transformation(
        'inits',
        lambda sequence: [wrap(sequence[:i]) for i in reversed(range(len(sequence) + 1))],
        {ExecutionStrategies.PRE_COMPUTE}
    )
959724
def future_raise(self, tp, value=None, tb=None):
        """"""
        if value is not None and isinstance(tp, Exception):
            raise TypeError("instance exception may not have a separate value")
        if value is not None:
            exc = tp(value)
        else:
            exc = tp
        if exc.__traceback__ is not tb:
            raise exc.with_traceback(tb)
        raise exc
731933
@Requires("lookahead >= 0")
  public Token peek(int lookahead) {
    ArrayDeque<Token> tmp = new ArrayDeque<Token>();
    for (int i = 0; i <= lookahead; ++i) {
      if (hasNext()) {
        tmp.push(next());
      }
    }
    Token token = tmp.peek();
    while (!tmp.isEmpty()) {
      pushback(tmp.pop());
    }
    return token;
  }
1142777
def _init(self):
        """"""
        read_values = []
        read = self._file.read
        last = read(1)
        current = read(1)
        while last != b'' and current != b'' and not \
                (last == b'\r' and current == b'\n'):
            read_values.append(last)
            last = current
            current = read(1)
        if current == b'' and last != b'\r':
            read_values.append(last)
        self._bytes = b''.join(read_values)
724558
def setattr(self, attr, new_value, close_the_changeset=True):
        """"""
        existing_value = getattr(self, attr, None)
        if existing_value != new_value:
            setattr(self, attr, new_value)
            self._changeset[attr] = new_value

        if close_the_changeset and self._changeset:
            self._call_callbacks()
1220935
def _setter(self, attr, value, bottom, top, to_step):
        
        if value < 0 or value > 1:
            raise ValueError("out of range")
        if value == 0.0:
            bottom()
        elif value == 1.0:
            top()
        else:
            to_step(value)
        setattr(self, attr, value)
670146
def set(self, x):
        
        for name, value in iter(x.items()):
            if hasattr(value, "ndim"):
                if self[name].value.ndim < value.ndim:
                    self[name].value.itemset(value.squeeze())
                else:
                    self[name].value = value
            else:
                self[name].value.itemset(value)
157717
def peek_step(self, val: ArrayValue,
                  sn: "DataNode") -> Tuple[ObjectValue, "DataNode"]:
        
        keys = self.parse_keys(sn)
        for en in val:
            flag = True
            try:
                for k in keys:
                    if en[k] != keys[k]:
                        flag = False
                        break
            except KeyError:
                continue
            if flag:
                return (en, sn)
        return (None, sn)
901949
def peek(self, steps=1):
        """"""
        try:
            tokens = iter(self)
            for _ in six.moves.range(steps):
                next(tokens)

            return next(tokens)
        except StopIteration:
            return None
654531
def initial_update(self, mapping):
        '''
        '''
        for key, val in mapping.items():
            _, timestamp = val
            if not self.TTL or (datetime.utcnow() -
                datetime.utcfromtimestamp(timestamp) < self.TTL):
                self.__setitem__(key, val, raw=True)
805874
def set_attrs(self):
        
        self.attrs.encoding = self.encoding
        self.attrs.errors = self.errors
196680
function set(value) {
      if (isObject(value)) {
        value.before = toInt(value.before);
        value.after = toInt(value.after);
      } else {
        value = toInt(value);
      }

      Peek._v = value;
    }
1054472
def increment(self, attr, amount=1):
        
        return self.set(attr, operation.Increment(amount))
180178
def _peek(tokens, n=0):
    """"""
    return tokens.peek(n=n, skip=_is_comment, drop=True)
772165
private void init(Context context, AttributeSet attrs){
        setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                superOldProgress = seekBar.getProgress();
            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                if(fromUser)
                    fromUserCount+=1;
            }

            @Override
            public void onStopTrackingTouch(final SeekBar seekBar) {
                int oldProgress = seekBar.getProgress();
                final int newProgress;
                if((oldProgress % stepSize) >= stepSize/2F){
                    newProgress = (int)(((oldProgress/(int)stepSize)+1)*stepSize);
                } else {
                    newProgress = (int)(((oldProgress/(int)stepSize))*stepSize);
                }

                if(fromUserCount>1){ // SeekBar Dragged
                    ObjectAnimator animation = ObjectAnimator.ofInt(seekBar, PROGRESS_PROPERTY, oldProgress, newProgress);
                    animation.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
                    animation.setInterpolator(new DecelerateInterpolator());
                    animation.start();
                } else { // SeekBar Clicked
                    ObjectAnimator animation = ObjectAnimator.ofInt(seekBar, PROGRESS_PROPERTY, superOldProgress, newProgress);
                    animation.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
                    animation.setInterpolator(new DecelerateInterpolator());
                    animation.start();
                }

                fromUserCount = 0;
                if(onDiscreteSeekBarChangeListener != null){
                    onDiscreteSeekBarChangeListener.onPositionChanged(newProgress/MULTIPLIER);
                }
            }
        });
    }