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

Method __exit__

src/borg/crypto/file_integrity.py:199–214  ·  view source on GitHub ↗
(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

197 raise FileIntegrityError(self.path)
198
199 def __exit__(self, exc_type, exc_val, exc_tb):
200 exception = exc_type is not None
201
202 try:
203 if not exception:
204 self.hash_part("final", is_final=True)
205 self.hasher.__exit__(exc_type, exc_val, exc_tb)
206 finally:
207 if self.file_opened:
208 self.file_fd.close()
209 if exception:
210 return
211 if self.writing:
212 self.store_integrity_data(json.dumps({"algorithm": self.hasher.ALGORITHM, "digests": self.digests}))
213 elif self.digests:
214 logger.debug("Verified integrity of %s", self.path)
215
216 def store_integrity_data(self, data: str):
217 self.integrity_data = data

Callers

nothing calls this directly

Calls 5

hash_partMethod · 0.95
store_integrity_dataMethod · 0.95
debugMethod · 0.80
__exit__Method · 0.45
closeMethod · 0.45

Tested by

no test coverage detected