Skip to content

Commit 4319bbb

Browse files
committed
let tqdm work on list in transfer_files_from_dir_copy.
1 parent c862dd7 commit 4319bbb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kapture/io/binary.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,13 @@ def transfer_files_from_dir_copy(
123123
:param delete_source: if True, delete the imported files from source_record_dirpath.
124124
"""
125125
hide_progress_bar = logger.getEffectiveLevel() > logging.INFO
126+
jobs = zip(source_filepath_list, destination_filepath_list)
126127
logger.debug('Copying data files')
127-
for src, dst in tqdm(zip(source_filepath_list, destination_filepath_list), disable=hide_progress_bar):
128+
try:
129+
total_progress_bar = min(len(source_filepath_list), len(destination_filepath_list))
130+
except TypeError:
131+
total_progress_bar = None
132+
for src, dst in tqdm(jobs, disable=hide_progress_bar, total=total_progress_bar):
128133
os.makedirs(path.dirname(dst), exist_ok=True)
129134
if force_overwrite and path.lexists(dst):
130135
os.remove(dst)

0 commit comments

Comments
 (0)