Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Helper functions. """
""" Compute a checksum of a disk file. """ md5 = hashlib.md5()
with open(path, 'rb') as file: mapped = mmap.mmap(file.fileno(), 0, prot=mmap.PROT_READ) md5.update(mapped) # type: ignore mapped.close()
return UUID(bytes=md5.digest())
""" Use ``md5sum`` to combine multiple UUIDs into a single UUID. """ md5 = hashlib.md5() for uuid in uuids: md5.update(uuid.bytes) return UUID(bytes=md5.digest())
""" Create a logged loop for summing profiles. """ return Loop(start='Sum profiles...', progress='Summed %sK profiles (%.2f%%)...', completed='Summed %s profiles', log_every=100_000, log_with=1_000, expected=expected) |