pymovements.utils.archives.extract_archive#

pymovements.utils.archives.extract_archive(source_path: Path, destination_path: Path | None = None, *, recursive: bool = True, remove_finished: bool = False, remove_top_level: bool = True, resume: bool = True, verbose: int = 1) Path[source]#

Extract an archive.

The archive type and a possible compression is automatically detected from the file name. If the file is compressed but not an archive the call is dispatched to _decompress().

Deprecated since version v0.21.1: Please use pymovements.Dataset.extract() instead. This module will be removed in v0.26.0.

Parameters:
  • source_path (Path) – Path to the file to be extracted.

  • destination_path (Path | None) – Path to the directory the file will be extracted to. If omitted, the directory of the file is used. (default: None)

  • recursive (bool) – Recursively extract archives which are included in extracted archive. (default: True)

  • remove_finished (bool) – If True, remove the file after the extraction. (default: False)

  • remove_top_level (bool) – If True, remove the top-level directory if it has only one child. (default: True)

  • resume (bool) – Resume previous extraction by skipping existing files. Checks for correct size of existing files but not integrity. (default: False)

  • verbose (int) – Verbosity levels: (1) Print messages for extracting each dataset resource without printing messages for recursive archives. (2) Print additional messages for each recursive archive extract. (default: 1)

Returns:

  • Path – Path to the directory the file was extracted to.

  • .. deprecated:: v0.21.1 – Please use Dataset.extract() instead. This function will be removed in v0.26.0.