File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -420,6 +420,16 @@ def format_columns(columns: list):
420
420
return ret_columns
421
421
422
422
423
+ # add OR filter to each inner filter list
424
+ def add_or_filter (filters , cut : list [tuple ]):
425
+ if isinstance (filters [0 ], list ):
426
+ # recursively handle nested filter lists
427
+ return [add_or_filter (f , cut ) for f in filters ]
428
+ else :
429
+ # add OR filter at leaf level
430
+ return filters + cut
431
+
432
+
423
433
def _normalize_weights (
424
434
events : pd .DataFrame ,
425
435
year : str ,
@@ -514,9 +524,11 @@ def load_sample(
514
524
515
525
# find the directory that contains the sample
516
526
for sp in sample_path :
517
- spy = sp / year
518
- full_samples_list = listdir (spy ) # get all directories in data_dir
519
- load_samples = [str (s ) for s in full_samples_list if sample .get_selector (year ).match (s )]
527
+ spy = Path (sp ) / year
528
+ full_samples_list = list (spy .iterdir ()) # get all directories in data_dir
529
+ load_samples = [
530
+ s .name for s in full_samples_list if sample .get_selector (year ).match (s .name )
531
+ ]
520
532
if len (load_samples ):
521
533
sample_path = spy
522
534
break
You can’t perform that action at this time.
0 commit comments