ó
    Eñi
  ã            
       óŽ   • S SK Jr  S SKJr  S SKJrJr  S\\\4   S\S\\\4   4S jr	S\S	\S
\\
S-  \\
S-  \/\4   S\4S jrg)é    )ÚCallable)ÚAny)ÚContextÚTreeSpecÚuser_kwargsÚspecÚreturnc                 óæ  • UR                   [        La  [        SUR                    35      eUR                  S:w  a  [        SUR                   35      eUR	                  S5      nUR                   [
        La  [        SUR                    35      e[        U 5      [        UR                  5      :w  a$  [        S[        U 5       SUR                   35      e0 nUR                   H	  nX   X4'   M     U$ )aD  Reorder user-provided kwargs to match the order in `spec`. `spec` is
expected to be the in_spec of an exported program, i.e. the spec that
results from flattening `(args, kwargs)`.

We need this to provide consistent input ordering, such so that users can
pass in foo(a=a, b=b) OR foo(b=b, a=a) and receive the same result.
z(Expected spec type to be tuple, but got é   z*Expected spec to have 2 children, but got é   z.Expected kwargs_spec type to be dict, but got z>Ran into a kwarg keyword mismatch: Got the following keywords z but expected )
ÚtypeÚtupleÚAssertionErrorÚnum_childrenÚchildÚdictÚsetÚcontextÚ
ValueErrorÚlist)r   r   Úkwargs_specÚreordered_kwargsÚkws        ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/export/_tree_utils.pyÚreorder_kwargsr      s  € ð ‡y�yœÒÜÐGÈÏ	É	À{ÐSÓTÐTØ×Ñ˜AÓÜØ8¸×9JÑ9JÐ8KÐLó
ð 	
ð —*‘*˜Q“-€KØ×ÑœtÒ#ÜØ<¸[×=MÑ=MÐ<NÐOó
ð 	
ô ˆ;Óœ3˜{×2Ñ2Ó3Ó3Üð*Ü*.¨{Ó*;Ð)<¸NÈ;×K^ÑK^ÐJ_ðaó
ð 	
ð
 ÐØ×!Ô!ˆØ*™ÐÓñ "ð Ðó    Úspec1Úspec2Úequivalence_fnNc                 ó4  • U" U R                   U R                  UR                   UR                  5      (       d  gU R                  UR                  :w  a  g[        U R	                  5       UR	                  5       5       H  u  p4[        X4U5      (       a  M    g   g)a  Customizable equivalence check for two TreeSpecs.

Arguments:
    spec1: The first TreeSpec to compare
    spec2: The second TreeSpec to compare
    equivalence_fn: A function to determine the equivalence of two
        TreeSpecs by examining their types and contexts. It will be called like:

            equivalence_fn(spec1.type, spec1.context, spec2.type, spec2.context)

        This function will be applied recursively to all children.

Returns:
    True if the two TreeSpecs are equivalent, False otherwise.
FT)r   r   r   ÚzipÚchildrenÚis_equivalent)r   r   r   Úchild_spec1Úchild_spec2s        r   r#   r#   )   sy   € ñ( ˜%Ÿ*™* e§m¡m°U·Z±ZÀÇÁ×OÑOØð ×Ñ˜U×/Ñ/Ó/Øä$'¨¯©Ó(8¸%¿.¹.Ó:JÖ$KÑ ˆÜ˜[°~×FÓFÙñ %Lð r   )Úcollections.abcr   Útypingr   Útorch.utils._pytreer   r   r   Ústrr   r   Úboolr#   © r   r   Ú<module>r,      s}   ðÝ $Ý ç 1ð  S¨# X¡ð °hð À4ÈÈSÈÁ>ô ðDØðàðð ˜d T™k¨7°D¸4±KÀÐIÈ4ÐOÑPðð 
õ	r   