garmentiq.utils.unzip
1import zipfile 2from tqdm.notebook import tqdm 3 4 5def unzip(zip_path, extract_to="."): 6 """ 7 Extracts the contents of a ZIP file with a progress bar. 8 9 This function unzips the contents of the specified ZIP file to the given directory. 10 A progress bar is displayed during the extraction using `tqdm`. 11 12 Args: 13 zip_path (str): Path to the ZIP file to be extracted. 14 extract_to (str): Destination directory where the contents will be extracted. Defaults to the current directory. 15 16 Returns: 17 None 18 """ 19 with zipfile.ZipFile(zip_path, "r") as zip_ref: 20 members = zip_ref.infolist() 21 for member in tqdm(members, desc="Extracting"): 22 zip_ref.extract(member, extract_to)
def
unzip(zip_path, extract_to='.'):
6def unzip(zip_path, extract_to="."): 7 """ 8 Extracts the contents of a ZIP file with a progress bar. 9 10 This function unzips the contents of the specified ZIP file to the given directory. 11 A progress bar is displayed during the extraction using `tqdm`. 12 13 Args: 14 zip_path (str): Path to the ZIP file to be extracted. 15 extract_to (str): Destination directory where the contents will be extracted. Defaults to the current directory. 16 17 Returns: 18 None 19 """ 20 with zipfile.ZipFile(zip_path, "r") as zip_ref: 21 members = zip_ref.infolist() 22 for member in tqdm(members, desc="Extracting"): 23 zip_ref.extract(member, extract_to)
Extracts the contents of a ZIP file with a progress bar.
This function unzips the contents of the specified ZIP file to the given directory.
A progress bar is displayed during the extraction using tqdm
.
Arguments:
- zip_path (str): Path to the ZIP file to be extracted.
- extract_to (str): Destination directory where the contents will be extracted. Defaults to the current directory.
Returns:
None