def get_archive_format (filename):
    """Detect filename archive format and optional compression."""
    mime, compression = util.guess_mime(filename)
    if not (mime or compression):
        raise util.PatoolError("unknown archive format for file `%s'" % filename)
    if mime in ArchiveMimetypes:
        format = ArchiveMimetypes[mime]
    else:
        raise util.PatoolError("unknown archive format for file `%s' (mime-type is `%s')" % (filename, mime))
    if format == compression:
        # file cannot be in same format compressed
        compression = None
    return format, compression
def get_archive_format ( filename ) : mime , compression = util . guess_mime ( filename ) if not ( mime or compression ) : raise util . PatoolError ( "unknown archive format for file `%s'" % filename ) if mime in ArchiveMimetypes : format = ArchiveMimetypes [ mime ] else : raise util . PatoolError ( "unknown archive format for file `%s' (mime-type is `%s')" % ( filename , mime ) ) if format == compression : compression = None return format , compression
Detect filename archive format and optional compression.