
    biq	                     R    S SK rS SKrS SKJr  S rS\S\4S jrS\4S jr	S r
S	 rg)
    Nwrapsc           	          U [         R                  ;  a  U$ [         R                  R                  U S5      n/ SQn/ SQnX#;   a  gX$;  a  [        SU  SU SX4-    35      eg)	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        [/home/james-whalen/.local/lib/python3.13/site-packages/torchaudio/_internal/module_utils.pyeval_envr      sq    
"**
**..c
"C;E>F
|
5cU!C5 A$~.01 	1     modulesreturnc                  &    [        S U  5       5      $ )a<  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   d   #    U  H&  n[         R                  R                  U5      S Lv   M(     g 7fN)	importlibutil	find_spec).0ms     r   	<genexpr>&is_module_available.<locals>.<genexpr>    s$     H1y~~''*$6s   .0)all)r!   s    r   is_module_availabler.      s     HHHHr    c                     ^ U  Vs/ s H  n[        U5      (       a  M  UPM     nnU(       d  S nU$ [        U5      S:X  a  SUS    3OSU 3mU4S jnU$ s  snf )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                     U $ r%    funcs    r   	decorator"requires_module.<locals>.decorator-   s    Kr       zmodule: r   z	modules: c                 4   >^  [        T 5      U U4S j5       nU$ )Nc                  R   > [        TR                   STR                   ST 35      e)N.z
 requires r   
__module____name__)argskwargsr3   reqs     r   wrapped3requires_module.<locals>.decorator.<locals>.wrapped4   s*    "doo%6ajQTPU#VWWr    r   )r3   r@   r?   s   ` r   r4   r5   3   s"    4[X X Nr    )r.   len)r!   r*   missingr4   r?   s       @r   requires_modulerD   #   sj     "@'Q)<Q)?q'G@	  *-W):%)G9@U	 # As
   AAc                    ^  U 4S jnU$ )zLGenerate decorator to give users message about missing TorchAudio extension.c                 4   >^  [        T 5      U U4S j5       nU$ )Nc                  R   > [        TR                   STR                   ST 35      e)Nr9    r:   )r=   r>   r3   messages     r   r@   5fail_with_message.<locals>.decorator.<locals>.wrappedA   s(    $//!2!DMM?!G9MNNr    r   )r3   r@   rI   s   ` r   r4   $fail_with_message.<locals>.decorator@   s"    	t	O 
	O r    r1   )rI   r4   s   ` r   fail_with_messagerL   =   s     r    c                     U $ )zlOp-op decorator. Used in place of fail_with_message when a functionality that requires extension works fine.r1   r2   s    r   no_oprN   J   s    Kr    )importlib.utilr&   r   	functoolsr   r   strboolr.   rD   rL   rN   r1   r    r   <module>rS      s?     	 &I# I$ Ic 4
r    