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

Method hash_part

src/borg/crypto/file_integrity.py:187–197  ·  view source on GitHub ↗
(self, partname, is_final=False)

Source from the content-addressed store, hash-verified

185 raise FileIntegrityError(path)
186
187 def hash_part(self, partname, is_final=False):
188 if not self.writing and not self.digests:
189 return
190 self.hasher.update(("%10d" % len(partname)).encode())
191 self.hasher.update(partname.encode())
192 self.hasher.hash_length(seek_to_end=is_final)
193 digest = self.hasher.hexdigest()
194 if self.writing:
195 self.digests[partname] = digest
196 elif self.digests and not compare_digest(self.digests.get(partname, ""), digest):
197 raise FileIntegrityError(self.path)
198
199 def __exit__(self, exc_type, exc_val, exc_tb):
200 exception = exc_type is not None

Callers 5

__exit__Method · 0.95
test_simpleMethod · 0.80
test_wrong_part_nameMethod · 0.80

Calls 5

FileIntegrityErrorClass · 0.85
hash_lengthMethod · 0.80
hexdigestMethod · 0.80
updateMethod · 0.45
getMethod · 0.45

Tested by 4

test_simpleMethod · 0.64
test_wrong_part_nameMethod · 0.64