
    i                     |   S r SSKJrJr  SSKJr  SSKJr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   SS	KJr  SSKJrJr  SSKJrJr  SSKJr  SSKJr  SSK J!r!J"r"  / SQr#\" S5      r$\" S5      r% " S S\5      r&S\4S jr'\"" \&5      S\S\S\&4S j5       r(g
! \ a	    SSKJr   Nvf = f! \ a    S
r N}f = f)z%Preconfigured converters for tomllib.    )	b85decode	b85encode)Set)datedatetime)Enum)
attrgetter)AnyTypeVarUnion)loads)dumpsN   )
is_mappingis_subclass)BaseConverter	Converter)identity)configure_union_passthrough   )validate_datetimewrap)TomllibConverterconfigure_convertermake_converterT_value_c            	       \    \ rS rSrSr\b  SS\S\S\S\4S jjrS	\S
\\	   S\S\	4S jr
Srg)r       z-A converter subclass specialized for tomllib.Nobjunstructure_askwargsreturnc                 4    [        U R                  XS940 UD6$ )N)r!   )r   unstructure)selfr    r!   r"   s       U/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/cattrs/preconf/tomllib.pyr   TomllibConverter.dumps%   s!    ))#)MXQWXX    dataclc                 :    U R                  [        U40 UD6U5      $ N)	structurer   )r&   r*   r+   r"   s       r'   r   TomllibConverter.loads(   s    ~~eD3F3R88r)    r-   )__name__
__module____qualname____firstlineno____doc__r   r
   strtyper   r   __static_attributes__r0   r)   r'   r   r       sW    7	YS 	Y# 	Y 	YPS 	Y9# 947 9c 9a 9r)   r   	converterc                   ^  T R                  [        S 5        T R                  [        S 5        T R                  [        5      SS[
        4U 4S jjj5       nT R                  [        [        5        T R                  [        [        5        T R                  [        [        5        T R                  [        S 5        [        [        [        [        [        [        4   T 5        g)a  
Configure the converter for use with the tomllib library.

* bytes are serialized as base85 strings
* sets are serialized as lists
* tuples are serializas as lists
* mapping keys are coerced into strings when unstructuring
* dates and datetimes are left for tomllib to handle
c                     [        U 5      $ r-   )r   v_s     r'   <lambda>%configure_converter.<locals>.<lambda>6   s    )A,r)   c                 f    U (       a  [        U 5      R                  S5      $ SR                  S5      $ )Nr)   utf8r   decode)r=   s    r'   r?   r@   8   s"    !)A,<<VD<<VDr)   Nr+   c                   > [         n[        U SS 5      nU(       a\  [        US   [         5      (       a!  [        US   [        5      (       a  [        OS nO#[        US   [
        5      (       a  S[
        4S jnTR                  XUS9$ )N__args__r   kc                 6    [        U 5      R                  S5      $ )NrB   rC   )rG   s    r'   key_handlerIconfigure_converter.<locals>.gen_unstructure_mapping.<locals>.key_handlerD   s    $Q<..v66r)   )unstructure_torI   )r6   getattrr   r   _enum_value_getterbytesgen_unstructure_mapping)r+   rK   rI   argsr9   s       r'   rO   4configure_converter.<locals>.gen_unstructure_mapping;   s    r:t,47C((4?Q4N4N0TXT!We,,75 7 00; 1 
 	
r)   c                 \    [        U [        5      (       a  U $ [        R                  " U 5      $ r-   )
isinstancer   fromisoformatr<   s     r'   r?   r@   O   s#    
1d 3 31N9K9KA9NNr)   r-   )register_structure_hookrN   register_unstructure_hook!register_unstructure_hook_factoryr   r
   r   r   r   r   r   r   r6   intfloatbool)r9   rO   s   ` r'   r   r   ,   s     %%e-FG''D 00<
C 
 =
 ''(;%%h0AB''h7%%N  c3t&; <iHr)   rP   r"   r#   c                      [         [        [        [        0UR                  S0 5      EUS'   [	        U 0 UD6n[        U5        U$ )Nunstruct_collection_overrides)r   listtuplegetr   r   )rP   r"   ress      r'   r   r   T   sO     	Tt/ **4b
9/F*+
 D
+F
+CJr)   ))r5   base64r   r   collections.abcr   r   r   enumr   operatorr	   typingr
   r   r   tomllibr   ImportErrortomlitomli_wr   _compatr   r   
convertersr   r   fnsr   
strategiesr    r   r   __all__r   rM   r   r   r   r0   r)   r'   <module>rp      s    + '  #   & & . 1  4 %
GCL	* 	9y 	9%I= %IP 	# 	 	1A 	 	S  
  Es"   B B0 B-,B-0B;:B;