
    cU                         d Z ddlmZ ddlmZmZmZmZ ddlmZ	mZ
mZ dZdZdZeZeeegZeeee	iZeeee
iZeZeefee
ffZd	 Zd
 Zd ZdS )a3  Consts and function to handle target format.
ALL_SUPPORTED_FORMATS - list of supported formats
get_decompress_function - returns stream decompress function for a current
    format (specified or autodetected)
get_compress_function - returns compress function for a current format
    (specified or default)
    )absolute_import   )stream_compressstream_decompresscheck_formatUncompressError)r   r   r   framinghadoop_snappyautoc                 n    d}t           D ]\  }} || |          \  }}|s||fc S t          d          )zTries to guess a compression format for the given input file by it's
    header.
    :return: tuple of decompression method and a chunk that was taken from the
        input for format detection.
    N)finchunkzCan't detect archive format)_DECOMPRESS_FORMAT_FUNCSr   )r   r   check_methoddecompress_funcoks        5lib/python3.11/site-packages/snappy/snappy_formats.pyguess_format_by_headerr   <   s`     E)A & &%o LS666	E 	%%%%
7
8
88    c                 b    | t           k    rt          |          \  }}||fS t          |          d fS N)FORMAT_AUTOr   _DECOMPRESS_METHODS)specified_formatr   r   
read_chunks       r   get_decompress_functionr   K   s=    ;& +&<S&A&A#
**/0$66r   c                 V    | t           k    rt          t                   S t          |          S r   )r   _COMPRESS_METHODS_DEFAULT_COMPRESS_FORMAT)r   s    r   get_compress_functionr    R   s'    ;& ; !9::-..r   N)__doc__
__future__r   snappyr   r   r   r   r
   hadoop_stream_compresshadoop_stream_decompresshadoop_check_formatFRAMING_FORMATHADOOP_FORMATr   DEFAULT_FORMATALL_SUPPORTED_FORMATSr   r   r   r   r   r   r     r   r   <module>r,      sH    ' & & & & &G G G G G G G G G G G G) ) ) ) ) ) ) ) ) )  'D  O)  %+  *  $%23 9 9 97 7 7/ / / / /r   