
    Mi              
       F   S SK r S SKrS SKrS SKJr  S SKJrJrJrJ	r	  SSK
Jr  SSKJr  \	" S5      r " S S	\5      r\	" S
5      rS\S\4   S\S\S\S\4   4S jrSrSr " S S\5      r " S S\5      rS\4S jrSSSS.rS\S\4S jrSS\S\\\4   \-  S\4S jjrg)     Ndeepcopy)AnyCallableProtocolTypeVar   )VARIABLE_RE)ConfigValidationError_DInc                   6    \ rS rSrSrS\S\\/\4   4S jrSr	g)	Decorator   zLProtocol to mark a function as returning its child with identical signature.namereturnc                     g N )selfr   s     i/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/confection/util.py__call__Decorator.__call__   s    S    r   N)
__name__
__module____qualname____firstlineno____doc__strr   r   r   __static_attributes__r   r   r   r   r      s    V@S@Xtfdl%;@r   r   PartialTfunc.argskwargsr   c                 \    [         R                  " U /UQ70 UD6nU R                  Ul        U$ )zfWrapper 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                   `   ^  \ rS rSrSr\S.S\SS4U 4S jjjrS rSS	 jr	SS
 jr
S rSrU =r$ )SimpleFrozenDict-   zSimplified 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U ]  " U0 UD6  Xl        g)zInitialize 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   r0   SimpleFrozenDict.__init__3   s     	$)&)
r   c                 ,    [        U R                  5      er   NotImplementedErrorr-   )r   keyvalues      r   __setitem__SimpleFrozenDict.__setitem__A       !$**--r   c                 ,    [        U R                  5      er   r4   )r   r6   defaults      r   popSimpleFrozenDict.popD   r:   r   c                ,    [        U R                  5      er   r4   )r   otherr$   s      r   updateSimpleFrozenDict.updateG   r:   r   c           
          U R                  [        U R                  5        VVs0 s H  u  p#X#_M	     snn5      5      $ s  snnf r   )r1   r   items)r   memokvs       r   __deepcopy__SimpleFrozenDict.__deepcopy__J   s2    ~~h'F'FGHH'Fs   >r   )r   )r   r   r   r   r   DEFAULT_FROZEN_DICT_ERRORr   r0   r8   r=   rA   rH   r    __classcell__r1   s   @r   r*   r*   -   sF     / 
 
 ...I Ir   r*   c                   v   ^  \ rS rSrSr\S.S\SS4U 4S jjjrS rS	 r	S
 r
S rS rS rS rS rS rSrU =r$ )SimpleFrozenListN   aV  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                ,   > Xl         [        TU ]  " U6   g)z`Initialize the frozen list.

error (str): The error message when user tries to mutate the list.
N)r-   r/   r0   )r   r-   r#   r1   s      r   r0   SimpleFrozenList.__init__V   s     
$r   c                 ,    [        U R                  5      er   r4   r   r#   r$   s      r   appendSimpleFrozenList.appendb   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   clearSimpleFrozenList.cleare   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   extendSimpleFrozenList.extendh   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   insertSimpleFrozenList.insertk   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   r=   SimpleFrozenList.popn   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   removeSimpleFrozenList.removeq   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   reverseSimpleFrozenList.reverset   r:   r   c                 ,    [        U R                  5      er   r4   rS   s      r   sortSimpleFrozenList.sortw   r:   r   c                 2    U R                  S U  5       5      $ )Nc              3   8   #    U  H  n[        U5      v   M     g 7fr   r   ).0rG   s     r   	<genexpr>0SimpleFrozenList.__deepcopy__.<locals>.<genexpr>{   s     84ahqkk4s   rL   )r   rE   s     r   rH   SimpleFrozenList.__deepcopy__z   s    ~~84888r   )r   r   r   r   r   DEFAULT_FROZEN_LIST_ERRORr   r0   rT   rW   rZ   r]   r=   rb   re   rh   rH   r    rK   rL   s   @r   rN   rN   N   s]     /
  
  
	
  
 ........9 9r   rN   c                     [        U S5      (       d  gU R                  5        Vs/ s H4  n[        U[        5      (       d  M  UR	                  S5      (       d  M2  UPM6     nn[        U5      (       a  ggs  snf )NkeysF@T)hasattrrr   
isinstancer   
startswithlen)objrF   id_keyss      r   
is_promiserz   ~   sW    3((*Q*Q
1c(:qq||C?Pq*GQ
7|| Rs   A4A4A4TF)TrueFalseNoner7   c                 ~     [         R                  " U 5      $ ! [         a    U [        ;   a  [        U    s $ U s $ f = f)zLoad 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)r7   s    r   try_load_jsonr      s>    zz%   $$#E**s    <<<datac                     [        U [        5      (       a  [        R                  " U 5      (       a  U $  [        R
                  " U 5      n [        R                  " SSU 5      $ ! [         a!  nS[        U 5       SU S3n[        XS9UeSnAff = f)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$$)ru   r   r
   searchr   dumpsr   typer   resub)r7   r   eerr_msgs       r   try_dump_jsonr      s     %+"4"4U";";	F

5! 66+tU++  F6tE{m2aS I" # 	 $4>AEFs   A" "
B,BB) )r&   r   r   copyr   typingr   r   r   r   
_constantsr
   _errorsr   r   r   r!   r'   rJ   rp   dictr*   listrN   boolrz   r   r   r   r   r   r   r   <module>r      s      	  3 3 # *vA A :
3=
!*-9<c8m= - It IB-9t -9`t  !5$?   , ,DdOc$9 ,3 ,r   