From 36cfdad078875c7f7447be36c6188deb6c6f512e Mon Sep 17 00:00:00 2001 From: Ars Vladimirov Date: Wed, 11 Oct 2023 15:28:54 +0600 Subject: [PATCH] fix pack_directory_to_tar --- src/main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index 95c8735..f7e154c 100644 --- a/src/main.py +++ b/src/main.py @@ -42,9 +42,15 @@ def pack_directory_to_tar(source_dir, output_tar): with tarfile.open(output_tar, "w") as tar: for root, _, files in os.walk(source_dir): - for file in tqdm(files, desc=f"Packing to '{output_tar}'", unit="file"): - file_path = os.path.join(root, file) - tar.add(file_path, arcname=os.path.relpath(file_path, source_dir)) + with tqdm.tqdm( + desc=f"Unpacking '{output_tar}'", + total=len(files), + unit="file", + ) as pbar: + for file in files: + file_path = os.path.join(root, file) + tar.add(file_path, arcname=os.path.relpath(file_path, source_dir)) + pbar.update(1) def ours_convert_json_info(self, info: dict, skip_missing=True):