Public: Returns the number of pages accessible from a commit

 ref - A String ref that is either a commit SHA or references one.

 Returns a Fixnum
177019
def size(ref = nil)
      tree_map_for(ref || @ref).inject(0) do |num, entry|
        num + (@page_class.valid_page_name?(entry.name) ? 1 : 0)
      end
    rescue Gollum::Git::NoSuchShaFound
      0
    end
581186
def get_ref(self, branch, origin=None):
        
        if not origin:
            origin = self.origin
        uri = "{api}/repos/{origin}/git/refs/heads/{branch}".format(
            api=self.github_api_url,
            origin=origin,
            branch=branch
        )
        data = self.request("GET", uri)
        if data.status_code == 200:
            data = json.loads(data.content.decode("utf-8"))
            if isinstance(data, list):
                # No addresses matches, we get search results which stars with {branch}
                return False
            #  Otherwise, we get one record
            return data["object"]["sha"]
        elif data.status_code == 404:
            return False
        else:
            decoded_data = json.loads(data.content.decode("utf-8"))
            return self.ProxyError(
                data.status_code, (decoded_data, "message"),
                step="get_ref", context={
                    "uri": uri
                }
            )
655574
def references(self):
    '''
    
    '''

    if not getattr(self, '_references', False):
      def add_protocol(url):
        return url if url.startswith('http') else 'http:' + url

      self._references = [
        add_protocol(link['*'])
        for link in self.__continued_query({
          'prop': 'extlinks',
          'ellimit': 'max'
        })
      ]

    return self._references
608742
def new_from_sha(cls, repo, sha1):
        
        if sha1 == cls.NULL_BIN_SHA:
            # the NULL binsha is always the root commit
            return get_object_type_by_name(b'commit')(repo, sha1)
        # END handle special case
        oinfo = repo.odb.info(sha1)
        inst = get_object_type_by_name(oinfo.type)(repo, oinfo.binsha)
        inst.size = oinfo.size
        return inst
244470
def get_adjusted_error_count(self):
    
    p1 =  self._observable.get_attributable_length()
    p1 += self._unobservable.get_attributable_length()
    return p1
1124347
def __getNumberOfRepositories(self, web):
        
        counters = web.find_all('span', {'class': 'Counter'})
        try:
            if 'k' not in counters[0].text:
                self.numberOfRepos = int(counters[0].text)
            else:
                reposText = counters[0].text.replace(" ", "")
                reposText = reposText.replace("\n", "").replace("k", "")

                if reposText and len(reposText) > 1:
                    self.numberOfRepos = int(reposText.split(".")[0]) * \
                        1000 + int(reposText.split(".")[1]) * 100
                elif reposText:
                    self.numberOfRepos = int(reposText.split(".")[0]) * 1000
        except IndexError as error:
            print("There was an error with the user " + self.name)
            print(error)
        except AttributeError as error:
            print("There was an error with the user " + self.name)
            print(error)
1300345
def lint(self, commit):
        
        LOG.debug("Linting commit %s", commit.sha or "[SHA UNKNOWN]")
        LOG.debug("Commit Object\n" + ustr(commit))

        # Apply config rules
        for rule in self.configuration_rules:
            rule.apply(self.config, commit)

        # Skip linting if this is a special commit type that is configured to be ignored
        ignore_commit_types = ["merge", "squash", "fixup"]
        for commit_type in ignore_commit_types:
            if getattr(commit, "is_{0}_commit".format(commit_type)) and \
               getattr(self.config, "ignore_{0}_commits".format(commit_type)):
                return []

        violations = []
        # determine violations by applying all rules
        violations.extend(self._apply_line_rules([commit.message.title], commit, self.title_line_rules, 1))
        violations.extend(self._apply_line_rules(commit.message.body, commit, self.body_line_rules, 2))
        violations.extend(self._apply_commit_rules(self.commit_rules, commit))

        # Sort violations by line number and rule_id. If there's no line nr specified (=common certain commit rules),
        # we replace None with -1 so that it always get's placed first. Note that we need this to do this to support
        # python 3, as None is not allowed in a list that is being sorted.
        violations.sort(key=lambda v: (-1 if v.line_nr is None else v.line_nr, v.rule_id))
        return violations
1265073
def _commit(self, ref):
        ''
        path_times = self._weakref_path_map[ref]
        path_times.append(nanotime())
        del self._weakref_path_map[ref]
        path = tuple(path_times[1::2])
        times = path_times[::2]
        if path not in self.path_stats:
            # tuple to save a tiny bit of memory
            self.path_stats[path] = tuple([
                Duration(interval=False) for i in range(len(path))])
        path_stats = self.path_stats[path]
        for i in range(1, len(times)):
            path_stats[i - 1]._stats.add(times[i] - times[i - 1])
1225269
def get_ref_id(self):

        
        if self.ref_key == 'NETWORK':
            return self.network_id
        elif self.ref_key == 'NODE':
            return self.node_id
        elif self.ref_key == 'LINK':
            return self.link_id
        elif self.ref_key == 'GROUP':
            return self.group_id
        elif self.ref_key == 'SCENARIO':
            return self.scenario_id
        elif self.ref_key == 'PROJECT':
            return self.project_id
1206178
def _getPageObjNumber(self, pno):
        """"""
        if self.isClosed:
            raise ValueError("operation illegal for closed doc")

        return _fitz.Document__getPageObjNumber(self, pno)
369754
def sha_for(revision)
      # note that 'git show-ref' produces easier-to-parse output but it matches
      # both local and remote branch to a simple branch name whereas 'git show'
      # matches at-most-one and requires origin/ for remote branches.
      git_args = ['show', revision].compact
      result = nil
      git_output(git_args).lines.each do |line|
        if matched = COMMIT_SHA1_REGEX.match(line.strip)
          result = matched[1]
          break
        end
      end
      unless result
        raise GitError, 'Unable to locate commit in show output.'
      end
      result
    end
671174
def commit(ref)
      if sha?(ref)
        get_cache(:commit, ref) { commit!(ref) }
      else
        if (sha = get_cache(:ref, ref))
          commit(sha)
        else
          if (cm = commit!(ref))
            set_cache(:ref, ref, cm.id)
            set_cache(:commit, cm.id, cm)
          end
        end
      end
    end
1331764
def commit(self, sha):
        
        url = self._build_url('commits', sha, base_url=self._api)
        json = self._json(self._get(url), 200)
        return RepoCommit(json, self) if json else None
204170
def get_page(n)
            raise IndexError, "Page numbers are referenced starting from 1" if n < 1
            raise IndexError, "Page not found" if n > self.Count.to_i

            self.each_page.lazy.drop(n - 1).first or raise IndexError, "Page not found"
        end
1165003
def number_of_pages(self, key, value):
    """"""
    result = maybe_int(force_single_element(value.get('a', '')))
    if result and result > 0:
        return result
1168179
def pending_commits
      current_commit = IO.popen("git rev-parse 'HEAD'").read.strip
      format = "%C(yellow)%h%Creset %s %C(red)(%cr)%Creset"
      range = "#{git_info["deployed_commit_sha"]}..#{current_commit}"
      IO.popen(%Q{git log --no-merges --oneline --pretty=format:"#{format}" #{range}}).read.strip
    end
59940
function refcount(req, res) {
  var obj = req.db.getKey(req.args[0], req);
  if(obj === undefined) return res.send(null, null);
  res.send(null, -1);
}