Generates records one a time from a page, stopping at prescribed limits.

        :param Page page: The page to stream.
        :param int limit: The max number of records to read.
        :param int page_imit: The max number of pages to read.
490144
def stream(self, page, limit=None, page_limit=None):
        
        current_record = 1
        current_page = 1

        while page is not None:
            for record in page:
                yield record
                current_record += 1
                if limit and limit is not values.unset and limit < current_record:
                    return

            if page_limit and page_limit is not values.unset and page_limit < current_page:
                return

            page = page.next_page()
            current_page += 1
953494
@Override
  public void writePage(int pageID, P page) {
    try {
      countWrite();
      byte[] array = pageToByteArray(page);
      long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
      assert offset >= 0 : header.getReservedPages() + " " + pageID + " " + pageSize + " " + offset;
      file.seek(offset);
      file.write(array);
      page.setDirty(false);
    }
    catch(IOException e) {
      throw new RuntimeException("Error writing to page file.", e);
    }
  }
628211
def limit(self, limit: int) -> "QuerySet":
        
        queryset = self._clone()
        queryset._limit = limit
        return queryset
475202
def display_page(self, value):
        

        self._display_page = max(0, min(self.page_count - 1, value))
758684
def corpus_page_generator(corpus_files, tmp_dir, max_page_size_exp):
  
  for remote_filepath in corpus_files:

    filepath = maybe_copy_file_to_directory(remote_filepath, tmp_dir)
    tf.logging.info("Reading from " + filepath)

    command = ["7z", "x", "-so", filepath]
    tf.logging.info("Running command: %s", command)

    p = subprocess.Popen(command, stdout=subprocess.PIPE, bufsize=-1)

    for page in file_page_generator(p.stdout, 2**max_page_size_exp):
      yield page
65158
def get_page(self, page_number):
        

        if page_number:
            kwargs = dict(self._list_kwargs)
            kwargs['limit'] = self.limit
            kwargs['page'] = page_number

            return self._controller.list(**kwargs)
487578
def fill_pager(self, page):
        
        tty_size = os.popen("stty size", "r").read().split()
        rows = int(tty_size[0]) - 1
        lines = sum(1 for line in page.splitlines())
        diff = rows - lines
        fill = "\n" * diff
        if diff > 0:
            return fill
        else:
            return ""
545981
@Override
  public void writePage(int pageID, P page) {
    if (page.isDirty()) {
      try {
        countWrite();
        byte[] array = pageToByteArray(page);
        file.getRecordBuffer(pageID).put(array);
        page.setDirty(false);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
1074267
def next_page(params = {}, opts = {})
      return self.class.empty_list(opts) unless has_more
      last_id = data.last.id

      params = filters.merge(starting_after: last_id).merge(params)

      list(params, opts)
    end
1338229
def record_rows(view, limit)
      en = Enumerator.new do |e|
        view_opts = {include_docs: true, stream: false, limit: limit}
        rows_retrieved = 0
        total_rows = nil
        loop do
          v = client.view(view, view_opts)
          total_rows ||= v.total_rows
          rows_retrieved += v.rows.size
          v.rows.each do |row|
            next if row['id'].start_with?('_design')
            e.yield row
          end
          break if rows_retrieved == total_rows
          view_opts[:startkey] = v.rows.last['id'] + '0'
        end
      end
      en.lazy
    end
519479
public function paging()
    {
        $limit = (int) $this->request->input('length') > 0 ? $this->request->input('length') : 10;
        if (is_callable($this->limitCallback)) {
            $this->query->limit($limit);
            call_user_func_array($this->limitCallback, [$this->query]);
        } else {
            $this->query->skip($this->request->input('start'))->take($limit);
        }
    }
157891
public function process(int $page, int $limit, array $filters = [], array $orders = []): Data
    {
        // process filters
        $this->applyFilters($filters);

        // process orders
        $this->applyOrders($orders);

        $data = $this->getSource();

        $total = \count($data);

        // process pages
        $data = \array_slice($data, $limit * ($page - 1), $limit);

        $gridData = new Data($data);
        $gridData->setTotal($total);
        return $gridData;
    }
395238
def limit_page page = nil, options = {}
      if page.is_a?( Hash )
        options = page
      else
        options[:page] = page.to_i
      end

      options[:page] = options[:page].to_i > 0 ? options[:page] : DataMapper::Paginator.default[:page]
      options[:limit] = options[:limit].to_i || DataMapper::Paginator.default[:limit]
      options[:offset] = options[:limit] * ( options[:page] - 1 )
      options[:order] = options[:order] || DataMapper::Paginator.default[:order]
      limit options
    end
211042
def _get_limit_and_offset(page, page_size):
    
    if page < 1:
        raise ValueError('page must be >= 1')
    limit = page_size
    offset = (page - 1) * page_size
    return limit, offset
1364384
public function execute(int $page, int $limit): void
    {
        $page = $page <= 1 ? 1 : $page;
        $rows = $this->getRows($page, $limit);

        $headers = [];
        $mode = 'a';
        if (1 === $page) {
            $headers = $this->getHeaders();
            $mode = 'w';
        }

        // Prepend columns to result
        if (!empty($headers)) {
            array_unshift($rows, $headers);
        }

        $this->create($rows, $mode);
    }
959361
def new_page(record, values = [])
      idx = @page_counter
      @page_counter += 1
      mark_page_as_modified(IDListPage.new(self, record, idx, values))
      idx
    end
1348317
public function limit($limit, $page = 1) {
        if($page >= 1) $this->page = $page;
        $this->limit = $limit;

        return $this;
    }