path.py 文件源码

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

项目:alicloud-duplicity 作者: aliyun 项目源码 文件源码
def copy_attribs(self, other):
        """Only copy attributes from self to other"""
        if isinstance(other, Path):
            if self.stat is not None:
                util.maybe_ignore_errors(lambda: os.chown(other.name, self.stat.st_uid, self.stat.st_gid))
            util.maybe_ignore_errors(lambda: os.chmod(other.name, self.mode))
            util.maybe_ignore_errors(lambda: os.utime(other.name, (time.time(), self.stat.st_mtime)))
            other.setdata()
        else:
            # write results to fake stat object
            assert isinstance(other, ROPath)
            stat = StatResult()
            stat.st_uid, stat.st_gid = self.stat.st_uid, self.stat.st_gid
            stat.st_mtime = int(self.stat.st_mtime)
            other.stat = stat
            other.mode = self.mode
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号