pooch.Untar

pooch.Untar#

class pooch.Untar(members=None, extract_dir=None)[source]#

Processor that unpacks a tar archive and returns a list of all files.

Use with pooch.Pooch.fetch or pooch.retrieve to untar a downloaded data file into a folder in the local data store. The method/function will return a list with the names of the extracted files instead of the archive.

The output folder is {fname}.untar.

Parameters:
  • members (list or None) – If None, will unpack all files in the 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 tar file, with the suffix .untar added). Otherwise, files will be unpacked to extract_dir, which is interpreted as a relative path (relative to the cache location provided by pooch.retrieve or pooch.Pooch.fetch).

Methods Summary

Untar.__call__(fname, action, pooch)

Extract all files from the given archive.


Untar.__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 or pooch.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 of pooch.Pooch that is calling this.

Returns:

fnames (list of str) – A list of the full path to all files in the extracted archive.