ó
‡ˆ\c           @   s   d  Z  d d l m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e ƒ  Z d d	 „ Z
 d
 „  Z e ƒ  j e ƒ  ƒ d S(   s   
Exceptions
i   (   t   PY3_OR_LATERt   JoblibExceptionc           B   s&   e  Z d  Z d „  Z d „  Z e Z RS(   s=   A simple exception with an error message that you can get to.c         G   s   t  j |  | Œ d  S(   N(   t	   Exceptiont   __init__(   t   selft   args(    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyR      s    c         C   sb   t  |  d ƒ r4 t |  j ƒ d k r4 |  j d } n d } |  j j } d | d d | d d f S(   NR   i    t    s   %s
%s
%s
%siK   t   _(   t   hasattrt   lenR   t	   __class__t   __name__(   R   t   messaget   name(    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyt   __repr__   s
    $(   R   t
   __module__t   __doc__R   R   t   __str__(    (    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyR   
   s   			t   TransportableExceptionc           B   s#   e  Z d  Z d „  Z d d „ Z RS(   s`   An exception containing all the info to wrap an original
        exception and recreate it.
    c         C   s)   t  j |  | | ƒ | |  _ | |  _ d  S(   N(   R   R   R   t   etype(   R   R   R   (    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyR   +   s    	R   c         C   s0   d | |  j  f } t |  j ƒ d } | | ƒ S(   Ns¶   %s
---------------------------------------------------------------------------
Joblib worker traceback:
---------------------------------------------------------------------------
%si    (   R   t   _mk_exceptionR   (   R   t   context_messaget   reportt   exception_type(    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyt   unwrap2   s    (   R   R   R   R   R   (    (    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyR   &   s   	t   WorkerInterruptc           B   s   e  Z d  Z RS(   sa    An exception that is not KeyboardInterrupt to allow subprocesses
        to be interrupted.
    (   R   R   R   (    (    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyR   >   s   c         C   s·   t  |  t ƒ r |  |  j f S| d  k r4 |  j } n  d | } | t k rW t | } nV |  t k rm t | f Sy& t | t |  f i  ƒ } | t | <Wn t k
 r¬ t } n X| | f S(   Ns   Joblib%s(   t
   issubclassR   R   t   Nonet   _exception_mappingR   t   typet	   TypeError(   t	   exceptionR   t	   this_namet   this_exception(    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyR   H   s     


c          C   sµ   t  ƒ  }  t r6 d d  l } t d „  t | ƒ ƒ } n d d  l } t | ƒ } x` | D]X } t | | ƒ } t | t ƒ rU t	 | t
 ƒ rU t | d | ƒ\ } } | |  | <qU qU W|  S(   Niÿÿÿÿc         S   s   |  j  d ƒ S(   Nt   Error(   t   endswith(   t   x(    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyt   <lambda>m   s    R   (   t   dictR    t   builtinst   filtert   dirt
   exceptionst   getattrt
   isinstanceR   R   t   BaseExceptionR   (   t	   namespacet   _builtin_exceptionst   common_exceptionsR   t   objt   this_objR    (    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyt   _mk_common_exceptionsh   s    	N(   R   t   _compatR    R   R   R   R   R&   R   R   R   R3   t   localst   update(    (    (    sE   lib/python2.7/site-packages/sklearn/externals/joblib/my_exceptions.pyt   <module>   s   	 	