コード例 #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