Return an iterable of specific items to extract.
        As a side-effect, set self.items_to_extract_length.

        :param offset: where to start extracting
        :param length: how many to extract
        :return: An iterable of the specific
517578
def items_to_extract(self, offset=0, length=None):
        
        endoffset = length and offset + length
        qs = self.origin_data()[offset:endoffset]
        self.items_to_extract_length = qs.count()
        return qs
1038987
def extract(self):
        
        if not self.extractable:
            return self, None

        extractable = self.common_fams - self.extracted_fams

        # the sort is necessary to ensure solves are deterministic
        fam = sorted(extractable)[0]

        last_range = None
        ranges = set()

        for variant in self.iter_variants():
            req = variant.get(fam)
            if req.range != last_range:  # will match often, avoids set search
                ranges.add(req.range)
                last_range = req.range

        slice_ = copy.copy(self)
        slice_.extracted_fams = self.extracted_fams | set([fam])

        ranges = list(ranges)
        range_ = ranges[0].union(ranges[1:])
        common_req = Requirement.construct(fam, range_)
        return slice_, common_req
404169
def peek(self, length):
        
        return self.string[self.pos:self.pos + length]
796601
def get_overlaps(self, offset, length):
    
    # In case entity's offset points to a space just before the entity.
    if ''.join([chunk.word for chunk in self])[offset] == ' ':
      offset += 1
    index = 0
    result = ChunkList()
    for chunk in self:
      if offset < index + len(chunk.word) and index < offset + length:
        result.append(chunk)
      index += len(chunk.word)
    return result
187541
def seek(self, offset, whence=os.SEEK_SET):
        
        self.wrapped.seek(offset, whence)
351720
def offsets_for_max_size( max_size ):
    
    for i, max in enumerate( reversed( BIN_OFFSETS_MAX ) ):
        if max_size < max:
            break
    else:
        raise Exception( "%d is larger than the maximum possible size (%d)" % ( max_size, BIN_OFFSETS_MAX[0] ) )
    return BIN_OFFSETS[ ( len(BIN_OFFSETS) - i - 1 ) : ]
815798
def _slice(self, slicer):
        
        if isinstance(slicer, tuple):
            col, loc = slicer
            if not com.is_null_slice(col) and col != 0:
                raise IndexError("{0} only contains one item".format(self))
            return self.values[loc]
        return self.values[slicer]
1088284
def _iter_chunk_offsets(self):
        
        chunk_offset = 8
        while True:
            chunk_data_len = self._stream_rdr.read_long(chunk_offset)
            chunk_type = self._stream_rdr.read_str(4, chunk_offset, 4)
            data_offset = chunk_offset + 8
            yield chunk_type, data_offset
            if chunk_type == 'IEND':
                break
            # incr offset for chunk len long, chunk type, chunk data, and CRC
            chunk_offset += (4 + 4 + chunk_data_len + 4)
1135312
def FilterList(l, offset, count=0, filter_value=None):
  """"""

  if offset < 0:
    raise ValueError("Offset needs to be greater than or equal to zero")

  if count < 0:
    raise ValueError("Count needs to be greater than or equal to zero")

  count = count or sys.maxsize
  if not filter_value:
    return l[offset:offset + count]

  index = 0
  items = []
  for item in l:
    serialized_item = item.SerializeToString()
    if re.search(re.escape(filter_value), serialized_item, re.I):
      if index >= offset:
        items.append(item)
      index += 1

      if len(items) >= count:
        break

  return items
496695
public List<O> getItems(int count, int offset) {
        return getDatastore().find(clazz).offset(offset).limit(count).asList();
    }
432567
def read(self, offset, size):
    
    self._file_object.seek(offset, os.SEEK_SET)
    return self._file_object.read(size)
462922
def list(offset = 0, limit = 100, unread_only = true)
      api.get('', offset: offset, limit: limit, unreadOnly: unread_only)
    end
233492
def next_items(self, n):
        
        items = []
        while len(items) < n:
            if self._line_ptr >= len(self._line):
                # Load the next line.
                line = next(self._file).strip()
                # Skip all comment and empty lines.
                while not line or line[0] == "#":
                    line = next(self._file).strip()
                self._line = self._re_delimiter.split(line)
                self._line_ptr = 0
            n_read = min(n - len(items), len(self._line) - self._line_ptr)
            items.extend(self._line[self._line_ptr : self._line_ptr + n_read])
            self._line_ptr += n_read
        return items
896381
def itemgetter(iterable, indexes):
    '''  '''
    indexes = indexes if isinstance(indexes, tuple) else tuple(indexes)
    assert all(isinstance(i, int) for i in indexes), 'indexes needs to be a tuple of ints'
    positive_indexes=[i for i in indexes if i>=0]
    negative_indexes=[i for i in indexes if i<0]
    out = {}
    if len(negative_indexes):
        # if there are any negative indexes
        negative_index_buffer = deque(maxlen=min(indexes)*-1)
        for i,x in enumerate(iterable):
            if i in positive_indexes:
                out[i]=x
            negative_index_buffer.append(x)
        out.update({ni:negative_index_buffer[ni] for ni in negative_indexes})
    else:
        # if just positive results
        out.update({i:x for i,x in enumerate(iterable) if i in positive_indexes})
    return itemgetter(*indexes)(out)
1019400
def items_iter(self, limit):
        '''
        '''

        pages = (page.get() for page in self._pages())
        items = itertools.chain.from_iterable(
            (p[self.ITEM_KEY] for p in pages)
        )
        if limit is not None:
            items = itertools.islice(items, limit)
        return items
1002918
def _get_with_criteria(self, criteria, offset=None, limit=None):
        ''' 
        '''
        SQL = SQLBuilder(self._table, criteria).select(offset=offset, limit=limit)
        self._cursor.execute(SQL)
        for item in self._cursor.fetchall():
            yield self._make_item(item)
1202021
def get_extra(descriptor):
    
    result = []
    extra_length = descriptor.extra_length
    if extra_length:
        extra = buffer_at(descriptor.extra.value, extra_length)
        append = result.append
        while extra:
            length = _string_item_to_int(extra[0])
            if not 0 < length <= len(extra):
                raise ValueError(
                    'Extra descriptor %i is incomplete/invalid' % (
                        len(result),
                    ),
                )
            append(extra[:length])
            extra = extra[length:]
    return result