
    .i!                     Z   S SK Jr  S SKJr  S SKJr  S SKJrJrJr  S SKJ	r	  \
" \\5      (       d  \R                  " \5        S rS rS r\" \\\\\\\\\	\05      r0 r " S	 S
\5      r " S S\5      rSS.S jrSS jrS r\" \\\\\\05      r0 rS r\ V s/ s H  o PM     sn \ V s/ s H  o PM     sn -   r S r!\\\4r"  SS jr#\#RH                  \RH                  \RH                  \RH                  \RH                  \RH                  \RH                  4r%CCCCCCC	gs  sn f s  sn f )    )MappingProxyType)array
frozendict)MutableMappingMutableSequence
MutableSet)Enumc                     SSK Jn  [        XR                  5      =(       a-    [        U [        5      (       + =(       a    [        U S5      (       + $ )Nr   abcisalpha)collectionsr   
isinstanceIterable
memoryviewhasattror   s     /lib/python3.13/site-packages/frozendict/cool.pyisIterableNotStringr      s<     	1ll# 	"q*%%	"Ay!!    c                     SSK Jn  [        XR                  5      (       d  [	        S5      e[        XR
                  5      (       a  [        R                  $ [        $ )Nr   r   zobject must be an iterable)	r   r   r   r   	TypeErrorMappingdictitems	enumerater   s     r   getItemsr      s?    a&&455![[!!zzr   c                     U $ N xs    r   nilr%   %   s    Hr   c                       \ rS rSrSrg)FreezeError4   r"   N__name__
__module____qualname____firstlineno____static_attributes__r"   r   r   r'   r'   4       r   r'   c                       \ rS rSrSrg)FreezeWarning8   r"   Nr)   r"   r   r   r1   r1   8   r/   r   r1   F)inversec                v   [        [        U 5      [        5      (       d  [        SU  S35      e UR                    U(       a  [        5       nO
[        5       nX;   a'  SSKnUR                  U R                   S3[        5        U(       a  [        nO[        nXU '   g! [         a    [        SU 3S-   5      ef = f)a  
Adds a `converter` for a type `to_convert`. `converter`
must be callable. The new converter will be used by `deepfreeze()`
and has precedence over any previous converter.

If `to_covert` has already a converter, a FreezeWarning is raised.

If `inverse` is True, the conversion is considered from an immutable 
type to a mutable one. This make it possible to convert mutable
objects nested in the registered immutable one.
z'`to_convert` parameter must be a type, z foundz*`converter` parameter must be a callable, foundr   Nz! is already in the conversion map)
issubclasstype
ValueError__call__AttributeErrorgetFreezeConversionInverseMapgetFreezeConversionMapwarningswarnr*   r1   %_freeze_conversion_inverse_map_custom_freeze_conversion_map_custom)
to_convert	converterr3   freeze_conversion_mapr=   s        r   registerrD   <   s     d:&--5j\H
 	

  = ? 6 8*""##DE	

  E =(1*%1  
8D
 	

s   B B8c                 ~    U(       a  [         nO[        n X 	 g! [         a    [        U R                   S35      ef = f)z
Unregister a type from custom conversion. If `inverse` is `True`,
the unregistered conversion is an inverse conversion
(see `register()`).
z is not registeredN)r?   r@   KeyErrorr'   r*   )r7   r3   rC   s      r   
unregisterrG   k   sG      E =@!' @T]]O+=>??@s    #<c                      [         [        -  $ r!   )_freeze_conversion_mapr@   r"   r   r   r<   r<   }   s    !$AAAr   c                      [         [        -  $ r!   )_freeze_conversion_inverse_mapr?   r"   r   r   r;   r;      s    &-	.r   c                      [        [        [         V s/ s H  o PM     sn -   [         V s/ s H  o PM     sn -   5      $ s  sn f s  sn f r!   )tuple_freeze_typesr@   r?   r#   s    r   getFreezeTypesrO      sJ    121q12	39:9q9:	; 2:s	   >
A
Nc                     SSK J n  Uc  U" 5       nUc  U" 5       nUR                  5        HA  u  pE[        [        U5      [        5      (       d  [	        U S3S-   5      e UR
                    MC     UR                  5        HA  u  pE[        [        U5      [        5      (       d  [	        U S	3S
-   5      e UR
                    MC     [        U 5      n[        UR                  5       5      [        5       -   nSnU H  n	[        X	5      (       d  M  U	n  O   Uc   U R                    U" U R                  5      $ [        5       nX-  nU[         ;   a
  X   " U 5      $ [#        U 5      (       d
  X   " U 5      $ [%        5       nUU-  nX;   nU(       a
  X   " U 5      n SSKJn  U" U 5      n[)        U5      " U5       H  u  nn[+        UUUS9UU'   M      X   nU" U5      $ ! [         a    [	        SU S3S-   5      ef = f! [         a    [	        SU S3S-   5      ef = f! [         a     Of = f [        U 5        U $ ! [         a     Of = fSR                  S U 5       5      n
SU S3SU
 3-   n[        U5      e! [,         a    U(       a  Un Ne f = f)a  
Converts the object and all the objects nested in it in its
immutable counterparts.

The conversion map is in getFreezeConversionMap().

You can register a new conversion using `register()` You can also
pass a map of custom converters with `custom_converters` and a map
of custom inverse converters with `custom_inverse_converters`,
without using `register()`.

By default, if the type is not registered and has a `__dict__`
attribute, it's converted to the `frozendict` of that `__dict__`.

This function assumes that hashable == immutable (that is not
always true).

This function uses recursion, with all the limits of recursions in
Python.

Where is a good old tail call when you need it?
r   r   Nz+ in `custom_converters` parameter is not a r7   zconverter for z in `custom_converters` zparameter is not a callablez* in `custom_inverse_converters` parameter zis not a typez in  z6`custom_inverse_converters`parameter is not a callablez, c              3   8   #    U  H  oR                   v   M     g 7fr!   )r*   ).0r$   s     r   	<genexpr>deepfreeze.<locals>.<genexpr>  s     $FAZZs   ztype z& is not hashable or is not equal or a z!subclass of the supported types: )copy)custom_converterscustom_inverse_converters)r   r   r6   r7   r8   r9   r:   rM   keysrO   r   __dict__hashr   joinr<   _freeze_types_plainr   r;   rU   r   
deepfreezerF   )r   rV   rW   r   type_irB   type_ofreeze_typesbase_type_ofreeze_typesupported_typeserrrC   freeze_conversion_inverse_mapfrozen_typerU   o_copykvfreezes                       r   r]   r]      s   8 & &L ($.L!.446$v,--(EF 
	 7 7<<>$v,--(DE  
	 ? !WF*//12^5EELK#a%%%K $
 	*JJ ajj))( 341E))$1!44q!!$1!44$A$C! 	&!	" "
 >K)6q9!WF (1 1(A
q	 )&3 &>K  	 (@A-. 	  	 .HI 	,  		
	G H  		 ))$F$FG F8AB//@AB 	
 nJ  F	sN    G5G9H I6 G69H
H&%H&*H7 7
II6JJ)F)NN)&typesr   r   r   collections.abcr   r   r	   enumr
   r6   rD   r   r   r%   	bytearraybytesrM   	frozensetrI   r@   	Exceptionr'   UserWarningr1   rG   r<   r   listrK   r?   r;   rN   rO   r\   r]   r*   __all__r#   s   0r   <module>ru      s   "  ! G G 
 %))U#	 $JuU	#%   !# 	) 		K 	 27 ,2^@$B ",d	4- "  )+ % ''&1Q&'./.1Q./0  "9e4 
 !$(Rl ##!** 	k (/s   D#-D(