
    g               
       @   S SK Jr  S SKJr  S SKJr  S SKrS SKJrJrJr  \	" \\5      (       d  \R                  " \5        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!\!RD                  \
RD                  \RD                  \RD                  \RD                  \RD                  \RD                  4r#CCCgs  sn f s  sn f )    )MappingProxyType)array
frozendictN)MutableMappingMutableSequence
MutableSetc                     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                       \ rS rSrSrg)FreezeError.    N__name__
__module____qualname____firstlineno____static_attributes__r"   r   r   r    r    .       r   r    c                       \ rS rSrSrg)FreezeWarning2   r"   Nr#   r"   r   r   r+   r+   2   r)   r   r+   F)inversec                x   [        [        U 5      [        5      (       d  [        SU  S35      e UR                    U(       a  [        5       nO
[        5       nX;   a(  [        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, foundz! is already in the conversion mapN)
issubclasstype
ValueError__call__AttributeErrorgetFreezeConversionInverseMapgetFreezeConversionMapwarningswarnr$   r+   %_freeze_conversion_inverse_map_custom_freeze_conversion_map_custom)
to_convert	converterr-   freeze_conversion_maps       r   registerr>   6   s     d:&--5j\H
 	

  = ? 6 8*""##DE	

  E =(1*%-  
8D
 	

s   B B9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)r9   r:   KeyErrorr    r$   )r1   r-   r=   s      r   
unregisterrA   c   sG      E =@!' @T]]O+=>??@s    #<c                      [         [        -  $ N)_freeze_conversion_mapr:   r"   r   r   r6   r6   u   s    !$AAAr   c                      [         [        -  $ rC   )_freeze_conversion_inverse_mapr9   r"   r   r   r5   r5      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 rC   )tuple_freeze_typesr:   r9   xs    r   getFreezeTypesrL      sJ    121q12	39:9q9:	; 2:s	   
<

A
c                     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 r1   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   6   #    U H  oR                   v   M     g 7frC   )r$   ).0rK   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   r0   r1   r2   r3   r4   rH   keysrL   r   __dict__hashr   joinr6   _freeze_types_plainr   r5   rR   r   
deepfreezer@   )r   rS   rT   r   type_ir<   type_ofreeze_typesbase_type_ofreeze_typesupported_typeserrr=   freeze_conversion_inverse_mapfrozen_typerR   o_copykvfreezes                       r   rZ   rZ      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 &>G  	 (@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   r7   collections.abcr   r   r	   r0   r>   r   r   	bytearraybytesrH   	frozensetrD   r:   	Exceptionr    UserWarningr+   rA   r6   r   listrF   r9   r5   rI   rL   rY   rZ   r$   __all__rJ   s   0r   <module>rq      s|   "  !  G G
 %))U#	 $JuU		%   !# 	) 		K 	 27 *2Z@$B ",d	4- "  )+ % ''&1Q&'./.1Q./0  "9e4 
 !$(Ph ##!** 	_ (/s   
D%
D