Ë
    äš¾jÿ  ã            
       ó<  — d dl Z d dlZd dlZd dlmZ d dlmZmZmZm	Z	 ddl
mZ ddlmZ  e	d«      Z G d„ d	e«      Z e	d
«      Zdedef   dedededef   fd„ZdZdZ G d„ de«      Z G d„ de«      Zdefd„ZddddœZdedefd„Zddedeeef   ez  defd„Zy) é    N©Údeepcopy)ÚAnyÚCallableÚProtocolÚTypeVaré   )ÚVARIABLE_RE)ÚConfigValidationErrorÚ_DInc                   ó,   — e Zd ZdZdedeegef   fd„Zy)Ú	DecoratorzLProtocol to mark a function as returning its child with identical signature.ÚnameÚreturnc                  ó   — y ©N© )Úselfr   s     úY/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/confection/util.pyÚ__call__zDecorator.__call__   s   � ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r   r   r   r   r   r   r      s   „ ÙVà@˜SÐ@ X¨t¨f°d¨lÑ%;Ô@r   r   ÚPartialTÚfunc.ÚargsÚkwargsr   c                 óZ   — t        j                  | g|¢­i |¤Ž}| j                  |_        |S )znWrapper around functools.partial that retains docstrings and can include
    other workarounds if needed.
    )Ú	functoolsÚpartialr   )r   r   r    Úpartial_funcs       r   r#   r#      s0   € ô ×$Ñ$ TÐ;¨DÒ;°FÑ;€LØŸ<™<€LÔØÐr   zsCan't write to frozen dictionary. This is likely an internal error. Are you writing to a default function argument?zkCan't write to frozen list. Maybe you're trying to modify a computed property or default function argument?c                   óN   ‡ — e Zd ZdZedœdeddfˆ fd„Zd„ Zdd„Zdd	„Z	d
„ Z
ˆ xZS )ÚSimpleFrozenDictzÝSimplified implementation of a frozen dict, mainly used as default
    function or method argument (for arguments that should default to empty
    dictionary). Will raise an error if the user attempts to add to dict.
    ©Úerrorr(   r   Nc                ó2   •— t        ‰| �  |i |¤Ž || _        y)z£Initialize the frozen dict. Can be initialized with pre-defined
        values.

        error (str): The error message when user tries to assign to dict.
        N)ÚsuperÚ__init__r(   )r   r(   r   r    Ú	__class__s       €r   r+   zSimpleFrozenDict.__init__3   s   ø€ ô 	‰Ñ˜$Ð) &Ò)Øˆ�
r   c                 ó,   — t        | j                  «      ‚r   ©ÚNotImplementedErrorr(   )r   ÚkeyÚvalues      r   Ú__setitem__zSimpleFrozenDict.__setitem__A   ó   € Ü! $§*¡*Ó-Ð-r   c                 ó,   — t        | j                  «      ‚r   r.   )r   r0   Údefaults      r   ÚpopzSimpleFrozenDict.popD   r3   r   c                ó,   — t        | j                  «      ‚r   r.   )r   Úotherr    s      r   ÚupdatezSimpleFrozenDict.updateG   r3   r   c           
      ó†   — | j                  t        | j                  «       D ��ci c]  \  }}||“Œ
 c}}«      «      S c c}}w r   )r,   r   Úitems)r   ÚmemoÚkÚvs       r   Ú__deepcopy__zSimpleFrozenDict.__deepcopy__J   s2   € Ø�~‰~œh¸¿¹»×'F±°°A¨¨1©Ó'FÓGÓHÐHùÓ'Fs   ¤=r   )r   )r   r   r   r   ÚDEFAULT_FROZEN_DICT_ERRORr   r+   r2   r6   r9   r?   Ú__classcell__©r,   s   @r   r&   r&   -   s;   ø„ ñð /òð ðð
 
õò.ó.ó.öIr   r&   c                   óh   ‡ — e Zd ZdZedœdeddfˆ fd„Zd„ Zd„ Zd	„ Z	d
„ Z
d„ Zd„ Zd„ Zd„ Zd„ Zˆ xZS )ÚSimpleFrozenListaj  Wrapper class around a list that lets us raise custom errors if certain
    attributes/methods are accessed. Mostly used for properties that return an
    immutable list (and that we don't want to convert to a tuple to not break
    too much backwards compatibility). If a user accidentally calls
    frozen_list.append(), we can raise a more helpful error.
    r'   r(   r   Nc                ó,   •— || _         t        ‰| �  |Ž  y)zpInitialize the frozen list.

        error (str): The error message when user tries to mutate the list.
        N)r(   r*   r+   )r   r(   r   r,   s      €r   r+   zSimpleFrozenList.__init__V   s   ø€ ð ˆŒ
Ü‰Ñ˜$Òr   c                 ó,   — t        | j                  «      ‚r   r.   ©r   r   r    s      r   ÚappendzSimpleFrozenList.appendb   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   ÚclearzSimpleFrozenList.cleare   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   ÚextendzSimpleFrozenList.extendh   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   ÚinsertzSimpleFrozenList.insertk   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   r6   zSimpleFrozenList.popn   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   ÚremovezSimpleFrozenList.removeq   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   ÚreversezSimpleFrozenList.reverset   r3   r   c                 ó,   — t        | j                  «      ‚r   r.   rG   s      r   ÚsortzSimpleFrozenList.sortw   r3   r   c                 ó2   — | j                  d„ | D «       «      S )Nc              3   ó2   K  — | ]  }t        |«      –— Œ y ­wr   r   )Ú.0r>   s     r   ú	<genexpr>z0SimpleFrozenList.__deepcopy__.<locals>.<genexpr>{   s   è ø€ Ò8¨aœh qŸkÑ8ùs   ‚rB   )r   r<   s     r   r?   zSimpleFrozenList.__deepcopy__z   s   € Ø�~‰~Ñ8°4Ô8Ó8Ð8r   )r   r   r   r   ÚDEFAULT_FROZEN_LIST_ERRORr   r+   rH   rJ   rL   rN   r6   rQ   rS   rU   r?   rA   rB   s   @r   rD   rD   N   sS   ø„ ñð /ò
 ð ð
 ð 
õ	
 ò.ò.ò.ò.ò.ò.ò.ò.ö9r   rD   c                 óÀ   — t        | d«      sy| j                  «       D �cg c]'  }t        |t        «      sŒ|j	                  d«      sŒ&|‘Œ) }}t        |«      ryyc c}w )NÚkeysFú@T)Úhasattrr\   Ú
isinstancer   Ú
startswithÚlen)Úobjr=   Úid_keyss      r   Ú
is_promiserd   ~   sO   € Ü�3˜ÔØØŸ(™(›*ÖQ�Q¬
°1´cÕ(:¸q¿|¹|ÈCÕ?PŠqÐQ€GÐQÜ
ˆ7„|ØØùò Rs    A¶AÁATF)ÚTrueÚFalseÚNoner1   c                 óv   — 	 t        j                  | «      S # t        $ r | t        v rt        |    cY S | cY S w xY w)z×Load a JSON string if possible, otherwise default to original value.

    Also handles Python-style literals ``True``, ``False``, and ``None``
    which are not valid JSON but are commonly used in config files.
    )ÚjsonÚloadsÚ	ExceptionÚ_PYTHON_LITERALS)r1   s    r   Útry_load_jsonrm   Š   s>   € ðÜ�z‰z˜%Ó Ð øÜò ØÔ$Ñ$Ü# EÑ*Ò*ØŠðús   ‚ —8³8·8Údatac                 ó  — t        | t        «      rt        j                  | «      r| S 	 t	        j
                  | «      } t        j                  dd| «      S # t        $ r%}dt        | «      › d|› d�}t        ||¬«      |‚d}~ww xY w)zGDump a config value as JSON and output user-friendly error if it fails.z(Couldn't serialize config value of type z: zž. Make sure all values in your config are JSON-serializable. If you want to include Python objects, use a registered function that returns the object instead.)ÚconfigÚdescNz\$(?!\{)z$$)r_   r   r
   Úsearchri   Údumpsrk   Útyper   ÚreÚsub)r1   rn   ÚeÚerr_msgs       r   Útry_dump_jsonry   ˜   s�   € ô �%œÔ¤+×"4Ñ"4°UÔ";Øˆð	FÜ—
‘
˜5Ó!ˆô �6‰6�+˜t UÓ+Ð+øô ò Fà6´t¸E³{°mÀ2ÀaÀSð I"ð #ð 	ô $¨4°gÔ>ÀAÐEûðFús   ©A Á	BÁ A>Á>B)Ú )r"   ri   ru   Úcopyr   Útypingr   r   r   r   Ú
_constantsr
   Ú_errorsr   r   r   r   r#   r@   rZ   Údictr&   ÚlistrD   Úboolrd   rl   r   rm   ry   r   r   r   ú<module>r‚      sü   ðÛ Û Û 	Ý ß 3Ó 3å #Ý *áˆvƒ€ôA�ô Añ �:Ó€ðØ
�3˜�=Ñ
!ðØ*-ðØ9<ðàˆc�8ˆmÑóð=ð ð-ð ôI�tô IôB-9�tô -9ð`�tó ð !¨5¸$Ñ?Ð ð˜ð  ó ñ,˜ð , D¨¨d¨¡O°cÑ$9ð ,À3ô ,r   