Retrieves a specific result for a page given page number.
 The <tt>page_number</tt> parameter is not validate, hitting a page
 that does not exist will return Github API error. Consequently, if
 there is only one page, this method returns nil
765290
def page(page_number)
      request = page_iterator.get_page(page_number)
      self.instance_eval { @env = request.env } if request
      request
    end
1151730
def _github_count(self, url):
        
        url = self.url_api + url + "&per_page=1"
        # if we have authentication details use them as we get better
        # rate-limiting.
        if self.username and self.auth_token:
            auth = (self.username, self.auth_token)
        else:
            auth = None
        try:
            info = self.py3.request(url, auth=auth)
        except (self.py3.RequestException):
            return
        if info and info.status_code == 200:
            return int(info.json()["total_count"])
        if info.status_code == 422:
            if not self.repo_warning:
                self.py3.notify_user("Github repo cannot be found.")
                self.repo_warning = True
        return "?"
1287171
def get_page_text_url(self, page):
        
        template = self.resources.page.get('text')
        url = template.replace("{page}", str(page))
        return url
941730
def _get_results(self, page):
		""""""

		soup = _get_soup(page)
		details = soup.find_all("tr", class_="odd")
		even = soup.find_all("tr", class_="even")
		# Join the results
		for i in range(len(even)):
			details.insert((i * 2)+1, even[i])

		return self._parse_details(details)
553773
def get(self, request):
        
        sections = self.generate_sections()

        if self.paginated:
            p = Paginator(sections, 25)

            page = request.GET.get('page')

            try:
                sections = p.page(page)
            except PageNotAnInteger:
                # If page is not an integer, deliver first page.
                sections = p.page(1)
            except EmptyPage:
                # If page is out of range (e.g. 9999), return last page
                # of results.
                sections = p.page(p.num_pages)

            pageUpper = int(p.num_pages) / 2

            try:
                pageLower = int(page) / 2
            except TypeError:
                pageLower = -999
        else:
            pageUpper = None
            pageLower = None

        context = {
            'sections': sections,
            'page_title': self.generate_page_title(),
            'browse_type': self.browse_type,
            'pageUpper': pageUpper,
            'pageLower': pageLower
        }

        return render(
            request,
            self.template_path,
            context
        )
1241699
def _get_next_page_response(self):
        
        params = self._get_query_params()
        if self._HTTP_METHOD == "GET":
            return self.api_request(
                method=self._HTTP_METHOD, path=self.path, query_params=params
            )
        elif self._HTTP_METHOD == "POST":
            return self.api_request(
                method=self._HTTP_METHOD, path=self.path, data=params
            )
        else:
            raise ValueError("Unexpected HTTP method", self._HTTP_METHOD)
1091335
def get_page_numbers(current_page, num_pages):
    

    if current_page <= 2:
        start_page = 1
    else:
        start_page = current_page - 2

    if num_pages <= 4:
        end_page = num_pages
    else:
        end_page = start_page + 4
        if end_page > num_pages:
            end_page = num_pages

    pages = []
    if current_page != 1:
        pages.append('first')
        pages.append('previous')
    pages.extend([i for i in range(start_page, end_page + 1)])
    if current_page != num_pages:
        pages.append('next')
        pages.append('last')
    return pages
321968
def get(self, request, **kwargs):
        
        topic = self.get_topic()

        # Handle pagination
        requested_post = request.GET.get('post', None)
        if requested_post:
            try:
                assert requested_post.isdigit()
                post = topic.posts.get(pk=requested_post)
                requested_page = (
                    ((post.position - 1) // machina_settings.TOPIC_POSTS_NUMBER_PER_PAGE) + 1
                )
                request.GET = request.GET.copy()  # A QueryDict is immutable
                request.GET.update({'page': requested_page})
            except (Post.DoesNotExist, AssertionError):
                pass

        response = super().get(request, **kwargs)
        self.send_signal(request, response, topic)
        return response
1371823
def page_url(url)
      define_method("goto") do
        platform.navigate_to self.page_url_value
      end

      define_method('page_url_value') do
        lookup = url.kind_of?(Symbol) ? self.send(url) : url
        erb = ERB.new(%Q{#{lookup}})
        merged_params = self.class.instance_variable_get("@merged_params")
        params = merged_params ? merged_params : self.class.params
        erb.result(binding)
      end
    end
394735
def get(self, limit=None, page=None):
        
        has_more = False
        self.bounds.paginate = True
        limit_paginate, offset = self.bounds.get(limit, page)
        self.default_val = []
        results = self._query('get')

        if limit_paginate:
            self.bounds.paginate = False
            if len(results) == limit_paginate:
                has_more = True
                results.pop(-1)

        it = ResultsIterator(results, orm_class=self.orm_class, has_more=has_more, query=self)
        return self.iterator_class(it)
1251914
function decodePage(output, page, result) {
    var originalContent = page.getContent();

    // No returned value
    // Existing content will be used
    if (!result) {
        return page;
    }

    deprecate.disable('page.sections');

    // GitBook 3
    // Use returned page.content if different from original content
    if (result.content != originalContent) {
        page = page.set('content', result.content);
    }

    // GitBook 2 compatibility
    // Finally, use page.sections
    else if (result.sections) {
        page = page.set('content',
            result.sections.map(function(section) {
                return section.content;
            }).join('\n')
        );
    }

    deprecate.enable('page.sections');

    return page;
}
187368
def mkcache(result_page, number)
      mkcache_dir

      @logger.info("Download #{result_page.uri.path}")

      # ランナーデータエラー（存在しない）でもキャッシュを作成する
      if File.basename(result_page.uri.path) == 'number_error.html'
        number_file = File.join(@cache_dir, "#{number}_error.html")
        @agent.download(result_page.uri.path, number_file)
        return nil
      end

      number_file = File.join(@cache_dir, "#{number}.html")
      @agent.download(result_page.uri.path, number_file)
      return result_page
    end
1026389
def page(record)
      p = @pages.get(record.page_idx, record) || load(record.page_idx, record)
      unless p.uid == record.page_idx
        raise RuntimeError, "Page reference mismatch. Record " +
          "#{record.page_idx} points to page #{p.uid}"
      end

      p
    end
48448
def _parse_result_page(self, url, payload, only_region=False):
        
        data = []
        try:

            if only_region:
                html = self.scraper._get_html(url)
            else:
                html = self.scraper._post_html(url, payload=payload)

        except RequestException500:

            self.scraper.log.warning(u"Status code 500 on {} with {}".format(url, payload))
            return None


        current_selection = self._get_current_selection(html)

        table = Datatable(html)
        data = []
        for row in table.data:
            region_or_unit_id, region_or_unit_label = row["region_or_unit"]
            if region_or_unit_label in self.regions:
                row["region"] = region_or_unit_label
                row["unit"] = None
            else:
                row["region"] = None
                row["unit"] = region_or_unit_label

            value = row["value"]

            row.pop("value", None)
            row.pop("region_or_unit", None)

            for dim in self.dimensions:
                if dim.id not in row:
                    row[dim.id] = current_selection[dim.id][1] # gets label



            data.append(Result(value, row))
        return data
668351
def page(number)
      cache = cache(number)
      unless cache.nil?
        return cache
      end

      if exist_runner?(number)
        return nil
      end

      search_page = @agent.get(@url)

      # レースデータ取得エラー
      if search_page.uri.path == '/record'
        raise(RaceError.new(@url))
      end

      form = search_page.forms[0]
      form.number = number
      result_page = @agent.submit(form)
      return mkcache(result_page, number)
    end
1185285
function (pageNum) {
            var textPath = util.template(config.template.html, { page: pageNum });
            return config.url + textPath + config.queryString;
        }
653894
def _result(number)
      page = page(number)

      # 取得出来ず
      if page.nil?
        return nil
      end

      name = page.at('div#personalBlock/dl/dd').text.sub('： ', '')

      runner = Runner.new(number, name)
      trs = page.search('table.sarchList/tr[@align="center"]')
      trs.each  do |tr|
        tds = tr.xpath('td')
        name, split, lap, pass = tds.map(&:text)
        runner.add_point(name, split, lap, pass)
      end

      return runner
    end