
    /j              
           d Z ddlZddlmZmZ ddlmZ ddlmZ dgZ	 ed          Z
 ed	          Z e            Z eej                  efd
eee
gef         dee
         dedefd            ZdS )z 
Python polyfills for functools
    N)CallableIterable)TypeVar   )substitute_in_graphreduce_T_Ufunctioniterableinitialreturnc                    t          |          }|t          u r/	 t          |          }n # t          $ r t	          d          d w xY w|}|D ]} | ||          }|S )Nz0reduce() of empty iterable with no initial value)iter_initial_missingnextStopIteration	TypeError)r   r   r   itvalueelements         f/home/longshao/multi-rider-rag/.venv/lib/python3.11/site-packages/torch/_dynamo/polyfills/functools.pyr   r      s     
hB """	HHEE 	 	 	B 	
  ) )((Ls	   * A)__doc__	functoolscollections.abcr   r   typingr   
decoratorsr   __all__r	   r
   objectr   r        r   <module>r"      s        . . . . . . . .       , , , , , , * WT]]WT]] 688  Y%&& # Bx|$rl 
    '&  r!   