Skip to content

Commit

Permalink
fallback to tree.num_entries for now
Browse files Browse the repository at this point in the history
  • Loading branch information
pfackeldey committed Oct 23, 2024
1 parent 600629e commit fa12703
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/coffea/nanoevents/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,10 @@ def from_root(

if entry_start is None or entry_start < 0:
entry_start = 0
if entry_stop is None or entry_stop > tree.num_entries:
if treepath is not None:
# if treepath exists, attempt the faster uproot.num_entries method
entry_stop = next(uproot.num_entries(f"{file}:{treepath}"))[-1]
else:
entry_stop = tree.num_entries
# should use uproot.num_entries instead...
nentries = tree.num_entries
if entry_stop is None or entry_stop > nentries:
entry_stop = nentries

partition_key = (
str(tree.file.uuid),
Expand Down

0 comments on commit fa12703

Please sign in to comment.