o
    "i                     @   s   d Z ddlZddlmZmZmZ ddlZdd Zdd Zddd	Z	d
d Z
dd Zdd Zdeeegef dee dee fddZdd Zdd ZdS )z'
Python polyfills for common builtins.
    N)AnyCallableSequencec                 C   s   | D ]}|s	 dS qdS NFT iteratorelemr   r   T/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/torch/_dynamo/polyfill.pyall   
   r   c                 C   s   | D ]}|r	 dS qdS )NTFr   r   r   r   r
   any   r   r   c                 C   sD   t t| || D ]\}}||kr|  S q
t| dt|  )Nz is not in )	enumeratelist
ValueErrortype)r   itemstartendir	   r   r   r
   index   s
   r   c                 c   s    t |D ]}| V  qd S N)range)r   countr   r   r   r
   repeat"   s   r   c                 C   s   t jd |  S )Ng     f@)mathpi)xr   r   r
   radians'   s   r   c                 C   s.   t |}| jd u r|| _d S | j| d S r   )torchclonegradadd_)r   new_gradr   r   r
   accumulate_grad+   s   


r$   opleftrightc                 C   s<   t ||D ]\}}||kr| ||  S q| t|t|S )zemulate `(1,2,3) > (1,2)` etc)ziplen)r%   r&   r'   abr   r   r
   list_cmp3   s
   r,   c                 C   s   | D ]	}||v r dS qdS r   r   )set1set2r   r   r   r
   set_isdisjoint;   s
   r/   c                 c   s4    t |}|D ]}| |s|V   nq|E d H  d S r   )iter)	predicateiterabler   r   r   r
   	dropwhileB   s   r3   )r   N)__doc__r   typingr   r   r   r   r   r   r   r   r   r$   boolr,   r/   r3   r   r   r   r
   <module>   s   
*