From 6739b25c0aa037b745f6752ed2e9683ddaea244b Mon Sep 17 00:00:00 2001 From: Sanah Bhimani Date: Fri, 26 Jan 2024 16:05:52 +0000 Subject: [PATCH] move base/bases handling out of folder patterns for loop --- python/hk/getdata.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/python/hk/getdata.py b/python/hk/getdata.py index 98819a1..63ccfbe 100644 --- a/python/hk/getdata.py +++ b/python/hk/getdata.py @@ -866,28 +866,28 @@ def load_range(start, stop, fields=None, alias=None, hk_logger.debug(f'Folder {base} does not exist, skipping') continue - if len(bases) > 1: - hk_logger.warn("More than 1 path exists, please fix") # FIX - bases.sorted() - base = bases[0] - elif len(bases) == 1: - base = bases[0] - elif len(bases) == 0: - hk_logger.warn("No folder path exists.") # FIX; wording obscure - - print('base', base) - - for file in sorted(os.listdir(base)): - if file.endswith('.yaml'): - continue - try: - t = int(file[:-3]) - except: - hk_logger.debug('{} does not have the right format, skipping'.format(file)) - continue - if t >= start_ctime-3600 and t <=stop_ctime+3600: - hk_logger.debug('Processing {}'.format(base+'/'+file)) - hksc.process_file_with_cache( base+'/'+file) + if len(bases) > 1: + hk_logger.warn("More than 1 path exists, please fix") # FIX + bases.sorted() + base = bases[0] + elif len(bases) == 1: + base = bases[0] + elif len(bases) == 0: + hk_logger.warn("No folder path exists.") # FIX; wording obscure + + print('base', base) + + for file in sorted(os.listdir(base)): + if file.endswith('.yaml'): + continue + try: + t = int(file[:-3]) + except: + hk_logger.debug('{} does not have the right format, skipping'.format(file)) + continue + if t >= start_ctime-3600 and t <=stop_ctime+3600: + hk_logger.debug('Processing {}'.format(base+'/'+file)) + hksc.process_file_with_cache( base+'/'+file) cat = hksc.finalize()