o
    Á¿i  ã                   @   sˆ   d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 G dd„ de
ƒZd	ed
ef defdd„Zdedefdd„ZdS )é    )Úabsolute_import)Úimport_module)ÚTracebackType)ÚAny)ÚCallable)ÚOptionalc                   @   sb   e Zd ZdZdee ddfdd„Zdee fdd„Zd	ee	e
  d
ee
 dee ddfdd„ZdS )Úrequire_modulesz>Context manager to check the availability of required modules.ÚmodulesÚreturnNc              	   C   s>   g | _ |D ]}zt|ƒ W q ty   | j  |¡ Y qw d S ©N)Ú_missing_modulesr   ÚImportErrorÚappend)Úselfr	   Úmodule© r   úT/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/internal/utils/importlib.pyÚ__init__   s   ÿýzrequire_modules.__init__c                 C   s   | j S r   )r   )r   r   r   r   Ú	__enter__   s   zrequire_modules.__enter__Úexc_typeÚ	exc_valueÚ	tracebackc                 C   s   d S r   r   )r   r   r   r   r   r   r   Ú__exit__   s   zrequire_modules.__exit__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚlistÚstrr   r   r   ÚtypeÚBaseExceptionr   r   r   r   r   r   r   
   s    
þýüûr   Úf.r
   c                 C   s4   t | dƒrd| jt| d| jjƒf S t| d| jjƒS )z7Return a human readable version of the function's name.r   z%s.%sr   )Úhasattrr   ÚgetattrÚ	__class__r   )r!   r   r   r   Ú	func_name!   s   
r%   Úinstancec                 C   s   | j j d¡d S )z Return the instance module name.Ú.r   )r$   r   Úsplit)r&   r   r   r   Úmodule_name(   s   r)   N)Ú
__future__r   Ú	importlibr   Útypesr   Útypingr   r   r   Úobjectr   r   r%   r)   r   r   r   r   Ú<module>   s    