path.py 文件源码

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

项目:qiime2 作者: qiime2 项目源码 文件源码
def __new__(cls, dir=False, **kwargs):
        """
        Create a tempfile, return pathlib.Path reference to it.
        """
        if dir:
            name = tempfile.mkdtemp(**kwargs)
        else:
            fd, name = tempfile.mkstemp(**kwargs)
            # fd is now assigned to our process table, but we don't need to do
            # anything with the file. We will call `open` on the `name` later
            # producing a different file descriptor, so close this one to
            # prevent a resource leak.
            os.close(fd)
        obj = super().__new__(cls, name)
        obj._destructor = weakref.finalize(obj, cls._destruct, str(obj))
        return obj
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号