main.py 文件源码

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

项目:got 作者: mrozekma 项目源码 文件源码
def deps(repo: Optional[RepoSpec], format: str, file: Optional[str], on_uncloned: str) -> Iterable[str]:
    if file is not None:
        file = Path(file)
        if not file.exists():
            raise ValueError(f"Dependency file does not exist: {file}")
    t = Template(format)
    for clone in iterDeps(repo, on_uncloned, file):
        try:
            hexsha = git.Repo(str(clone.path)).head.commit.hexsha
        except:
            hexsha = '0' * 40
        try:
            yield t.substitute(
                H = hexsha,
                h = hexsha[:7],
                RS = clone.repospec.str(),
                rs = clone.repospec.str(False, False),
                p = str(clone.path),
            )
        except KeyError as e:
            raise ValueError("Invalid format string specifier: %s" % e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号