def copy_attribs(self, other): """Only copy attributes from self to other""" if isinstance(other, Path): 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