(self, exc_type, exc_val, exc_tb)
| 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 |
nothing calls this directly
no test coverage detected