
    cl	                         d dl mZ d dlZd dlZd dlZddlmZ ddlm	Z	 d Z
edk    r?	  e
             dS # e$ r*Z ej        ej        j        de           Y dZ[dS dZ[ww xY wdS )	    )absolute_importN   )snappy_formats)UncompressErrorc            	         t           j        } t          t           j        d          rt           j        j        } t           j        }t          t           j        d          rt           j        j        }t          j        d          }|                    d          }|                    dddd	
           |                    dddd
           |                    ddt          j
        t          j        d                    t          j
                             |                    ddt          j        d          | d           |                    ddt          j        d          |d           |                                }t          |j        t"          j                  r| |_        t          |j        t"          j                  r||_        i }|j        rt          j        |j                  }ng	 t          j        |j        |j                  \  }}n># t0          $ r1}t          j        d                    |                     Y d}~nd}~ww xY w||d<    ||j        |j        fi | dS )ziThis method is what is run when invoking snappy via the commandline.
    Try python -m snappy --help
    bufferz%Compress or decompress snappy archive)descriptionT)requiredz-ccompress
store_trueCompress)destactionhelpz-d
decompress
Decompressz-ttarget_formatzTarget format, default is "{}")r   defaultchoicesr   infile?rb)modezInput file (or stdin))nargstyper   r   outfilewbzOutput file (or stdout)z%Failed to get decompress function: {}Nstart_chunk)sysstdinhasattrr   stdoutargparseArgumentParseradd_mutually_exclusive_groupadd_argumentformatsDEFAULT_FORMATALL_SUPPORTED_FORMATSformatFileType
parse_args
isinstancer   ioTextIOWrapperr   r   get_compress_functionr   get_decompress_functionr   exit)	r    r"   parsergroupargsadditional_argsmethod
read_chunkerrs	            /lib/python3.11/site-packages/snappy/__main__.pycmdline_mainr;      s    IEsy(## !	 ZFsz8$$ #"$;  F ///>>E		     
	     &-,33G4JKK     D)))$     D)))&     D $+r/00 $, 011 O} 
4.t/ABB	J!(!@"" "FJJ  	J 	J 	JH<CCCHHIIIIIIII	J)3&
F4;8888888s   5"H 
I"'II__main__z: )
__future__r   r#   r.   r    r   r'   snappyr   r;   __name__	Exceptionr9   r2   	__class__     r:   <module>rE      s    & & & & & &  				 



 ' ' ' ' ' ' # # # # # #L9 L9 L9^ z ;; ; ; ;S]333SS9:::::::::;; ;s   
5 A$AA$