module filehelper.decompress_helper

Short summary

module pyensae.filehelper.decompress_helper

Various functions to decompress files

source on GitHub

Functions

function

truncated documentation

decompress_bz2

Decompresses a :epkg:`bz2` file.

decompress_gz

Decompresses a :epkg:`tar.gz` file.

decompress_targz

Decompresses a :epkg:`tar.gz` file.

decompress_zip

Unzips a :epkg:`zip` file.

extractall_silent

Extracts all members from the archive to the current working directory and set owner, modification time and permissions …

Documentation

Various functions to decompress files

source on GitHub

pyensae.filehelper.decompress_helper.decompress_bz2(filename, whereTo='.', fLOG=<function noLOG>)

Decompresses a :epkg:`bz2` file.

Parameters:
  • filename – file to process

  • folder – location of the result

  • fLOG – logging function

Returns:

return the list of decompressed files (only one)

source on GitHub

pyensae.filehelper.decompress_helper.decompress_gz(filename, whereTo='.', fLOG=<function noLOG>)

Decompresses a :epkg:`tar.gz` file.

Parameters:
  • filename – file to process

  • folder – location of the result

  • fLOG – logging function

Returns:

return the list of decompressed files (only one)

source on GitHub

pyensae.filehelper.decompress_helper.decompress_targz(filename, whereTo='.', silent=True, fLOG=<function noLOG>)

Decompresses a :epkg:`tar.gz` file.

Parameters:
  • filename – file to process

  • folder – location of the result

  • silent – raise a warning instead of an error

  • fLOG – logging function

Returns:

return the list of decompressed files

source on GitHub

pyensae.filehelper.decompress_helper.decompress_zip(filename, whereTo='.', fLOG=<function noLOG>)

Unzips a :epkg:`zip` file.

Parameters:
  • filename – file to process

  • whereTo – location of the result

  • fLOG – logging function

Returns:

return the list of decompressed files

source on GitHub

pyensae.filehelper.decompress_helper.extractall_silent(self, path='.', members=None, *, numeric_owner=False, silent=False)

Extracts all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. path’ specifies a different directory to extract to. `members’ is optional and must be a subset of the list returned by getmembers(). If `numeric_owner is True, only the numbers for user/group names are used and not the names.

Same function as TarFile.extractall but raises a warning if something wrong happens if silent is True.

source on GitHub