o
    n’×iU  ã                   @   s2   d Z ddlZddlZddlZG dd„ dejƒZdS )zmodule lazyloader.é    Nc                       s<   e Zd ZdZ	d‡ fdd„	Zdd„ Zdd„ Zd	d
„ Z‡  ZS )Ú
LazyLoaderz¯Lazily import a module, mainly to avoid pulling in large dependencies.

    We use this for tensorflow and other optional libraries primarily at the
    top module level.
    Nc                    s&   || _ || _|| _tƒ  t|ƒ¡ d S ©N)Ú_local_nameÚ_parent_module_globalsÚ_warningÚsuperÚ__init__Ústr)ÚselfÚ
local_nameÚparent_module_globalsÚnameÚwarning©Ú	__class__© úV/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/wandb/sdk/lib/lazyloader.pyr      s   zLazyLoader.__init__c                 C   sL   t  | j¡}|| j| j< |tj| j< | jrt| jƒ d| _| j	 
|j	¡ |S )z8Load the module and insert it into the parent's globals.N)Ú	importlibÚimport_moduleÚ__name__r   r   ÚsysÚmodulesr   ÚprintÚ__dict__Úupdate©r
   Úmoduler   r   r   Ú_load   s   
zLazyLoader._loadc                 C   s   |   ¡ }t||ƒS r   )r   Úgetattr)r
   Úitemr   r   r   r   Ú__getattr__7   s   
zLazyLoader.__getattr__c                 C   s   |   ¡ }t|ƒS r   )r   Údirr   r   r   r   Ú__dir__<   s   zLazyLoader.__dir__r   )	r   Ú
__module__Ú__qualname__Ú__doc__r   r   r    r"   Ú__classcell__r   r   r   r   r      s    ûr   )r%   r   r   ÚtypesÚ
ModuleTyper   r   r   r   r   Ú<module>   s
    