Skip to content

Commit cc2ed28

Browse files
committed
feat: support RNTuple
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 0555350 commit cc2ed28

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/uproot_browser/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def plot(tree: Any) -> None: # noqa: ARG001
5151

5252

5353
@plot.register
54-
def plot_branch(tree: uproot.TBranch) -> None:
54+
def plot_branch(tree: uproot.TBranch | uproot.models.RNTuple.RField) -> None:
5555
"""
5656
Plot a single tree branch.
5757
"""

src/uproot_browser/tree.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def is_dir(self) -> bool:
5252
return True
5353
if isinstance(self.item, uproot.behaviors.TBranch.HasBranches):
5454
return len(self.item.branches) > 0
55+
if isinstance(self.item, uproot.behaviors.RNTuple.HasFields):
56+
return len(self.item.keys()) > 0
5557
return False
5658

5759
def meta(self) -> MetaDict:
@@ -79,6 +81,8 @@ def children(self) -> list[UprootEntry]:
7981
}
8082
elif isinstance(self.item, uproot.behaviors.TBranch.HasBranches):
8183
items = {item.name for item in self.item.branches}
84+
elif isinstance(self.item, uproot.behaviors.RNTuple.HasFields):
85+
items = self.item.keys()
8286
else:
8387
items = {obj.name.split(";")[0] for obj in self.item.branches}
8488
return [
@@ -141,7 +145,7 @@ def _process_item_tfile(
141145

142146

143147
@process_item.register
144-
def _process_item_ttree(uproot_object: uproot.TTree) -> MetaDict:
148+
def _process_item_ttree(uproot_object: uproot.TTree | uproot.behaviors.RNTuple.RNTuple) -> MetaDict:
145149
"""
146150
Given an tree, return a rich.tree.Tree output.
147151
"""

0 commit comments

Comments
 (0)