Return a tuple of (start, end).
342482
def current_position(self):
        """"""
        token = self.tokenizer.peek(0)
        if token:
            return token.start, token.end

        return self.tokenizer.position, self.tokenizer.position + 1
1314533
private Tuple getNextTuple()
    {
    if( nextTuple_ == null)
      {
      // Still traversing values for current start variable?
      int tupleSize = getTupleSize();
      if( !(values_ != null && values_.hasNext()))
        {
        // No, still traversing subtuples for current start variable?
        values_ = null;
        subTuple_ = null;
        if( !(subTuples_ != null && subTuples_.hasNext()))
          {
          // No, advance to next start variable.
          subTuples_ = null;
          varStart_++;
          if( tupleSize > 1)
            {
            for( ;
                 varStart_ < varEnd_
                   &&
                   (subTuples_ = new TupleIterator( tupleSize - 1, varDefs_.subList( varStart_ + 1, varDefs_.size()), randSeq_))
                   .hasNext() == false;

                 varStart_++);
            }
          }
        }

      // More tuples remaining?
      if( varStart_ < varEnd_)
        {
        VarDef startVarDef = varDefs_.get( varStart_);
        if( values_ == null)
          {
          // Resume traversing values for current start variable.
          values_ = RandSeq.reorderIf( randSeq_, startVarDef.getValidValues());
          if( !values_.hasNext())
            {
            throw new IllegalStateException( "Can't complete tuples -- no valid values defined for var=" + startVarDef);
            }
          if( tupleSize > 1)
            {
            // Advance to next subtuple for current start variable.
            subTuple_ = subTuples_.next();
            }
          }

        nextTuple_ = new Tuple();
        nextTuple_.add( new VarBindingDef( startVarDef, values_.next()));
        if( subTuple_ != null)
          {
          nextTuple_.addAll( subTuple_);
          }
        }
      }

    return nextTuple_;
    }
251449
def _format_dates(self, start, end):
        """"""
        start = self._split_date(start)
        end = self._split_date(end)
        return start, end
595515
def _find_path(start, end, path=tuple()):
    
    path = path + (start, )
    if start is end:
        return path
    else:
        ret = None
        if start.lo is not None:
            ret = _find_path(start.lo, end, path)
        if ret is None and start.hi is not None:
            ret = _find_path(start.hi, end, path)
        return ret
380071
def timeframe(self, start, end):
        
        """
        if start:
            self._time_frame['chfieldfrom'] = start
        if end:
            self._time_frame['chfieldto'] = end
        return self
1365681
def iter_rows(self, start=None, end=None):
        """"""
        start = start or 0
        end = end or self.nrows
        for i in range(start, end):
            yield self.iloc[i, :]
928489
public Query range(String start, String end) {
    return range(wrapKey(start), wrapKey(end));
  }
858686
function(start, end) {
      var current = parseInt(start), end = parseInt(end), values = [current]
      if (end > current) while (++current <= end) values.push(current)
      else               while (--current >= end) values.push(current)
      return '[' + values + ']'
    }
1079495
def bin_for_range( start, end, offsets=None ):
    """"""
    if offsets is None:
        offsets = BIN_OFFSETS
    start_bin, end_bin = start, max(start, end - 1)
    start_bin >>= BIN_FIRST_SHIFT
    end_bin >>= BIN_FIRST_SHIFT
    for offset in offsets:
        if start_bin == end_bin:
            return offset + start_bin
        else:
            start_bin >>= BIN_NEXT_SHIFT
            end_bin >>= BIN_NEXT_SHIFT
    raise Exceptionn("Interval (%d,%d) out of range")
979495
def iterdfs(self, start, end=None, forward=True):
        
        visited, stack = set([start]), deque([start])

        if forward:
            get_edges = self.out_edges
            get_next = self.tail
        else:
            get_edges = self.inc_edges
            get_next = self.head

        while stack:
            curr_node = stack.pop()
            yield curr_node
            if curr_node == end:
                break
            for edge in sorted(get_edges(curr_node)):
                tail = get_next(edge)
                if tail not in visited:
                    visited.add(tail)
                    stack.append(tail)
814304
def ver_str_to_tuple(ver_str):
    """"""
    out = []
    for x in ver_str.split("."):
        try:
            x = int(x)
        except ValueError:
            pass
        out.append(x)
    return tuple(out)
1226758
def flow_tuple(data):
    """"""
    src = net_utils.inet_to_str(data['packet'].get('src')) if data['packet'].get('src') else None
    dst = net_utils.inet_to_str(data['packet'].get('dst')) if data['packet'].get('dst') else None
    sport = data['transport'].get('sport') if data.get('transport') else None
    dport = data['transport'].get('dport') if data.get('transport') else None
    proto = data['transport'].get('type') if data.get('transport') else data['packet']['type']
    return (src, dst, sport, dport, proto)
811737
function stringify(start, end) {
  var values = []
  var positions = []
  var offsets = []

  add(start)
  add(end)

  if (positions.length !== 0) {
    values.push(positions.join('-'))
  }

  if (offsets.length !== 0) {
    values.push(offsets.join('-'))
  }

  return values.join(', ')

  // Add a position.
  function add(position) {
    var tuple = compile(position)

    if (tuple) {
      positions.push(tuple[0])

      if (tuple[1]) {
        offsets.push(tuple[1])
      }
    }
  }
}
450519
def next(self):
    """"""
    self._has_iterated = True

    if self._read_before_start:
      self._blob_reader.readline()
      self._read_before_start = False
    start_position = self._blob_reader.tell()

    if start_position > self._end_position:
      raise StopIteration()

    line = self._blob_reader.readline()

    if not line:
      raise StopIteration()

    return start_position, line.rstrip("\n")
218089
def iteritems(self):
        """"""
        if self.type in ['blob']:
            raise StopIteration

        for path, mode, sha in self.tree.iteritems():
            item = Item(self, sha, path, mode)
            yield item
            for i in item.iteritems():
                yield i
709567
def frange(start, end, step):
    """"""
    if start <= end:
        step = abs(step)
    else:
        step = -abs(step)

    while start < end:
        yield start
        start += step
545865
def range(self, start, end, desc=False):
        
        if not self:
            return []

        if desc:
            return reversed(self._scores[len(self) - end - 1:len(self) - start])
        else:
            return self._scores[start:end + 1]