
    Ph[                     ~    d dl Zd dlZd dlZd dlmZ d dlmZ d Zde	de
fdZde	fdZdd	e	d
ee	   de
fdZd Zd Zy)    Nwraps)Optionalc           	          | t         j                  vr|S t         j                  j                  | d      }g d}g d}||v ry||vrt        d|  d| d||z          y)	z-Check if environment varable has True-y value0)1trueTRUEonONyesYES)r   falseFALSEoffOFFnoNOTz'Unexpected environment variable value `=z`. Expected one of F)osenvirongetRuntimeError)vardefaultvaltruesfalsess        lC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torchaudio/_internal/module_utils.pyeval_envr       sw    
"**
**..c
"C;E>F
e|
&5cU!C5 A$v~.01 	1     modulesreturnc                  &    t        d | D              S )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).
    c              3   ^   K   | ]%  }t         j                  j                  |      d u ' y wN)	importlibutil	find_spec).0ms     r   	<genexpr>z&is_module_available.<locals>.<genexpr>"   s%     H1y~~''*$6s   +-)all)r"   s    r   is_module_availabler.      s     HHHHr!   c                      | D cg c]  }t        |      r| }}|sd }|S t        |      dk(  rd|d    nd| fd}|S c c}w )zDecorate function to give error message if invoked without required optional modules.

    This decorator is to give better error message to users rather
    than raising ``NameError:  name 'module' is not defined`` at random places.
    c                     | S r&    funcs    r   	decoratorz"requires_module.<locals>.decorator/   s    Kr!      zmodule: r   z	modules: c                 2     t                fd       }|S )Nc                  R    t        j                   dj                   d       )N.z
 requires r   
__module____name__)argskwargsr3   reqs     r   wrappedz3requires_module.<locals>.decorator.<locals>.wrapped6   s*    "doo%6ajQTPU#VWWr!   r   )r3   r?   r>   s   ` r   r4   z"requires_module.<locals>.decorator5   s"    4[X X Nr!   )r.   len)r"   r+   missingr4   r>   s       @r   requires_modulerB   %   sj     "@'Q)<Q)?q'G@	  *-W):%)G9@U	 # As
   AA	directionversionremovec                       fd}|S )zDecorator to add deprecation message

    Args:
        direction (str): Migration steps to be given to users.
        version (str or int): The version when the object will be removed
        remove (bool): If enabled, append future removal message.
    c                      t                fd       }d}r|ddn dz  }d j                   d| d d	|_        |S )
Nc                      j                    dj                   d }r|ddn dz  }t        j                  |d        | i |S )Nr8   z has been deprecated. z It will be removed from future
 release.    )
stacklevel)r:   r;   warningswarn)r<   r=   messagerC   r3   rE   rD   s      r   r?   z.deprecated.<locals>.decorator.<locals>.wrappedI   sb    )4==/9OPY{[G67?xX_6``jkkMM'a0(((r!   z#This function has been deprecated. zIt will be removed from rI   rJ   zDEPRECATED: z

    .. warning::

       z
       z	
        )r   __doc__)r3   r?   rO   rC   rE   rD   s   `  r   r4   zdeprecated.<locals>.decoratorH   sv    	t	) 
	) 81go(SZ1[[effG*4<<. 9 	y { 	 r!   r1   )rC   rD   rE   r4   s   ``` r   
deprecatedrQ   ?   s    . r!   c                       fd}|S )zLGenerate decorator to give users message about missing TorchAudio extension.c                 2     t                fd       }|S )Nc                  R    t        j                   dj                   d       )Nr8    r9   )r<   r=   r3   rO   s     r   r?   z5fail_with_message.<locals>.decorator.<locals>.wrappedf   s(    $//!2!DMM?!G9MNNr!   r   )r3   r?   rO   s   ` r   r4   z$fail_with_message.<locals>.decoratore   s"    	t	O 
	O r!   r1   )rO   r4   s   ` r   fail_with_messagerV   b   s     r!   c                     | S )zlOp-op decorator. Used in place of fail_with_message when a functionality that requires extension works fine.r1   r2   s    r   no_oprX   o   s    Kr!   )NF)importlib.utilr'   r   rM   	functoolsr   typingr   r    strboolr.   rB   rQ   rV   rX   r1   r!   r   <module>r^      sd     	   &I# I$ Ic 4 #    d  F
r!   