U
    .d&                     @   sN   d Z G dd deZG dd deZe Zd
ddZdd	 Ze 	e  dS )zK
Exceptions

This module is deprecated and will be removed in joblib 0.16.
c                   @   s$   e Zd ZdZdd Zdd ZeZdS )JoblibExceptionz=A simple exception with an error message that you can get to.c                 G   s   t j| f|  d S N)	Exception__init__)selfargs r   D/tmp/pip-unpacked-wheel-ho8k9mhl/joblib/_deprecated_my_exceptions.pyr      s    zJoblibException.__init__c                 C   s@   t | dr$t| jdkr$| jd }nd}| jj}d|d|df S )Nr        z%s
%s
%s
%sZK___________________________________________________________________________)hasattrlenr   	__class____name__)r   messagenamer   r   r   __repr__   s
    zJoblibException.__repr__N)r   
__module____qualname____doc__r   r   __str__r   r   r   r   r      s   	r   c                   @   s"   e Zd ZdZdd ZdddZdS )	TransportableExceptionz`An exception containing all the info to wrap an original
        exception and recreate it.
    c                 C   s   t | || || _|| _d S r   )r   r   r   etype)r   r   r   r   r   r   r   ,   s    zTransportableException.__init__r
   c                 C   s$   d|| j f }t| jd }||S )Nz%s
---------------------------------------------------------------------------
Joblib worker traceback:
---------------------------------------------------------------------------
%sr	   )r   _mk_exceptionr   )r   Zcontext_messagereportZexception_typer   r   r   unwrap3   s
    zTransportableException.unwrapN)r
   )r   r   r   r   r   r   r   r   r   r   r   '   s   r   Nc                 C   s   t | tr| | jfS |d kr"| j}d| }|tkr<t| }nF| tkrLt|fS zt|t| fi }|t|< W n tk
r   t}Y nX ||fS )NzJoblib%s)
issubclassr   r   _exception_mappingr   type	TypeError)	exceptionr   	this_nameZthis_exceptionr   r   r   r   B   s&    


  
r   c                  C   sd   t  } dd l}tdd t|}|D ]:}t||}t|tr$t|tr$t	||d\}}|| |< q$| S )Nr	   c                 S   s
   |  dS )NError)endswith)xr   r   r   <lambda>f       z'_mk_common_exceptions.<locals>.<lambda>)r   )
dictbuiltinsfilterdirgetattr
isinstancer   r   BaseExceptionr   )	namespaceZ_builtin_exceptionsZcommon_exceptionsr   objZthis_objr    r   r   r   _mk_common_exceptionsb   s    

r/   )N)
r   r   r   r   r&   r   r   r/   localsupdater   r   r   r   <module>   s   

 