
    Vh              
           d Z ddlZddlmZ ddlmZmZ ddlmZ dgZ	 ed      Z
 ed	      Z G d
 d      Z eej                        efdeee
gef   dee
   dedefd       Zy)z 
Python polyfills for functools
    N)Iterable)CallableTypeVar   )substitute_in_graphreduce_T_Uc                       e Zd Zy)_INITIAL_MISSINGN)__name__
__module____qualname__     Q/home/dcms/DCMS/lib/python3.12/site-packages/torch/_dynamo/polyfills/functools.pyr   r      s    r   r   functioniterableinitialreturnc                    t        |      }|t        u r	 t        |      }n|}|D ]  } | ||      } |S # t        $ r t	        d      d w xY w)Nz0reduce() of empty iterable with no initial value)iterr   nextStopIteration	TypeError)r   r   r   itvalueelements         r   r   r      ss     
hB ""	HE  )() L  	B	s	   5 A)__doc__	functoolscollections.abcr   typingr   r   
decoratorsr   __all__r	   r
   r   r   r   r   r   <module>r%      s     $ $ , * T]T]	 	
 Y%%& #Bx|$rl 
  'r   