Skip to content

Commit

Permalink
Moves computation of fLen max to strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioanaif authored Sep 22, 2023
1 parent a0e6d66 commit 3f2fae2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/uproot/writing/_cascadetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1460,12 +1460,9 @@ def write_jagged_basket(self, sink, branch_name, compression, array, offsets):
)
compressed_data = uproot.compression.compress(uncompressed_data, compression)

# get size of biggest string
self._metadata["fLen"] = max(
[offsets[i + 1] - offsets[i] for i in range(len(offsets) - 1)]
)

fLast = offsets[-1]
offsets[-1] = 0

fObjlen = len(uncompressed_data)
fNbytes = fKeylen + len(compressed_data)

Expand Down Expand Up @@ -1545,6 +1542,11 @@ def write_string_basket(self, sink, branch_name, compression, array, offsets):
)
compressed_data = uproot.compression.compress(uncompressed_data, compression)

# get size of biggest string
self._metadata["fLen"] = max(
[offsets[i + 1] - offsets[i] for i in range(len(offsets) - 1)]
)

fLast = offsets[-1]
offsets[-1] = 0

Expand Down

0 comments on commit 3f2fae2

Please sign in to comment.