Returns paginated queryset of PageRevision instances for
    specified Page instance.

    :param page: the page instance.
    :param page_num: the pagination page number.
    :rtype: django.db.models.query.QuerySet.
324158
def get_revisions(page, page_num=1):
    
    revisions   = page.revisions.order_by('-created_at')
    current     = page.get_latest_revision()

    if current:
        revisions.exclude(id=current.id)

    paginator = Paginator(revisions, 5)

    try:
        revisions = paginator.page(page_num)
    except PageNotAnInteger:
        revisions = paginator.page(1)
    except EmptyPage:
        revisions = paginator.page(paginator.num_pages)

    return revisions
651171
def page(self, number=None):
        
        if number is None:
            return int(self.url.page)
        self.url.page = str(number)
662643
def _next_page(self):
        
        if self._has_next_page():
            response = self._get_next_page_response()
            items = response.get(self._items_key, ())
            page = Page(self, items, self.item_to_value)
            self._page_start(self, page, response)
            self.next_page_token = response.get(self._next_token)
            return page
        else:
            return None
1180604
def page(self, value):
        

        instance = copy(self)

        instance._filters.append({
            'page': value
        })
        return instance
338858
def pages(self, page_from, page_to):
        
        if not all([page_from < self.url.max_page, page_from > 0,
                    page_to <= self.url.max_page, page_to > page_from]):
            raise IndexError("Invalid page numbers")

        size = (page_to + 1) - page_from
        threads = ret = []
        page_list = range(page_from, page_to+1)

        locks = [threading.Lock() for i in range(size)]

        for lock in locks[1:]:
            lock.acquire()

        def t_function(pos):
            """
            Thread function that fetch page for list of torrents
            """
            res = self.page(page_list[pos]).list()
            locks[pos].acquire()
            ret.extend(res)
            if pos != size-1:
                locks[pos+1].release()

        threads = [threading.Thread(target=t_function, args=(i,))
                   for i in range(size)]

        for thread in threads:
            thread.start()

        for thread in threads:
            thread.join()

        for torrent in ret:
            yield torrent
1213991
def get_reminders_per_page(self, per_page=1000, page=1, params=None):
        
        return self._get_resource_per_page(resource=REMINDERS, per_page=per_page, page=page, params=params)
1264583
def visit_page(self, page):
    

    url = urljoin(django_url(self), page)
    self.given('I visit "%s"' % url)
13537
def next_page(self):
        
        for link in self.links:
            if link.rel.lower() == 'next':
                return self._load(link.href)
        raise PaginationError('No more entries.')
1006769
def pages(self):
        
        # Start with a page object for unknown entries if the HAR data has
        # any entries with no page ID
        pages = []
        if any('pageref' not in entry for entry in self.har_data['entries']):
            pages.append(HarPage('unknown', har_parser=self))
        for har_page in self.har_data['pages']:
            page = HarPage(har_page['id'], har_parser=self)
            pages.append(page)

        return pages
864530
def list(self, request, *args, **kwargs):
        

        queryset = self.get_filtered_queryset(get_request_data(request))
        # Switch between paginated or standard style responses
        page = self.paginate_queryset(queryset)
        if page is not None:
            serializer = self.get_serializer(page, many=True)
            return self.get_paginated_response(serializer.data)

        serializer = self.get_serializer(queryset, many=True)
        return Response(serializer.data)
1346666
def list_algorithms(self, page_size=None):
        
        params = {}

        if page_size is not None:
            params['limit'] = page_size

        return pagination.Iterator(
            client=self._client,
            path='/mdb/{}/algorithms'.format(self._instance),
            params=params,
            response_class=mdb_pb2.ListAlgorithmsResponse,
            items_key='algorithm',
            item_mapper=Algorithm,
        )
345808
def get_recurrings_per_page(self, per_page=1000, page=1, params=None):
        
        return self._get_resource_per_page(resource=RECURRINGS, per_page=per_page, page=page, params=params)
128325
def get_image_list(self, page=1, per_page=20):
        
        url = self.api_url + '/api/images'
        params = {
            'page': page,
            'per_page': per_page
        }
        response = self._request_url(
            url, 'get', params=params, with_access_token=True)
        headers, result = self._parse_and_check(response)
        images = ImageList.from_list(result)
        images.set_attributes_from_headers(headers)
        return images
715468
def get_elastic_page_numbers(current_page, num_pages):
    
    if num_pages <= 10:
        return list(range(1, num_pages + 1))
    if current_page == 1:
        pages = [1]
    else:
        pages = ['first', 'previous']
        pages.extend(_make_elastic_range(1, current_page))
    if current_page != num_pages:
        pages.extend(_make_elastic_range(current_page, num_pages)[1:])
        pages.extend(['next', 'last'])
    return pages
382648
def next_page(self):
        
        for link in self.links:
            if link.next:
                return self._load(link.next)
        raise PaginationError('No more entries.')
1236730
def get_pages(self):
        ''''''
        pages = []
        page = []
        for i, item in enumerate(self.get_rows):
            if i > 0 and i % self.objects_per_page == 0:
                pages.append(page)
                page = []
            page.append(item)
        pages.append(page)
        return pages
210553
def paginate_queryset(self, queryset, request, view=None):
        
        result = super(MultipleModelLimitOffsetPagination, self).paginate_queryset(queryset, request, view)

        try:
            if self.max_count < self.count:
                self.max_count = self.count
        except AttributeError:
            self.max_count = self.count

        try:
            self.total += self.count
        except AttributeError:
            self.total = self.count

        return result