protocols.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:gitorg 作者: mariocj89 项目源码 文件源码
def list(self, pattern):
        res = self._EXTRACT_PATTERN.match(pattern)
        if not res:
            raise URIException(f"Unable to match {pattern},"
                               " please use 'organization[/repo_pattern]'")
        org_name = res.group("org")
        repo_matcher = res.group("repo") or "*"

        try:
            repos = self._gh.get_organization(org_name).get_repos()
        except github.GithubException:
            repos = self._gh.get_user(org_name).get_repos()

        for repo in repos:
            if not fnmatch.fnmatch(repo.name, repo_matcher):
                continue
            if self._clone_protocol == self.CloneProtocol.ssh:
                yield Repo(name=repo.name, url=repo.ssh_url)
            elif self._clone_protocol == self.CloneProtocol.https:
                yield Repo(name=repo.name, url=repo.clone_url)
            else:
                raise RuntimeError(f"Invalid protocol selected: {self._clone_protocol}")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号