
    F\h1                         S r SSKrSSKr\R                  r " S S\R
                  5      r " S S\R                  5      rg)z7Internal classes used by the gzip, lzma and bz2 modules    Nc                   0    \ rS rSrSrS rS rS rS rSr	g)	
BaseStream	   zMode-checking helper functions.c                 <    U R                   (       a  [        S5      eg )NzI/O operation on closed file)closed
ValueErrorselfs    #/usr/lib/python3.13/_compression.py_check_not_closedBaseStream._check_not_closed   s    ;;;<<     c                 Z    U R                  5       (       d  [        R                  " S5      eg )NzFile not open for reading)readableioUnsupportedOperationr	   s    r   _check_can_readBaseStream._check_can_read   $    }}))*EFF r   c                 Z    U R                  5       (       d  [        R                  " S5      eg )NzFile not open for writing)writabler   r   r	   s    r   _check_can_writeBaseStream._check_can_write   r   r   c                     U R                  5       (       d  [        R                  " S5      eU R                  5       (       d  [        R                  " S5      eg )Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r   r   r   seekabler	   s    r   _check_can_seekBaseStream._check_can_seek   sS    }})) +F G G}})) +E F F r    N)
__name__
__module____qualname____firstlineno____doc__r   r   r   r   __static_attributes__r   r   r   r   r   	   s    )=GGFr   r   c                      ^  \ rS rSrSrS rSS jrU 4S jrS rS r	SS jr
S	 rS
 r\R                  4S jrS rSrU =r$ )DecompressReader!   z5Adapts the decompressor API to a RawIOBase reader APIc                     g)NTr   r	   s    r   r   DecompressReader.readable$   s    r   c                     Xl         SU l        SU l        SU l        X l        X@l        U R                  " S0 U R
                  D6U l        X0l        g )NFr   r   )_fp_eof_pos_size_decomp_factory_decomp_args_decompressor_trailing_error)r
   fpdecomp_factorytrailing_errordecomp_argss        r   __init__DecompressReader.__init__'   sP    		 
  .'!11FD4E4EF  .r   c                 .   > S U l         [        TU ]	  5       $ N)r2   superclose)r
   	__class__s    r   r=   DecompressReader.close;   s    !w}r   c                 6    U R                   R                  5       $ r;   )r,   r   r	   s    r   r   DecompressReader.seekable?   s    xx  ""r   c                    [        U5       o"R                  S5       nU R                  [        U5      5      nXCS [        U5      & S S S 5        S S S 5        [        W5      $ ! , (       d  f       N!= f! , (       d  f       N*= f)NB)
memoryviewcastreadlen)r
   bview	byte_viewdatas        r   readintoDecompressReader.readintoB   sU    ]dIIcNi99S^,D$(js4y! %3] 4y %3N]]s"   A1(A A1 
A.	*A11
A?c                 8   US:  a  U R                  5       $ U(       a  U R                  (       a  gS n U R                  R                  (       a  U R                  R                  =(       d    U R
                  R                  [        5      nU(       d  OU R                  " S0 U R                  D6U l         U R                  R                  X15      nOjU R                  R                  (       a2  U R
                  R                  [        5      nU(       d  [        S5      eOSnU R                  R                  X15      nU(       a  OGM  U(       d  SU l        U R                  U l        gU =R                  [!        U5      -  sl        U$ ! U R                   a     MS  f = f)Nr   r   TzACompressed file ended before the end-of-stream marker was reachedr   )readallr-   r2   eofunused_datar,   rF   BUFFER_SIZEr0   r1   
decompressr3   needs_inputEOFErrorr.   r/   rG   )r
   sizerK   rawblocks       r   rF   DecompressReader.readH   sX   !8<<>!tyy !!%% ..:: 7 HHMM+6 %)%9%9 &)''&)"--88HD
 %%11#xx}}[9H#& (J K K $  #H))44XD1 2 DIDJ		SY	' ++ s   4F FFc                     / nU R                  [        R                  5      =n(       a9  UR                  U5        U R                  [        R                  5      =n(       a  M9  SR	                  U5      $ )Nr   )rF   sysmaxsizeappendjoin)r
   chunksrK   s      r   rO   DecompressReader.readallq   sX     ii,,d,MM$ ii,,d, xxr   c                     U R                   R                  S5        SU l        SU l        U R                  " S0 U R
                  D6U l        g )Nr   Fr   )r,   seekr-   r.   r0   r1   r2   r	   s    r   _rewindDecompressReader._rewind|   s<    a		!11FD4E4EFr   c                    U[         R                  :X  a  OU[         R                  :X  a  U R                  U-   nOU[         R                  :X  ak  U R
                  S:  aK  U R                  [         R                  5      (       a'   U R                  [         R                  5      (       a  M'  U R
                  U-   nO[        SR                  U5      5      eXR                  :  a  U R                  5         OXR                  -  nUS:  aS  U R                  [        [         R                  U5      5      nU(       d   U R                  $ U[        U5      -  nUS:  a  MS  U R                  $ )Nr   zInvalid value for whence: {})r   SEEK_SETSEEK_CURr.   SEEK_ENDr/   rF   DEFAULT_BUFFER_SIZEr   formatrb   minrG   )r
   offsetwhencerK   s       r   ra   DecompressReader.seek   s   R[[ r{{"YY'Fr{{"zzA~ii 6 677 ii 6 677ZZ&(F;BB6JKK IILLNiiF qj99S!7!7@AD yy c$iF	 qj yyr   c                     U R                   $ )z!Return the current file position.)r.   r	   s    r   tellDecompressReader.tell   s    yyr   )r1   r0   r2   r-   r,   r.   r/   r3   )r   )r+   )r   r    r!   r"   r#   r   r8   r=   r   rL   rF   rO   rb   r   re   ra   ro   r$   __classcell__)r>   s   @r   r&   r&   !   sH    ?.(#'R G #%++ < r   r&   )	r#   r   rZ   rh   rR   BufferedIOBaser   	RawIOBaser&   r   r   r   <module>rt      s?    = 	 
$$F"" F0Ar|| Ar   