
    Ki                     Z   S r SSKrSSKJr  SSKrSSKJr  S rS\0r	S!S jr
S"S jr\
" S\S5         SS	KJr  \
" S
\S
5         SSKJr  S#S jr\
" S\S5         SSKJr  \
" S\S5        \
" S\S5         SSKr\
" S\R(                  SSS9  \
" S\R(                  SSS9   " S S\5      r SSKr\R0                  " S5        \
" S\/ 5         SSKr\
" S\R:                  R<                  S5         \R>                  S:  a  SSK J!r!  OSSK"J!r!  \
" S\!RF                  S5        S  r&g! \ a     Nf = f! \ a    SSKJr  \
" SS S5         Nf = f! \ a     Nf = f! \ a     Nf = f! \\\4 a     Nf = f! \ a     Nf = f! \ a$     SSK$r!S#S jr%\
" S\%S5        O! \ a     Of = f Nf = f)$z9Helper functions for a standard streaming compression API    N)ZipFile)AbstractBufferedFilec                     U $ N )filemodekwargss      T/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/fsspec/compression.py	noop_filer   
   s    K    c                 T   [        U[        5      (       a  U/nU [        ;   a  U(       d  [        SU  35      eU H<  nU[        R
                  R                  ;   d  M#  U(       a  M,  [        SU SU  S35      e   U[        U '   U H   nU [        R
                  R                  U'   M"     g)a	  Register an "inferable" file compression type.

Registers transparent file compression type for use with fsspec.open.
Compression can be specified by name in open, or "infer"-ed for any files
ending with the given extensions.

Args:
    name: (str) The compression type name. Eg. "gzip".
    callback: A callable of form (infile, mode, **kwargs) -> file-like.
        Accepts an input file-like object, the target mode and kwargs.
        Returns a wrapped file-like object.
    extensions: (str, Iterable[str]) A file extension, or list of file
        extensions for which to infer this compression scheme. Eg. "gz".
    force: (bool) Force re-registration of compression type or extensions.

Raises:
    ValueError: If name or extensions already registered, and not force.

z$Duplicate compression registration: z&Duplicate compression file extension: z ()N)
isinstancestrcompr
ValueErrorfsspecutilscompressions)namecallback
extensionsforceexts        r   register_compressionr      s    ( *c"" \
 u}U?vFGG&,,+++EEEcU"TFRSTUU  E$K)-!!#& r   c                   ^ SU;  aC  U=(       d    Sn[        U 4SS0UD6mTR                  USS9nUR                  4U4S jjUl        U$ [        U 5      mUc  TR                  5       S   nTR                  " U4SS0UD6$ )Nrr   r	   w)r	   c                 @   > U " 5       =(       d    TR                  5       $ r   )close)closerzs    r   <lambda>unzip.<locals>.<lambda>=   s    68+@qwwy+@r   r   )r   openr!   namelist)infiler	   filenamer
   for#   s        @r   unzipr+   8   s    
$%vF///VVH3V'!#@	A::<?66(////r   zip)BZ2Filebz2)igzipc                 2    [         R                  " SXS.UD6$ )N)fileobjr	   r   )r/   	IGzipFile)r(   r	   r
   s      r   isalr3   Q   s    CvCFCCr   gzipgzGzipFilec                     [        SSU 0UD6$ )Nr1   r   r6   )fr
   s     r   r$   r$   Y   s    H$AQ$A&$Ar   )LZMAFilelzmaxzT)r   c                   H   ^  \ rS rSrU 4S jrSS jrS	S jrS rS rSr	U =r
$ )

SnappyFilem   c                    > SS K n[        TU ]  " SS SUR                  S5      S-   SS.UD6  Xl        SU;   a  UR
                  " 5       U l        g UR                  " 5       U l        g )Nr   snappybiɚ;)fspathr	   sizer   r   )rA   super__init__stripr(   StreamDecompressorcodecStreamCompressor)selfr(   r	   r
   rA   	__class__s        r   rG   SnappyFile.__init__n   sd     	
(C3)>Y	
RX	
 $;224DJ002DJr   c                     U R                   R                  S5        U R                  R                  U R                   R	                  5       5      nU R
                  R                  U5        g)Nr   T)bufferseekrJ   	add_chunkreadr(   write)rL   finalouts      r   _upload_chunkSnappyFile._upload_chunkz   sJ    jj""4;;#3#3#56#r   c                     [        S5      e)NzSnappyFile is not seekable)NotImplementedError)rL   locwhences      r   rQ   SnappyFile.seek   s    !">??r   c                     g)NFr   )rL   s    r   seekableSnappyFile.seekable   s    r   c                 r    U R                   R                  X!-
  5      nU R                  R                  U5      $ )z*Get the specified set of bytes from remote)r(   rS   rJ   
decompress)rL   startenddatas       r   _fetch_rangeSnappyFile._fetch_range   s-    {{,zz$$T**r   )rJ   r(   F)r   )__name__
__module____qualname____firstlineno__rG   rW   rQ   r_   rf   __static_attributes____classcell__)rM   s   @r   r>   r>   m   s"    
3@+ +r   r>   r   rA   lz4)      )zstdrr   zstc                     SU;   a&  [         R                  " 5       nUR                  U 5      $ [         R                  " SS9nUR	                  U 5      $ )Nr   
   )level)rr   ZstdDecompressorstream_readerZstdCompressorstream_writer)r(   r	   cctxs      r   zstandard_filer|      sI    d{,,.))&11**4))&11r   c                       [        [        5      $ )z.Return a list of the implemented compressions.)listr   r   r   r   available_compressionsr      s    ;r   rh   )rbN)r   )'__doc__syszipfiler   fsspec.utilsr   fsspec.specr   r   r   r   r+   r.   r-   ImportErrorr3   r/   r4   r7   r;   r:   lzmaffir>   rA   compress	NameErrorAttributeError	lz4.framero   framer&   version_infocompressionrr   	backportsZstdFile	zstandardr|   r   r   r   r   <module>r      s   ? 
   , 
y".J
0 UE5 )0 /D t,	62x.	!1!16Fw//TB
+% +>		
OOC :r2
			6	
7"$"6&]  		  A4  		  		V 	Y/ 		  		  	 	2 	V^U; 	s   D$ D0 E 5*E + E% "E4 /1F  $D-,D-0E
	E
EEE"!E"%	E10E14E=<E= F*FF*F$!F*#F$$F*)F*