Data I/O¶
This module provides input/output utilities for loading and saving concept data.
Summary¶
I/O Functions and Classes
Extract a zip archive to a specific folder. |
|
Extract a tar (or tar.gz) archive to a specific folder. |
|
Save object to file as pickle. |
|
Load object from pickle file. |
|
Downloads the content of an URL to a specific folder. |
|
Progress bar for file downloads. |
Function Documentation¶
- extract_zip(path: str, folder: str)[source]¶
Extract a zip archive to a specific folder.
- Parameters:
path – The path to the zip archive.
folder – The destination folder.
- extract_tar(path: str, folder: str, verbose: bool = True)[source]¶
Extract a tar (or tar.gz) archive to a specific folder.
- Parameters:
path – The path to the tar(gz) archive.
folder – The destination folder.
verbose – If False, will not show progress bars (default: True).
- save_pickle(obj: Any, filename: str) str[source]¶
Save object to file as pickle.
- Parameters:
obj – Object to be saved.
filename – Where to save the file.
- Returns:
The absolute path to the saved pickle.
- Return type:
- load_pickle(filename: str) Any[source]¶
Load object from pickle file.
- Parameters:
filename – The absolute path to the saved pickle.
- Returns:
The loaded object.
- Return type:
Any
Class Documentation¶
- class DownloadProgressBar(*_, **__)[source]¶
Bases:
tqdmProgress bar for file downloads.
Extends tqdm to show download progress with file size information. Adapted from https://stackoverflow.com/a/53877507