Mercurial > hgrepos > Python > apps > py-cutils
changeset 322:0cabc5439505
treesum: Remove CRC32Output completely
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 26 Mar 2025 13:00:40 +0100 |
| parents | 49ecfff4f319 |
| children | 48430941c18c |
| files | cutils/treesum.py |
| diffstat | 1 files changed, 0 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/cutils/treesum.py Wed Mar 26 12:56:19 2025 +0100 +++ b/cutils/treesum.py Wed Mar 26 13:00:40 2025 +0100 @@ -1243,52 +1243,6 @@ return name -class CRC32Output(object): - - """Wrapper for a minimal binary file contextmanager that calculates - the CRC32 of the written bytes on the fly. - - Also acts as context manager proxy for the given context manager. - - """ - - __slots__ = ("_fp_cm", "_fp", "_crc32") - - def __init__(self, fp_cm): - self._fp_cm = fp_cm - self._fp = None - self.resetdigest() - - def __enter__(self): - assert self._fp is None - self._fp = self._fp_cm.__enter__() - return self - - def __exit__(self, *args): - rv = self._fp_cm.__exit__(*args) - self._fp = None - return rv - - def write(self, what): - self._fp.write(what) - self._crc32.update(what) - - def flush(self): - self._fp.flush() - - def resetdigest(self): - """Reset the current CRC digest""" - self._crc32 = crc32() - - def hexcrcdigest(self): - """ - - :rtype: str - - """ - return self._crc32.hexdigest() - - def normalized_compatible_mode_str(mode): # XXX FIXME: Windows and "executable" modebits = stat.S_IMODE(mode)
