MCPcopy
hub / github.com/borgbackup/borg / __exit__

Method __exit__

src/borg/platform/base.py:257–272  ·  view source on GitHub ↗
(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

255 return self.f
256
257 def __exit__(self, exc_type, exc_val, exc_tb):
258 from .. import platform
259
260 self.f.close() # this indirectly also closes self.tmp_fd
261 self.tmp_fd = None
262 if exc_type is not None:
263 safe_unlink(self.tmp_fname) # with-body has failed, clean up tmp file
264 return # continue processing the exception normally
265
266 try:
267 os.replace(self.tmp_fname, self.path) # POSIX: atomic rename
268 except OSError:
269 safe_unlink(self.tmp_fname) # rename has failed, clean up tmp file
270 raise
271 finally:
272 platform.sync_dir(self.dir)
273
274
275def swidth(s):

Callers

nothing calls this directly

Calls 3

safe_unlinkFunction · 0.85
replaceMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected