예제 #1
0
 def __exit__(self, exc_type, exc_val, exc_tb):
     from .. import platform
     self.fd.close()
     if exc_type is not None:
         truncate_and_unlink(self.tmppath)
         return
     os.replace(self.tmppath, self.path)
     platform.sync_dir(os.path.dirname(self.path))
예제 #2
0
파일: base.py 프로젝트: Abogical/borg
 def __exit__(self, exc_type, exc_val, exc_tb):
     from .. import platform
     self.fd.close()
     if exc_type is not None:
         truncate_and_unlink(self.tmppath)
         return
     os.replace(self.tmppath, self.path)
     platform.sync_dir(os.path.dirname(self.path))
예제 #3
0
 def __enter__(self):
     from .. import platform
     try:
         truncate_and_unlink(self.tmppath)
     except FileNotFoundError:
         pass
     self.fd = platform.SyncFile(self.tmppath, self.binary)
     return self.fd
예제 #4
0
파일: base.py 프로젝트: Abogical/borg
 def __enter__(self):
     from .. import platform
     try:
         truncate_and_unlink(self.tmppath)
     except FileNotFoundError:
         pass
     self.fd = platform.SyncFile(self.tmppath, self.binary)
     return self.fd