travis.py 文件源码

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

项目:doctr 作者: drdoctr 项目源码 文件源码
def copy_to_tmp(source):
    """
    Copies ``source`` to a temporary directory, and returns the copied location.
    """
    tmp_dir = tempfile.mkdtemp()
    # Use pathlib because os.path.basename is different depending on whether
    # the path ends in a /
    p = pathlib.Path(source)
    new_dir = os.path.join(tmp_dir, p.name)
    if os.path.isdir(source):
        shutil.copytree(source, new_dir)
    else:
        shutil.copy2(source, new_dir)
    return new_dir
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号