parameters: (filename, extract_dir=None, format=None)
docstring: Unpack an archive.
  
      `filename` is the name of the archive.
  
      `extract_dir` is the name of the target directory, where the archive
      is unpacked. If not provided, the current working directory is used.
  
      `format` is the archive format: one of "zip", "tar", or "gztar". Or any
      other registered format. If not provided, unpack_archive will use the
      filename extension and see if an unpacker was registered for that
      extension.
  
      In case none is found, a ValueError is raised.
docstring_summary: Unpack an archive.
docstring_tokens: Unpack an archive .
function: def unpack_archive(filename, extract_dir=None, format=None):
      """Unpack an archive.
  
      `filename` is the name of the archive.
  
      `extract_dir` is the name of the target directory, where the archive
      is unpacked. If not provided, the current working directory is used.
  
      `format` is the archive format: one of "zip", "tar", or "gztar". Or any
      other registered format. If not provided, unpack_archive will use the
      filename extension and see if an unpacker was registered for that
      extension.
  
      In case none is found, a ValueError is raised.
      """
      if extract_dir is None:
          extract_dir = os.getcwd()
  
      if format is not None:
          try:
              format_info = _UNPACK_FORMATS[format]
          except KeyError:
              raise ValueError("Unknown unpack format '{0}'".format(format))
  
          func = format_info[1]
          func(filename, extract_dir, **dict(format_info[2]))
      else:
          # we need to look at the registered unpackers supported extensions
          format = _find_unpack_format(filename)
          if format is None:
              raise ReadError("Unknown archive format '{0}'".format(filename))
  
          func = _UNPACK_FORMATS[format][1]
          kwargs = dict(_UNPACK_FORMATS[format][2])
          func(filename, extract_dir, **kwargs)
function_tokens: def unpack_archive ( filename , extract_dir = None , format = None ) : if extract_dir is None : extract_dir = os . getcwd ( ) if format is not None : try : format_info = _UNPACK_FORMATS [ format ] except KeyError : raise ValueError ( "Unknown unpack format '{0}'" . format ( format ) ) func = format_info [ 1 ] func ( filename , extract_dir , * * dict ( format_info [ 2 ] ) ) else : # we need to look at the registered unpackers supported extensions format = _find_unpack_format ( filename ) if format is None : raise ReadError ( "Unknown archive format '{0}'" . format ( filename ) ) func = _UNPACK_FORMATS [ format ] [ 1 ] kwargs = dict ( _UNPACK_FORMATS [ format ] [ 2 ] ) func ( filename , extract_dir , * * kwargs )