+
    =i-                     X   R t ^ RIHt ^ RIt^ RItRt]tRt^tRt	]P                  P                  t]P                  P                  t ! R R]4      tR tRR	 ltRR
 lt]t ! R R4      t ! R R4      t ! R R4      t ! R R4      t]]3R lt]]R3R lt]3R lt]3R ltR tR tR# )zpython-snappy

Python library for the snappy compression library from Google.
Expected usage like:

    import snappy

    compressed = snappy.compress("some data")
    assert "some data" == snappy.uncompress(compressed)

)absolute_importNi   s   sNaPpYs
     sNaPpYc                       ] tR t^:tRtR# )UncompressError N)__name__
__module____qualname____firstlineno____static_attributes__r       p/Users/tonyclaw/.openclaw/workspace/scripts/youtube-playlists/venv/lib/python3.14/site-packages/snappy/snappy.pyr   r   :   s    r   r   c                     \        V \        4      '       d   V P                  R 4      p Rp \        V 4       V#   \         d   pRp Rp?T# Rp?ii ; i)utf-8TFN)
isinstancestrencode
decompressr   )dataokerrs   &  r   isValidCompressedr   >   sR    ${{7#	B4 I  Is   8 AAAc                 x    \        V \        4      '       d   V P                  V4      p \        \	        V 4      4      # N)r   r   r   bytes	_compress)r   encodings   &&r   compressr   J   s,    ${{8$4!!r   c                     \        V \        4      '       d   \        R 4      h \        \	        V 4      4      pT'       d   TP                  T4      # T#   \
        P                   d   p\        ThRp?ii ; i)z&It's only possible to uncompress bytesN)r   r   r   r   _uncompresscramjamDecompressionErrordecode)r   decodingoutr   s   &&  r   
uncompressr$   P   sh    $FGG'K%& zz(##J	 %% '3&'s   A A3'A..A3c                   P   a  ] tR t^^t o RtR tR	V 3R lR llt]tR tR t	Rt
V tR# )
StreamCompressorai  This class implements the compressor-side of the proposed Snappy framing
format, found at

    http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
        ?spec=svn68&r=71

This class matches the interface found for the zlib module's compression
objects (see zlib.compressobj), but also provides some additions, such as
the snappy framing format's ability to intersperse uncompressed data.

Keep in mind that this compressor object does no buffering for you to
appropriately size chunks. Every call to StreamCompressor.compress results
in a unique call to the underlying snappy compression method.
c                L    \         P                  P                  4       V n        R # r   )r   snappy
Compressorcselfs   &r   __init__StreamCompressor.__init__o   s    **,r   Nc                    < V ^8  d   QhRS[ /#    r   r   )format__classdict__s   "r   __annotate__StreamCompressor.__annotate__r   s      e r   c                X    V P                   P                  V4       V P                  4       # )Add a chunk, returning a string that is framed and compressed. 

Outputs a single snappy chunk; if it is the very start of the stream,
will also contain the stream header chunk.
)r*   r   flush)r,   r   r   s   &&&r   	add_chunkStreamCompressor.add_chunkr   s      	zz|r   c                H    \        V P                  P                  4       4      # r   r   r*   r9   r+   s   &r   r9   StreamCompressor.flush}       TVV\\^$$r   c                    V # zHThis method exists for compatibility with the zlib compressobj.
        r   r+   s   &r   copyStreamCompressor.copy   	     r   )r*   r   )r   r   r   r	   __doc__r-   r:   r   r9   rB   r
   __classdictcell__r4   s   @r   r&   r&   ^   s/     -  H% r   r&   c                   X   a  ] tR t^t o RtR t]R 4       tV 3R lR ltR t	R t
RtV tR	# )
StreamDecompressora  This class implements the decompressor-side of the proposed Snappy
framing format, found at

    http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
        ?spec=svn68&r=71

This class matches a subset of the interface found for the zlib module's
decompression objects (see zlib.decompressobj). Specifically, it currently
implements the decompress method without the max_length option, the flush
method without the length option, and the copy method.
c                Z    \         P                  P                  4       V n        R V n        R # r   )r   r(   Decompressorr*   remainsr+   s   &r   r-   StreamDecompressor.__init__   s    ,,.r   c                ^     V P                  \        \        4      4      \        8H  #     R# ; i)z{Does this stream start with a stream header block?

True indicates that the stream can likely be decoded using this class.
F)readlen_STREAM_HEADER_BLOCK)fins   &r   check_formatStreamDecompressor.check_format   s,    	88C 456:NNN	s   $' ,c                    < V ^8  d   QhRS[ /# r0   r2   )r3   r4   s   "r   r5   StreamDecompressor.__annotate__   s      u r   c                   V P                   '       d   V P                   V,           pRV n         VP                  \        4      '       g   \        V,           p\        V4      p\        \        4      pV^,           V8  d	   Wn         R#  \        P                  W^,           V^,            R4      ^,           pW28X  d   M&WC,           V8  d   WR V n         VRV pM
W4,          pK[  V P                  P                  V4       V P                  4       # ):  Decompress 'data', returning a string containing the uncompressed
data corresponding to at least part of the data in string. This data
should be concatenated to the output produced by any preceding calls to
the decompress() method. Some of the input data may be preserved in
internal buffers for later processing.
Nr   little)	rL   
startswithrQ   rP   int
from_bytesr*   r   r9   )r,   r   ldatabsize	this_sizes   &&   r   r   StreamDecompressor.decompress   s     <<<<<$&DDL344'$.DD	()19uLtAIuqy'A8LqPI~ 5(#F|FU|E$zz|r   c                H    \        V P                  P                  4       4      # r   r=   r+   s   &r   r9   StreamDecompressor.flush   r?   r   c                    V # r   r   r+   s   &r   rB   StreamDecompressor.copy       r   )r*   rL   N)r   r   r   r	   rE   r-   staticmethodrS   r   r9   rB   r
   rF   rG   s   @r   rI   rI      s=     
   @% r   rI   c                   F   a  ] tR t^t o RV 3R lR llt]tR tR tRtV t	R# )HadoopStreamCompressorNc                    < V ^8  d   QhRS[ /# r0   r2   )r3   r4   s   "r   r5   #HadoopStreamCompressor.__annotate__   s     ^ ^e ^r   c                    \        V4      pRP                  \        V4      P                  ^R4      \        V4      P                  ^R4      V34      # )r8   r   big)r   joinrP   to_bytes)r,   r   r   cdatas   &&& r   r:    HadoopStreamCompressor.add_chunk   sF     $xxT++Au5s5z7J7J1e7TV[\]]r   c                    R # r   r   r+   s   &r   r9   HadoopStreamCompressor.flush   s    r   c                    V # rA   r   r+   s   &r   rB   HadoopStreamCompressor.copy   rD   r   r   r   )
r   r   r   r	   r:   r   r9   rB   r
   rF   rG   s   @r   rh   rh      s'     ^ ^ H r   rh   c                   T   a  ] tR t^t o R t]R 4       tV 3R lR ltR tR t	Rt
V tR# )	HadoopStreamDecompressorc                    R V n         R# )r   NrL   r+   s   &r   r-   !HadoopStreamDecompressor.__init__   s	    r   c                    ^ RI Hp V P                  ^ ^4      pV P                  ^ 4       V^8  g   Q h\        P	                  V P                  ^4      R4      pW28  g   Q hV P                  ^4       V! V 4      #     R# ; i)z4Does this look like a hadoop snappy stream?
        )check_unframed_formatrl   F)snappy.snappy_formatsr|   seekr[   r\   rO   )rR   r|   sizechunk_lengths   &   r   rS   %HadoopStreamDecompressor.check_format   st    	C88Aq>DHHQK199>>#((1+u=L&&&HHQK(--	s   A7A: :A?c                    < V ^8  d   QhRS[ /# r0   r2   )r3   r4   s   "r   r5   %HadoopStreamDecompressor.__annotate__   s      u r   c                   V P                   '       d   V P                   V,           pRV n         \        V4      ^8  d	   Wn         R# . p \        P                  VR,          R4      p\        V4      ^V,           8  d   Wn         M2VP	                  \        V^^V,            4      4       V^V,           R pKn  RP                  V4      # )rX   Nr   :      Nrl   )rL   rP   r[   r\   appendr   rm   )r,   r   r#   r   s   &&  r   r   #HadoopStreamDecompressor.decompress   s     <<<<<$&DDLt9q=L>>$s)U;L4y1|++#JJ{4!l*:#;<=L()*Dxx}r   c                    R # rr   r   r+   s   &r   r9   HadoopStreamDecompressor.flush  s    r   c                    V # r   r   r+   s   &r   rB   HadoopStreamDecompressor.copy  re   r   ry   N)r   r   r   r	   r-   rf   rS   r   r9   rB   r
   rF   rG   s   @r   rw   rw      s7         . r   rw   c                    V! 4       p V P                  V4      pV'       g   R# VP                  V4      pV'       g   K7  VP                  V4       KJ  )a
  Takes an incoming file-like object and an outgoing file-like object,
reads data from src, compresses it, and writes it to dst. 'src' should
support the read method, and 'dst' should support the write method.

The default blocksize is good for almost every scenario.
N)rO   r:   write)srcdst	blocksizecompressor_cls
compressorbufs   &&&&  r   stream_compressr     sA      !J
hhy!E""3'3		#r   c                    V! 4       p V'       d   TpRpMV P                  V4      pV'       g   M.VP                  V4      pV'       g   KC  VP                  V4       KV  VP                  4        R# )a  Takes an incoming file-like object and an outgoing file-like object,
reads data from src, decompresses it, and writes it to dst. 'src' should
support the read method, and 'dst' should support the write method.

The default blocksize is good for almost every scenario.
:param decompressor_cls: class that implements `decompress` method like
    StreamDecompressor in the module
:param start_chunk: start block of data that have already been read from
    the input stream (to detect the format, for example)
N)rO   r   r   r9   )r   r   r   decompressor_clsstart_chunkdecompressorr   s   &&&&&  r   stream_decompressr   %  sZ     $%L
CK((9%C%%c*3		#r   c                     \        4       p V P                  V4      pV'       g   M.VP                  V4      pV'       g   K6  VP                  V4       KI  VP	                  4        R# TN)rw   rO   r   r   r9   r   r   r   r*   r   r   s   &&&   r   hadoop_stream_decompressr   A  sJ    
 	!"A
xx	"ll4 3IIcNIIKr   c                     \        4       p V P                  V4      pV'       g   M.VP                  V4      pV'       g   K6  VP                  V4       KI  VP	                  4        R# r   )rh   rO   r   r   r9   r   s   &&&   r   hadoop_stream_compressr   Q  sJ    
 	 A
xx	"jj3IIcNIIKr   c                 Z    V P                  4       pVP                  \        V4      4       R # r   )rO   r   r   r   r   r   s   && r   raw_stream_decompressr   a  s    88:DIIjr   c                 Z    V P                  4       pVP                  \        V4      4       R # r   )rO   r   r   r   s   && r   raw_stream_compressr   f  s    88:DIIhtnr   )r   r   )rE   
__future__r   structr   
_CHUNK_MAX_STREAM_TO_STREAM_BLOCK_SIZE_STREAM_IDENTIFIER_IDENTIFIER_CHUNKrQ   r(   compress_rawr   decompress_rawr   	Exceptionr   r   r   r$   r   r&   rI   rh   rw   r   r   r   r   r   r   r   r   r   <module>r      s   >
 '  
)   0 NN''	nn++	i 		"	 
% %P@ @F ,0 0l ;#3( !='9"&	> +& +  
r   