
    aj)                    |    d dl mZ d dlmZ  ed           G d d                      ZddZddZddZddZdS )    )annotations)	dataclassT)frozenc                  z    e Zd ZU ded<   ded<   ded<   ded<   ded<   edd            Zedd            ZddZdS )SelectiveBuildOperatorstrnameboolis_root_operatoris_used_for_traininginclude_all_overloadstuple[str, ...] | None_debug_infoop_nameop_infodict[str, object]returnc           
        h d}t          t          |                                          |z
            dk    rWt          d                    d                    t          |                                          |z
                                d|v r'| |d         k    rt          d|  d|d                    |                    dd	          }t          |t                    st          d
t          |                     |                    dd	          }t          |t                    st          dt          |                     |                    dd	          }t          |t                    st          dt          |                     d }d|v rU|d         }t          |t                    st          dt          |                     t          d |D                       }t          | ||||          S )N>   r	   
debug_infor   r   r   r   z!Got unexpected top level keys: {},r	   zop_name mismatch: z != r   Tz,Expected 'is_root_operator' to be bool, got r   z0Expected 'is_used_for_training' to be bool, got r   z1Expected 'include_all_overloads' to be bool, got r   z&Expected 'debug_info' to be list, got c              3  4   K   | ]}t          |          V  d S N)r   ).0xs     f/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/torchgen/selective_build/operator.py	<genexpr>z8SelectiveBuildOperator.from_yaml_dict.<locals>.<genexpr>f   s(      77!s1vv777777    r	   r   r   r   r   )lensetkeys	ExceptionformatjoinAssertionErrorget
isinstancer
   typelisttupler   )r   r   allowed_keysr   r   r   r   di_lists           r   from_yaml_dictz%SelectiveBuildOperator.from_yaml_dict4   sP   
 
 
 s7<<>>""\122Q663::HHS00<?@@    W'&/))$GGGgfoGG   #;;'94@@*D11 	 WtDT?U?UWW    '{{+A4HH.55 	 _4H\C]C]__   !(,CT J J/66 	 aDI^D_D_aa   .2
7""l+Ggt,, $LT']]LL   77w77777J%-!5"7"
 
 
 	
r   c                *    t          | dddd           S )NTr   )r   )r	   s    r   *from_legacy_operator_name_without_overloadzASelectiveBuildOperator.from_legacy_operator_name_without_overloadp   s*     &!!%"&
 
 
 	
r   c                R    | j         | j        | j        d}| j        
| j        |d<   |S )N)r   r   r   r   )r   r   r   r   )selfrets     r   to_dictzSelectiveBuildOperator.to_dict|   s=     $ 5$($=%)%?"
 "

 ' $ 0C
r   N)r   r   r   r   r   r   )r	   r   r   r   )r   r   )__name__
__module____qualname____annotations__staticmethodr-   r/   r3    r   r   r   r      s          III     ('''9
 9
 9
 \9
v 	
 	
 	
 \	
	 	 	 	 	 	r   r   lhsr   rhsr   c                T    | |d S t          t          | pd|pdz                       S )Nr9   )r*   r    r:   r;   s     r   merge_debug_infor>      s5    
 {s{tciRCI2.//000r   c           
     t   t          | j                  t          |j                  k    r:t          dt          | j                   dt          |j                   d          t          | j        | j        p|j        | j        p|j        | j        p|j        t          | j        |j                            S )Nz8Expected both arguments to have the same name, but got 'z' and 'z	' insteadr   )	r   r	   r"   r   r   r   r   r>   r   r=   s     r   combine_operatorsr@      s     38}}CH%%us38}}uu]`adai]j]juuu
 
 	
 "X -E1E !5Q9Q!7T3;T$S_coFF   r   !dict[str, SelectiveBuildOperator]c                    i }t          |                                           t          |                                          z   D ]&\  }}|}||v rt          ||         |          }|||<   '|S r   )r)   itemsr@   )r:   r;   	operatorsr   opnew_ops         r   merge_operator_dictsrG      sx     46ICIIKK((4		+<+<< $ $i&y'92>>F#	'r   r   r   c                <    |                      dd          d         S )N.   )maxsplitr   )split)r   s    r   strip_operator_overload_namerM      s    ==q=))!,,r   N)r:   r   r;   r   r   r   )r:   r   r;   r   r   r   )r:   rA   r;   rA   r   rA   )r   r   r   r   )	
__future__r   dataclassesr   r   r>   r@   rG   rM   r9   r   r   <module>rP      s    " " " " " " ! ! ! ! ! ! $x x x x x x x xv1 1 1 1   .   - - - - - -r   