
    < j_D                       S r SSKJr  / SQrSSKJrJr  SSKr\(       a  SSKJrJ	r	  SSK
JrJrJr   SSKr S+SSS.         S,S	 jjjrSS
.S-S jjr SSKr S+SS
.       S.S jjjrSS
.S-S jjr SSKJr   S+SS
.       S.S jjjrSS
.S-S jjrSS
.S/S jjr\SSSS.         S0S jj5       r\SSSS.         S1S jj5       rSSSS.         S2S jjr\SSSS.         S0S jj5       r\SSSS.         S1S jj5       rSSSS.         S2S  jjr\S/ S!.       S3S" jj5       r\S/ S!.       S4S# jj5       r\S/ S!.       S5S$ jj5       rS/ S!.       S6S% jjrSSSS&.             S7S' jjrSSSS&.           S8S( jjrSSS).       S9S* jjrg! \ a#     S+SSS.         S,S jjjrSS
.S-S jjr GNf = f! \ a      S+SS
.       S.S jjjrSS
.S-S jjr GNf = f! \ a      S+SS
.       S.S jjjrSS
.S-S jjr GNf = f):a   Fallback imagecodecs codecs.

This module provides alternative, pure Python and NumPy implementations of
some functions of the `imagecodecs`_ package. The functions may raise
`NotImplementedError`.

.. _imagecodecs: https://github.com/cgohlke/imagecodecs

    )annotations)bitorder_decodedelta_decodedelta_encodefloat24_decodelzma_decodelzma_encodepackbits_decodepackints_decodepackints_encodezlib_decodezlib_encodezstd_decodezstd_encode)TYPE_CHECKINGoverloadN)AnyLiteral)	ArrayLike	DTypeLikeNDArray)checkoutc                  AAA[        U [        R                  5      (       a  U R                  5       n [        R
                  " U 5      $ )zCompress LZMA.

Parameters:
    data: Data to compress.
    level: Compression level (currently unused).
    check: Integrity check type (currently unused).
    out: Output buffer (currently unused).

)
isinstancenumpyndarraytobyteslzmacompress)datalevelr   r   s       f/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/tifffile/_imagecodecs.pyr	   r	   H   s6    " 5#dEMM**<<>D}}T""    r   c              0    A[         R                  " U 5      $ )zeDecompress LZMA.

Parameters:
    data: Compressed data.
    out: Output buffer (currently unused).

)r   
decompressr!   r   s     r#   r   r   ^        t$$r$   c                  A AAASSK ngRaise ImportError.r   Nr$   r   )r!   r"   r   r   r   s        r#   r	   r	   k   s     %r$   c                  A ASSK ngr+   r-   )r!   r   r   s      r#   r   r   y       #r$   c                  A[        U [        R                  5      (       a  U R                  5       n [        R
                  " Xc  S5      $ U5      $ )zCompress Zlib DEFLATE.

Parameters:
    data: Data to compress.
    level: Compression level (0-9, default 6).
    out: Output buffer (currently unused).

   )r   r   r   r   zlibr    r!   r"   r   s      r#   r   r      s>     dEMM**<<>D}}T1AA5AAr$   c              0    A[         R                  " U 5      $ )zmDecompress Zlib DEFLATE.

Parameters:
    data: Compressed data.
    out: Output buffer (currently unused).

)r2   r'   r(   s     r#   r   r      r)   r$   c                  A AASSK ngr+   r2   )r!   r"   r   r2   s       r#   r   r      s     %r$   c                  A ASSK ngr+   r6   )r!   r   r2   s      r#   r   r      r/   r$   zstdc                  A[        U [        R                  5      (       a  U R                  5       n [        R
                  " XS9$ )zCompress ZSTD.

Parameters:
    data: Data to compress.
    level: Compression level.
    out: Output buffer (currently unused).

)r"   )r   r   r   r   r9   r    r3   s      r#   r   r      s2     dEMM**<<>D}}T//r$   c              0    A[         R                  " U 5      $ )zeDecompress ZSTD.

Parameters:
    data: Compressed data.
    out: Output buffer (currently unused).

)r9   r'   r(   s     r#   r   r      r)   r$   c                  A AASSK Jn  gr,   r   r8   r$   compressionr9   )r!   r"   r   r9   s       r#   r   r      s     %$r$   c                  A ASSK Jn  gr=   r>   )r!   r   r9   s      r#   r   r      s    #$r$   c                  A/ nUR                   nSn  [        XUS-    5      S-   nUS-  nUS:  a  U" XUS-    SU-
  -  5        US-  nOUS:  a  U" XX4-    5        X4-  nMO  ! [         a     Of = f[        U5      $ )a  Decompress PackBits encoded byte string.

Parameters:
    encoded: PackBits encoded byte string.
    out: Output buffer (currently unused).

Returns:
    Decompressed byte string.

Examples:
    >>> packbits_decode(b'\x80\x80')  # NOP
    b''
    >>> packbits_decode(b'\x02123')
    b'123'
    >>> packbits_decode(
    ...     b'\xfe\xaa\x02\x80\x00\x2a\xfd\xaa\x03\x80\x00\x2a\x22\xf7\xaa'
    ... )[:-5]
    b'\xaa\xaa\xaa\x80\x00*\xaa\xaa\xaa\xaa\x80\x00*"\xaa\xaa\xaa\xaa\xaa'

r         i  )extendord	TypeErrorbytes)encodedr   
out_extendins        r#   r
   r
      s    * 	
CJ	AGA&'!+AFA3w7q1u-q9:QS7qu-.   :s   AA# #
A0/A0rB   )axisdistr   c                  g N r!   rM   rN   r   s       r#   r   r          r$   c                  g rP   rQ   rR   s       r#   r   r   )       r$   c              L   AUS:w  a  SU< S3n[        U5      e[        U [        [        45      (       aa  [        R
                  " U [        R                  S9n [        R                  " U SS9n[        R                  " USU S   5      R                  5       $ U R                  nUR                  S:X  a*  U R                  UR                   SUR                   35      n [        R                  " XS9n[        S	5      /U R                   -  nSXq'   [        R                  " USU [#        U5         US9nU R                  R$                  (       d8  UR'                  S
S9nUR                  UR                  R)                  5       5      nUR                  S:X  a  UR                  U5      $ U$ )a|  Encode Delta.

Encode differences between consecutive samples along axis.

Parameters:
    data: Data to encode.
    axis: Axis along which to compute differences (default -1).
    dist: Distance between samples (only dist=1 is supported).
    out: Output buffer (currently unused).

Returns:
    Encoded data.
    Returns bytes for bytes/bytearray input, numpy array otherwise.

rB   zdelta_encode with dist=# requires the 'imagecodecs' packagedtyper   )rM   fuNT)inplace)NotImplementedErrorr   rG   	bytearrayr   
frombufferuint8diffinsertr   rY   kindview	byteorderitemsizeslicendimtupleisnativebyteswapnewbyteorder)r!   rM   rN   r   msgra   rY   keys           r#   r   r   /  sV   . 	qy(4')LM!#&&$	*++EKK8zz$Q'||D!T!W-5577JJEzzSyyEOO,Aenn-=>?::d&D#Dk]TYY6CCI<<aeCj!1=D::}}T}*yy0023zzSyyKr$   c                  g rP   rQ   rR   s       r#   r   r   ^  rS   r$   c                  g rP   rQ   rR   s       r#   r   r   i  rU   r$   c              &   US:w  a  SU< S3n[        U5      eUb  UR                  R                  (       d  Sn[        U [        [
        45      (       aV  [        R                  " U [        R                  S9n [        R                  " U S[        R                  US9R                  5       $ U R                  R                  S:X  a  U R                  R                  (       d  S	U R                  < S3n[        U5      eU R                  U R                  R                   S
U R                  R                    35      n[        R                  " XQUR                  S9nUR                  U R                  5      $ [        R                  " XU R                  US9$ )a}  Decode Delta.

Decode delta-encoded data by computing cumulative sum along axis.

Parameters:
    data: Encoded data.
    axis: Axis along which to compute cumulative sum (default -1).
    dist: Distance between samples (only dist=1 is supported).
    out: Output buffer for results.

Returns:
    Decoded data.
    Returns bytes for bytes/bytearray input, numpy array otherwise.

rB   zdelta_decode with dist=rW   NrX   r   )rM   rY   r   rZ   zdelta_decode with r[   )rM   rY   )r]   flags	writeabler   rG   r^   r   r_   r`   cumsumr   rY   rc   rj   rd   re   rf   )r!   rM   rN   r   rm   rd   s         r#   r   r   o  s@   . qy(4')LM!#&&
syy22$	*++EKK8||q

')	 zz#zz""$TZZN 35 5  &c**yyDJJ0014::3F3F2GHI||D4::>yy$$<<tzzs r$   )r   	_bitorderc                  g rP   rQ   r!   r   ru   s      r#   r   r     s     r$   c                  g rP   rQ   rw   s      r#   r   r     s     r$   c                  g rP   rQ   rw   s      r#   r   r     s     r$   c                 AU(       dF  UR                  S5        UR                  [        R                  " US   [        R                  S95        [	        U [
        [        45      (       a  U R                  US   5      $  U R                  S5      n[        R                  " US   X3S9  U $ ! [         a  nSn[        U5      UeSnAff = f)	a  Reverse bits in each byte of bytes or numpy array.

Decode data where pixels with lower column values are stored in the
lower-order bits of the bytes (TIFF FillOrder is LSB2MSB).

Parameters:
    data:
        Data to be bit-reversed.
        If bytes type, a new bit-reversed bytes is returned.
        NumPy arrays are bit-reversed in-place.
    out:
        Output buffer (currently unused).
    _bitorder:
        Internal caching parameter (not for public use).

Examples:
    >>> bitorder_decode(b'\x01\x64')
    b'\x80&'
    >>> data = numpy.array([1, 666], dtype='uint16')
    >>> _ = bitorder_decode(data)
    >>> data
    array([  128, 16473], dtype=uint16)

s    @ `P0pH(hX8xD$dT4tL,l\<|B"bR2r
J*jZ:zF&fV6vN.n^>~A!aQ1q	I)iY9yE%eU5uM-m]=}C#cS3sK+k[;{G'gW7wO/o_?r   rX   r`   rB   r%   z<bitorder_decode of slices requires the 'imagecodecs' packageN)appendr   r_   r`   r   rG   r^   	translaterd   take
ValueErrorr]   )r!   r   ru   rd   excrm   s         r#   r   r     s    > 	!	
  	)))A,ekkJK$	*++~~il++0yy!

9Q<0 K  0L!#&C/0s   ?)B* *
C4CC)bitorderrunlenr   c              t   AAUS:X  a  [         R                  " U S5      n[         R                  " U5      nUS:  a@  US-  (       a6  UR                  SUSUS-  -
  -   45      nUSS2SU24   R                  S5      nUR	                  U5      $ US;   a  [         R                  " X5      $ SU S	3n[        U5      e)
a  Decompress bytes to array of integers.

This implementation only handles itemsizes 1, 8, 16, 32, and 64 bits.
Install the Imagecodecs package for decoding other integer sizes.

Parameters:
    data:
        Data to decompress.
    dtype:
        Numpy boolean or integer type.
    bitspersample:
        Number of bits per integer.
    bitorder:
        Bit order (currently unused).
    runlen:
        Number of consecutive integers after which to start at next byte.
    out:
        Output buffer (currently unused).

Returns:
    Array of unpacked integers.

Examples:
    >>> packints_decode(b'a', 'B', 1)
    array([0, 1, 1, 0, 0, 0, 0, 1], dtype=uint8)

rB   z|Br      rL   N)r          @   zpackints_decode of z0-bit integers requires the 'imagecodecs' package)r   r_   
unpackbitsreshapeastyper]   )r!   rY   bitspersampler   r   r   
data_arrayrm   s           r#   r   r     s    J 	#%%dD1
%%j1
A:&1*#++R1vz>1J,KLJ#AwwJ/77;J  ''',,
m_ -- 	-  c
""r$   c                  Sn[        U5      e)aU  Tightly pack integers.

Parameters:
    data:
        Array of integers to pack.
    bitspersample:
        Number of bits per integer.
    bitorder:
        Bit order (currently unused).
    runlen:
        Number of consecutive integers after which to start at next byte.
    out:
        Output buffer.

Returns:
    Packed byte string.

z2packints_encode requires the 'imagecodecs' packager]   )r!   r   r   r   r   rm   s         r#   r   r   0  s    6 ?C
c
""r$   )re   r   c                  Sn[        U5      e)zReturn float32 array from float24.

Parameters:
    data: Bytes containing float24 values.
    byteorder: Byte order, either '>' (big-endian) or '<' (little-endian).
    out: Output buffer (currently unused).

Returns:
    Array of float32 values.

z1float24_decode requires the 'imagecodecs' packager   )r!   re   r   rm   s       r#   r   r   O  s    $ >C
c
""r$   rP   )
r"   
int | Noner!   bytes | NDArray[Any]r   r   r   r   returnrG   )r!   rG   r   r   r   rG   )r"   r   r!   r   r   r   r   rG   )rH   rG   r   r   r   rG   )
r!   bytes | bytearrayrM   intrN   r   r   r   r   rG   )
r!   NDArray[Any]rM   r   rN   r   r   r   r   r   )
r!    bytes | bytearray | NDArray[Any]rM   r   rN   r   r   r   r   r   )r!   r^   r   r   ru   	list[Any]r   r^   )r!   rG   r   r   ru   r   r   rG   )r!   r   r   r   ru   r   r   r   )r!   r   r   r   ru   r   r   r   )r!   rG   rY   zDTypeLike | Noner   r   r   
str | Noner   r   r   r   r   r   )r!   r   r   r   r   r   r   r   r   r   r   r   )r!   rG   re   zLiteral['>', '<'] | Noner   r   r   r   ) __doc__
__future__r   __all__typingr   r   r   r   r   numpy.typingr   r   r   r   r	   r   ImportErrorr2   r   r   r?   r9   r   r   r
   r   r   r   r   r   r   rQ   r$   r#   <module>r      s  @ #  + #::9
 !#
 !# #"#
 # # 
#, 37 	%F7
 !B
 B B"B
 B 
B( 37 	%F6 
 !0
 0 0"0
 0 
0( 37 	%D 6: 'T 

 
 	
  
  
 
*,!
$'47BE 
 ,
*, 	,
 , 
, ,^ 

 
 	
  
  
 
*,!
$'47BE 
 -
*- 	-
 - 
- -` 

 
 
	
   
 

 
 
	
   
 

 
 
	
   
 :
*: 
	:
 : &:F  3#
3#3# 3# 3# 3# 
3# 3#v  #
##
 # # 
# #F +/#
# (	#
 
# #M  
 !
 ! "
   
 37  !t   !
  "
  
 37  !t  
 !
  "
  
 37  s5   #G  G. 8"H %G+*G+."HH"H=<H=