
    pi                         d dl Z d dlZd dlmZ d dlmZ dedefdZ	e j                  defd       Ze j                  dee   fd       Zy)	    N)
ModuleType)Optionalnamereturnc                 h    	 t         j                  j                  |       }|duS # t        $ r Y yw xY w)aP  Returns if a top-level module with :attr:`name` exists *without**
    importing it. This is generally safer than try-catch block around a
    `import X`. It avoids third party libraries breaking assumptions of some of
    our tests, e.g., setting multiprocessing start method when imported
    (see librosa/#747, torchvision/#544).
    NF)	importlibutil	find_specImportError)r   specs     [/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/torch/utils/_import_utils.py_check_module_existsr      s8    ~~''-4 s   "% 	11c                      t        d      S )Ndill)r        r   dill_availabler      s    ''r   c                  H    t               sy dd l} | j                  d       | S )Nr   F)use_dill)r   r   extend)r   s    r   import_dillr      s#     	KKKKr   )	functoolsimportlib.utilr   typesr   typingr   strboolr   	lru_cacher   r   r   r   r   <module>r      sk       s t  ( ( ( Xj)  r   