@@ -111,20 +111,23 @@ def print_structure_from_str(deliver_dict, filter_branch="", save_to_txt=False,
111
111
with uproot .open (path [0 ]) as f :
112
112
structure_str = f ["servicex" ]["branch" ].array ()[0 ]
113
113
114
+ # Trees separated by \n
114
115
tree_lines = structure_str .split ("\n " )
115
116
for line in tree_lines :
116
117
if not line .strip ():
117
118
continue # Skip empty lines
118
119
120
+ #Separate Tree header from branches
119
121
parts = line .split (";" , 1 )
120
122
tree_header = parts [0 ]
121
123
output_lines .append (f"\n \U0001F333 { tree_header } " )
122
124
123
125
if len (parts ) > 1 :
124
- branch_infos = parts [1 ].split ("," )
126
+ branch_infos = parts [1 ].split ("," ) # Branches separated by ,
125
127
output_lines .append (" ├── Branches:" )
126
128
for b in branch_infos :
127
- branch_line = b .strip ()
129
+ branch_line = b .strip ()
130
+ # Removes lines w/o filter str
128
131
if filter_branch not in branch_line :
129
132
continue
130
133
if branch_line .startswith ("TBranch:" ):
@@ -175,7 +178,7 @@ def build_deliver_spec(dataset):
175
178
return spec_python
176
179
177
180
178
- def get_structure (dataset , ** kwargs ):
181
+ def get_structure (dataset , ** kwargs , raw = False ):
179
182
"""
180
183
Utility function.
181
184
Creates and sends the ServiceX request from user inputed datasets to retrieve file stucture.
@@ -190,4 +193,7 @@ def get_structure(dataset, **kwargs):
190
193
191
194
output = servicex .deliver (spec_python )
192
195
196
+ if raw :
197
+ return array_from_str (output )
198
+
193
199
return print_structure_from_str (output , ** kwargs )
0 commit comments