diff --git a/hfutils/archive/rar.py b/hfutils/archive/rar.py index ca6a5abac5..2921c9e73e 100644 --- a/hfutils/archive/rar.py +++ b/hfutils/archive/rar.py @@ -2,7 +2,6 @@ from typing import Optional from .base import register_archive_type -from ..utils import tqdm try: import rarfile @@ -11,20 +10,18 @@ def _rar_pack(directory, zip_file, silent: bool = False, clear: bool = False): - _ = directory, zip_file, silent + _ = directory, zip_file, silent, clear raise RuntimeError('RAR format packing is not supported.') def _rar_unpack(rar_file, directory, silent: bool = False, password: Optional[str] = None): + _ = silent directory = os.fspath(directory) os.makedirs(directory, exist_ok=True) with rarfile.RarFile(rar_file, 'r') as zf: if password is not None: zf.setpassword(password) - progress = tqdm(zf.namelist(), silent=silent, desc=f'Unpacking {directory!r} ...') - for rarinfo in progress: - progress.set_description(rarinfo) - zf.extract(rarinfo, directory) + zf.extractall(directory) if rarfile is not None: diff --git a/hfutils/archive/sevenz.py b/hfutils/archive/sevenz.py index a1b8b570f1..0b16213e24 100644 --- a/hfutils/archive/sevenz.py +++ b/hfutils/archive/sevenz.py @@ -21,14 +21,11 @@ def _7z_pack(directory, sz_file, silent: bool = False, clear: bool = False): def _7z_unpack(sz_file, directory, silent: bool = False, password: Optional[str] = None): + _ = silent directory = os.fspath(directory) os.makedirs(directory, exist_ok=True) with py7zr.SevenZipFile(sz_file, 'r', password=password) as zf: - progress = tqdm(zf.getnames(), silent=silent, desc=f'Unpacking {directory!r} ...') - for name in progress: - progress.set_description(name) - zf.extract(path=directory, targets=[name]) - zf.reset() + zf.extractall(directory) if py7zr is not None: