Return specified pages as list of TiffPages or TiffFrames.

        The first item is a TiffPage, and is used as a keyframe for
        following TiffFrames.
775986
def _getlist(self, key=None, useframes=True, validate=True):
        
        getitem = self._getitem
        _useframes = self.useframes

        if key is None:
            key = iter(range(len(self)))
        elif isinstance(key, Iterable):
            key = iter(key)
        elif isinstance(key, slice):
            start, stop, _ = key.indices(2**31-1)
            if not self._indexed and max(stop, start) > len(self.pages):
                self._seek(-1)
            key = iter(range(*key.indices(len(self.pages))))
        elif isinstance(key, inttypes):
            # return single TiffPage
            self.useframes = False
            if key == 0:
                return [self.pages[key]]
            try:
                return [getitem(key)]
            finally:
                self.useframes = _useframes
        else:
            raise TypeError('key must be an integer, slice, or iterable')

        # use first page as keyframe
        keyframe = self._keyframe
        self.keyframe = next(key)
        if validate:
            validate = self._keyframe.hash
        if useframes:
            self.useframes = True
        try:
            pages = [getitem(i, validate) for i in key]
            pages.insert(0, self._keyframe)
        finally:
            # restore state
            self._keyframe = keyframe
            if useframes:
                self.useframes = _useframes

        return pages
1371354
def previous_page(params = {}, opts = {})
      first_id = data.first.id

      params = filters.merge(ending_before: first_id).merge(params)

      list(params, opts)
    end
1259564
def list_previous_page(self):
        
        uri = self._paging.get("domain", {}).get("prev_uri")
        if uri is None:
            raise exc.NoMoreResults("There are no previous pages of domains "
                    "to list.")
        return self._list(uri)
1092322
def _next_page(self):
        
        if not self._has_next_page():
            return None

        if self.next_page_token is not None:
            setattr(self._request, self._request_token_field, self.next_page_token)

        response = self._method(self._request)

        self.next_page_token = getattr(response, self._response_token_field)
        items = getattr(response, self._items_field)
        page = Page(self, items, self.item_to_value)

        return page
568830
def items( self ):
        
        layout = self.widget().layout()
        return [layout.itemAt(i).widget() for i in range(layout.count()-1)]
360124
def list_next_page(self):
        
        uri = self._paging.get("domain", {}).get("next_uri")
        if uri is None:
            raise exc.NoMoreResults("There are no more pages of domains to "
                    "list.")
        return self._list(uri)
1350974
def page(self, *args):
        
        for arg in args:
            self.__pages__.append(arg)
        return self
292674
def get_page(self, index=None):
        """"""
        if index is None:
            widget = self.pages_widget.currentWidget()
        else:
            widget = self.pages_widget.widget(index)
        return widget.widget()
708170
def get_pages_for_display(self):
        """"""

        # Start with an empty queryset, and expand as needed
        all_pages = Page.objects.none()

        if self.max_levels == 1:
            # If no additional sub-levels are needed, return empty queryset
            return all_pages

        for item in self.top_level_items:

            if item.link_page_id:
                # Fetch a 'branch' of suitable descendants for this item and
                # add to 'all_pages'
                page_depth = item.link_page.depth
                if(
                    item.allow_subnav and
                    page_depth >= settings.SECTION_ROOT_DEPTH
                ):
                    all_pages = all_pages | Page.objects.filter(
                        depth__gt=page_depth,
                        depth__lt=page_depth + self.max_levels,
                        path__startswith=item.link_page.path)

        # Filter the entire queryset to include only pages suitable for display
        all_pages = all_pages & self.get_base_page_queryset()

        # Return 'specific' page instances if required
        if self.use_specific == constants.USE_SPECIFIC_ALWAYS:
            return all_pages.specific()

        return all_pages
910645
def page(self, page_number=0) -> list:
        
        # workaround flask-sqlalchemy/issues/516
        offset = page_number * self.limit
        sql = 'SELECT * FROM %s {} LIMIT :li OFFSET :o' \
            % (self.model.__tablename__)
        filter_query = self.__filter_query()
        if filter_query is None:
            sql = text(sql.format(''))
            result = self.model.db.engine.execute(
                sql, li=self.limit, o=offset)
        else:
            filter_query['binds']['li'] = self.limit
            filter_query['binds']['o'] = offset
            sql = text(sql.format(filter_query['query']))
            result = self.model.db.engine.execute(
                sql, **filter_query['binds'])
        result_keys = result.keys()
        result_models = []
        for row in result:
            model = self.model()
            key_count = 0
            for key in result_keys:
                setattr(model, key, row[key_count])
                key_count = key_count + 1
            result_models.append(model)
        return result_models
900852
def common_cli_list_options(f):
    """"""

    @click.option(
        "-p",
        "--page",
        default=1,
        type=int,
        help="The page to view for lists, where 1 is the first page",
        callback=validators.validate_page,
    )
    @click.option(
        "-l",
        "--page-size",
        default=30,
        type=int,
        help="The amount of items to view per page for lists.",
        callback=validators.validate_page_size,
    )
    @click.pass_context
    @functools.wraps(f)
    def wrapper(ctx, *args, **kwargs):
        # pylint: disable=missing-docstring
        opts = config.get_or_create_options(ctx)
        kwargs["opts"] = opts
        return ctx.invoke(f, *args, **kwargs)

    return wrapper
41277
def get_frame_list():
    

    # TODO: use this function in IPS below (less code duplication)

    frame_info_list = []
    frame_list = []
    frame = inspect.currentframe()
    while frame is not None:
        frame_list.append(frame)
        info = inspect.getframeinfo(frame)
        frame_info_list.append(info)
        frame = frame.f_back

    frame_info_list.reverse()
    frame_list.reverse()
    frame_info_str_list = [format_frameinfo(fi) for fi in frame_info_list]

    return frame_list, frame_info_list, frame_info_str_list
1309392
def list_records_next_page(self):
        
        uri = self._paging.get("record", {}).get("next_uri")
        if uri is None:
            raise exc.NoMoreResults("There are no more pages of records to list.")
        return self._list_records(uri)
576944
def pages(self):
        
        cur = self
        pages = []
        while cur.previous:
            cur = cur.previous
        while cur:
            pages.append(cur)
            cur = cur.next
        return pages
428162
def pages(self):
        
        # protected access has to be permitted here to not close the paginator's pages

        # pylint: disable=protected-access
        paginator_pages = list(self.paginator._pages)
        if len(self.paginator._current_page) > 1:
            paginator_pages.append('\n'.join(self.paginator._current_page) + '\n' + (self.paginator.suffix or ''))
        # pylint: enable=protected-access

        return paginator_pages
53148
def _included_frames(frame_list, frame_format):
    """"""
    return INCLUDED_FRAMES.format(Nframes=len(frame_list),
                                  frame_dir=os.path.dirname(frame_list[0]),
                                  frame_format=frame_format)
1053689
def paged_object_to_list(paged_object):
    '''
    
    '''
    paged_return = []
    while True:
        try:
            page = next(paged_object)
            paged_return.append(page.as_dict())
        except CloudError:
            raise
        except StopIteration:
            break

    return paged_return