pooch.Unzip#
- class pooch.Unzip(members=None, extract_dir=None)[source]#
Processor that unpacks a zip archive and returns a list of all files.
Use with
pooch.Pooch.fetch
orpooch.retrieve
to unzip a downloaded data file into a folder in the local data store. The method/function will return a list with the names of the unzipped files instead of the zip archive.The output folder is
{fname}.unzip
.- Parameters:
members (list or None) – If None, will unpack all files in the zip archive. Otherwise, members must be a list of file names to unpack from the archive. Only these files will be unpacked.
extract_dir (str or None) – If None, files will be unpacked to the default location (a folder in the same location as the downloaded zip file, with the suffix
.unzip
added). Otherwise, files will be unpacked toextract_dir
, which is interpreted as a relative path (relative to the cache location provided bypooch.retrieve
orpooch.Pooch.fetch
).
Methods Summary
Unzip.__call__
(fname, action, pooch)Extract all files from the given archive.
- Unzip.__call__(fname, action, pooch)#
Extract all files from the given archive.
- Parameters:
fname (str) – Full path of the zipped file in local storage.
action (str) –
Indicates what action was taken by
pooch.Pooch.fetch
orpooch.retrieve
:"download"
: File didn’t exist locally and was downloaded"update"
: Local file was outdated and was re-download"fetch"
: File exists and is updated so it wasn’t downloaded
pooch (
pooch.Pooch
) – The instance ofpooch.Pooch
that is calling this.
- Returns:
fnames (list of str) – A list of the full path to all files in the extracted archive.