Skip to content

Commit

Permalink
Don't use hardcoded sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Nov 14, 2024
1 parent 946d535 commit c6bb863
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/uproot/models/RNTuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c6bb863

Please sign in to comment.