From c6bb86363fd4da07c87e2614728e7f20d9288905 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Thu, 14 Nov 2024 16:35:54 -0500 Subject: [PATCH] Don't use hardcoded sizes --- src/uproot/models/RNTuple.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/uproot/models/RNTuple.py b/src/uproot/models/RNTuple.py index 01f187340..89b11ef1f 100644 --- a/src/uproot/models/RNTuple.py +++ b/src/uproot/models/RNTuple.py @@ -258,9 +258,12 @@ def read_members(self, chunk, cursor, context, file): chunk, _rntuple_anchor_checksum_format, context ) assert self._anchor_checksum == xxhash.xxh3_64_intdigest( - chunk.raw_data[-64 - 8 : -8] + chunk.raw_data[ + -_rntuple_anchor_format.size + - _rntuple_anchor_checksum_format.size : -_rntuple_anchor_checksum_format.size + ] ) - cursor.skip(-8) + cursor.skip(-_rntuple_anchor_checksum_format.size) self._header_chunk_ready = False self._footer_chunk_ready = False @@ -335,7 +338,7 @@ def header(self): h = HeaderReader().read(self._header_chunk, cursor, context) self._header = h assert h.checksum == xxhash.xxh3_64_intdigest( - self._header_chunk.raw_data[:-8] + self._header_chunk.raw_data[: -_rntuple_checksum_format.size] ) return self._header @@ -413,7 +416,7 @@ def footer(self): ), f"checksum={self.header.checksum}, header_checksum={f.header_checksum}" self._footer = f assert f.checksum == xxhash.xxh3_64_intdigest( - self._footer_chunk.raw_data[:-8] + self._footer_chunk.raw_data[: -_rntuple_checksum_format.size] ) return self._footer