
    9j              
           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y)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|}|D ]  } | ||      } |S # t        $ r t	        d      d w xY w)Nz0reduce() of empty iterable with no initial value)iter_initial_missingnextStopIteration	TypeError)r   r   r   itvalueelements         a/media/conek/DATA/Code/OCR/venv/lib/python3.12/site-packages/torch/_dynamo/polyfills/functools.pyr   r      ss     
hB ""	HE  )() L  	B	s	   5 A)__doc__	functoolscollections.abcr   r   typingr   
decoratorsr   __all__r	   r
   objectr   r        r   <module>r"      s     .  , * T]T] 8  Y%%& #Bx|$rl 
  'r!   