
    ^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dlm	Z	 dgZ
 ed	      Z e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)CallableIterable)_initial_missing)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)iterr   nextStopIteration	TypeError)r   r   r   itvalueelements         l/var/www/ramen.bs-engineer-server.com/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   r   typingr   
decoratorsr   __all__r
   r   r	        r   <module>r!      s     . &  , * T]T] Y%%& #Bx|$rl 
  'r    