微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

PyGithub克隆功能的Python进度栏

如何解决PyGithub克隆功能的Python进度栏

如何查看克隆过程的进度? tqdm模块不适用于单行语句。我应该添加一个git参数吗?任何参考将有所帮助。谢谢。

import git

#clone to local system
git.Repo.clone_from(repo_url,path,branch='master')

解决方法

GitPython source code包括:

def clone_from(cls,url,to_path,progress=None,env=None,multi_options=None,**kwargs):

进度在git.remote.Remote.push

中定义
:param progress:
    Can take one of many value types:
        * None to discard progress information
        * A function (callable) that is called with the progress information.
          Signature: ``progress(op_code,cur_count,max_count=None,message='')``.
        * An instance of a class derived from ``git.RemoteProgress`` that
          overrides the ``update()`` function.

您可以看到progress function herehere的示例。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。