B
    &[¨_ç  ã               @   sJ   d Z ddlmZ ddlmZ ddlZddlZe e¡Z	e
ƒ Zddd„ZdS )	zO
Stand-alone module to provide information about whether optional deps exist.

é    )Úabsolute_import)Úimport_moduleNTc          
   C   sŽ   | t jkrt j|  S |sdS | tkrŠyt| ƒS  tk
rJ   t | ¡ Y n@ tk
rˆ } z"t | ¡ d | ¡}t 	|¡ W dd}~X Y nX dS )a
  
    Return module or None. Absolute import is required.

    :param (str) name: Dot-separated module path. E.g., 'scipy.stats'.
    :raise: (ImportError) Only when exc_msg is defined.
    :return: (module|None) If import succeeds, the module will be returned.

    Nz"Error importing optional module {})
ÚsysÚmodulesÚ_not_importabler   ÚImportErrorÚaddÚ	ExceptionÚformatÚloggerÚ	exception)ÚnameZshould_loadÚeÚmsg© r   úB/tmp/pip-install-l29rncou/plotly/_plotly_utils/optional_imports.pyÚ
get_module   s    	



r   )T)Ú__doc__Ú
__future__r   Ú	importlibr   Úloggingr   Ú	getLoggerÚ__name__r   Úsetr   r   r   r   r   r   Ú<module>   s   
