
    h              
           S SK r S SKrS SKJr  S SKJrJrJrJr  \R                  S:  a  S SK
Jr  O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 S\5      rSrSr " S S\5      r " S S\5      rg)    Ndeepcopy)AnyCallableIteratorTypeVar)      )Protocol_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/home/james-whalen/.local/lib/python3.13/site-packages/confection/util.py__call__Decorator.__call__   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   c                   8    \ rS rSrSr\S 5       r\S 5       rSrg)	Generator%   zCustom generator type. Used to annotate function arguments that accept
generators so they can be validated by pydantic (which doesn't support
iterators/iterables otherwise).
c              #   (   #    U R                   v   g 7fr   )validate)clss    r   __get_validators__Generator.__get_validators__+   s     lls   c                 `    [        US5      (       d  [        US5      (       d  [        S5      eU$ )N__iter____next__znot a valid iterator)hasattr	TypeError)r.   vs     r   r-   Generator.validate/   s,    q*%%ga.D.D233r   r   N)	r   r   r   r   r   classmethodr/   r-   r    r   r   r   r*   r*   %   s/    
    r   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
 r
S rSrU =r$ )SimpleFrozenDictA   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   r@   SimpleFrozenDict.__init__G   s     	$)&)
r   c                 ,    [        U R                  5      er   NotImplementedErrorr=   )r   keyvalues      r   __setitem__SimpleFrozenDict.__setitem__U       !$**--r   c                 ,    [        U R                  5      er   rD   )r   rF   defaults      r   popSimpleFrozenDict.popX   rJ   r   c                 ,    [        U R                  5      er   rD   )r   others     r   updateSimpleFrozenDict.update[   rJ   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   )rA   r   items)r   memokr6   s       r   __deepcopy__SimpleFrozenDict.__deepcopy__^   s2    ~~h'F'FGHH'Fs   >r   )r   r   r   r   r   DEFAULT_FROZEN_DICT_ERRORr   r@   rH   rM   rQ   rW   r    __classcell__rA   s   @r   r:   r:   A   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$ )SimpleFrozenListb   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?   r@   )r   r=   r#   rA   s      r   r@   SimpleFrozenList.__init__j   s     
$r   c                 ,    [        U R                  5      er   rD   r   r#   r$   s      r   appendSimpleFrozenList.appendv   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   clearSimpleFrozenList.cleary   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   extendSimpleFrozenList.extend|   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   insertSimpleFrozenList.insert   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   rM   SimpleFrozenList.pop   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   removeSimpleFrozenList.remove   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   reverseSimpleFrozenList.reverse   rJ   r   c                 ,    [        U R                  5      er   rD   rb   s      r   sortSimpleFrozenList.sort   rJ   r   c                 2    U R                  S U  5       5      $ )Nc              3   8   #    U  H  n[        U5      v   M     g 7fr   r   ).0r6   s     r   	<genexpr>0SimpleFrozenList.__deepcopy__.<locals>.<genexpr>   s     84ahqkk4s   r[   )r   rU   s     r   rW   SimpleFrozenList.__deepcopy__   s    ~~84888r   )r   r   r   r   r   DEFAULT_FROZEN_LIST_ERRORr   r@   rc   rf   ri   rl   rM   rq   rt   rw   rW   r    rZ   r[   s   @r   r]   r]   b   s]     /
  
  
	
  
 ........9 9r   r]   )r&   syscopyr   typingr   r   r   r   version_infotyping_extensionsr   r   r   r!   r'   r*   rY   r   dictr:   listr]   r   r   r   <module>r      s     
  3 3f*v  :
3=
!*-9<c8m $= - It IB-9t -9r   