Seek past a varint
483099
public static function skip_varint($fp)
    {
        $len = 0;
        do { // Keep reading until we find the last byte
            $b = fread($fp, 1);
            if ($b === false) {
                throw new Exception("skip(varint): Error reading byte");
            }
            $len++;
        } while ($b >= "\x80");

        return $len;
    }
1143148
@Override
  public void seek(long pos) throws IOException {
    int n = (int) (real_pos - pos);
    if (n >= 0 && n <= buf_end) {
      buf_pos = buf_end - n;
    } else {
      super.seek(pos);
      invalidate();
    }
  }
574673
def _get_val(self, soln, r, c):
        """"""
        for v in range(1, 10):
            if soln[self.X[r, c, v]]:
                return DIGITS[v-1]
        return "X"
735153
def seek(self, idx):
        """"""
        assert not self.writable
        self._check_pid(allow_reset=True)
        pos = ctypes.c_size_t(self.idx[idx])
        check_call(_LIB.MXRecordIOReaderSeek(self.handle, pos))
86865
private void seekNonWs(String pattern, ParsePosition pos)
    {

        int len = 0;
        char[] buffer = pattern.toCharArray();

        do
        {
            len = Arrays.binarySearch(SPLIT_CHARS, buffer[pos.getIndex()]) >= 0 ? 1 : 0;
            pos.setIndex(pos.getIndex() + len);
        } while (len > 0 && pos.getIndex() < pattern.length());

    }
298358
private void seekNonWs(final String pattern, final ParsePosition pos) {
        int len = 0;
        final char[] buffer = pattern.toCharArray();
        do {
            len = StrMatcher.splitMatcher().isMatch(buffer, pos.getIndex());
            pos.setIndex(pos.getIndex() + len);
        } while (len > 0 && pos.getIndex() < pattern.length());
    }
1367139
public int find(int offset, int limit, byte value) {
        byte[] bytes = this.content;
        int end = limit > 0 ? limit : count;
        for (int i = offset; i < end; i++) {
            if (bytes[i] == value) return i;
        }
        return -1;
    }
209301
def num2varint(num):
    
    # if (typeof num !== 'number') throw new Error('VarInt must be numeric')
    # if (num < 0) throw new RangeError('VarInts are unsigned (> 0)')
    # if (!Number.isSafeInteger(num)) throw new RangeError('VarInt must be a safe integer')
    if num < 0xfd:
        return num2hexstring(num)
    elif num <= 0xffff:
        # uint16
        return 'fd' + num2hexstring(number=num, size=2, little_endian=True)
    elif num <= 0xffffffff:
        # uint32
        return 'fe' + num2hexstring(number=num, size=4, little_endian=True)
    else:
        # uint64
        return 'ff' + num2hexstring(number=num, size=8, little_endian=True)
866734
def Seek(self, offset, whence=os.SEEK_SET):
    """"""

    if whence == os.SEEK_SET:
      self._offset = offset
    elif whence == os.SEEK_CUR:
      self._offset += offset
    elif whence == os.SEEK_END:
      self._offset = self._length + offset
    else:
      raise ValueError("Invalid whence argument: %s" % whence)
218855
function(integral, vars, point) {
                try {
                    return _.parse(integral, vars);
                }
                catch(e) {
                    //it failed for some reason so return the limit
                    return __.Limit.limit(integral, dx, point);
                }
            }
315089
public void seekBySpan(String direction, String seekAmount, String span) {
    if(span.startsWith(SEEK_PREFIX)) span = span.substring(3);
    int seekAmountInt = Integer.parseInt(seekAmount);
    assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
    assert(span.equals(DAY) || span.equals(WEEK) || span.equals(MONTH) || 
        span.equals(YEAR) || span.equals(HOUR) || span.equals(MINUTE) || 
        span.equals(SECOND));
    
    boolean isDateSeek = span.equals(DAY) || span.equals(WEEK) || 
      span.equals(MONTH) || span.equals(YEAR);

    if(isDateSeek) {
      markDateInvocation();
    }
    else {
      markTimeInvocation(null);
    }
    
    int sign = direction.equals(DIR_RIGHT) ? 1 : -1;
    int field = 
      span.equals(DAY) ? Calendar.DAY_OF_YEAR : 
      span.equals(WEEK) ? Calendar.WEEK_OF_YEAR :
      span.equals(MONTH) ? Calendar.MONTH :
      span.equals(YEAR) ? Calendar.YEAR : 
      span.equals(HOUR) ? Calendar.HOUR: 
      span.equals(MINUTE) ? Calendar.MINUTE: 
      span.equals(SECOND) ? Calendar.SECOND:
      null;
    if(field > 0) _calendar.add(field, seekAmountInt * sign);
  }
187541
def seek(self, offset, whence=os.SEEK_SET):
        
        self.wrapped.seek(offset, whence)
743970
def Seek(self, offset, whence=os.SEEK_SET):
    """"""
    if whence == os.SEEK_SET:
      self.offset = offset
    elif whence == os.SEEK_CUR:
      self.offset += offset
    elif whence == os.SEEK_END:
      self.offset = self.size + offset
    else:
      raise ValueError("Illegal whence value %s" % whence)
659172
def seek(self, offset, whence=0):
        '''
        
        '''
        if whence == 0:
            self._pos = self._start_pos + offset
        elif whence == 1:
            self._pos += offset
        else:
            self._pos = (self._end_pos - 1) + offset
96682
def size_of_varint(value):
    
    value = (value << 1) ^ (value >> 63)
    if value <= 0x7f:
        return 1
    if value <= 0x3fff:
        return 2
    if value <= 0x1fffff:
        return 3
    if value <= 0xfffffff:
        return 4
    if value <= 0x7ffffffff:
        return 5
    if value <= 0x3ffffffffff:
        return 6
    if value <= 0x1ffffffffffff:
        return 7
    if value <= 0xffffffffffffff:
        return 8
    if value <= 0x7fffffffffffffff:
        return 9
    return 10
669285
def solve_var(expr, vars):
    """"""
    try:
        return Result(structured.resolve(vars, expr.value), ())
    except (KeyError, AttributeError) as e:
        # Raise a better exception for accessing a non-existent member.
        raise errors.EfilterKeyError(root=expr, key=expr.value, message=e,
                                     query=expr.source)
    except (TypeError, ValueError) as e:
        # Raise a better exception for what is probably a null pointer error.
        if vars.locals is None:
            raise errors.EfilterNoneError(
                root=expr, query=expr.source,
                message="Trying to access member %r of a null." % expr.value)
        else:
            raise errors.EfilterTypeError(
                root=expr, query=expr.source,
                message="%r (vars: %r)" % (e, vars))
    except NotImplementedError as e:
        raise errors.EfilterError(
            root=expr, query=expr.source,
            message="Trying to access member %r of an instance of %r." %
            (expr.value, type(vars)))
1164883
private int readUnsignedVarInt() throws IOException {
    int value = 0;
    int shift = 0;
    int b;
    do {
      b = in.read();
      value |= (b & 0x7F) << shift;
      shift += 7;
    } while ((b & 0x80) != 0);
    return value;
  }