ó
î%![c           @   sÔ   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z d „  Z d „  Z d „  Z e j	 d e f d „  ƒ  Yƒ Z
 d e f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d „  Z e
 Z d S(   iÿÿÿÿNc         C   s#   d t  j f d „  ƒ  Y} | |  ƒ S(   Nt   DescriptorProxyc           B   s   e  Z d d  „ Z RS(   c         S   s   |  j  j |  | ƒ S(   N(   t	   __class__t   __get__(   t   selft   instancet   owner(    (    s+   lib/python2.7/site-packages/astroid/util.pyR      s    N(   t   __name__t
   __module__t   NoneR   (    (    (    s+   lib/python2.7/site-packages/astroid/util.pyR       s   (   t   lazy_object_proxyt   Proxy(   t   objR    (    (    s+   lib/python2.7/site-packages/astroid/util.pyt   lazy_descriptor   s    c            s   t  j ‡  f d †  ƒ S(   Nc              s   t  j d ˆ  d ƒ S(   Nt   .t   astroid(   t	   importlibt   import_module(    (   t   module_name(    s+   lib/python2.7/site-packages/astroid/util.pyt   <lambda>   s    (   R	   R
   (   R   (    (   R   s+   lib/python2.7/site-packages/astroid/util.pyt   lazy_import   s    c         C   s'   t  j t |  ƒ |  t j ƒ  d ƒ d S(   sN   Reraises an exception with the traceback from the current exception
    block.i   N(   t   sixt   reraiset   typet   syst   exc_info(   t	   exception(    (    s+   lib/python2.7/site-packages/astroid/util.pyR      s    t   Uninferablec           B   sG   e  Z d  Z d „  Z e Z d „  Z d „  Z d „  Z e Z d „  Z	 RS(   sA   Special inference object, which is returned when inference fails.c         C   s   d S(   NR   (    (   R   (    (    s+   lib/python2.7/site-packages/astroid/util.pyt   __repr__$   s    c         C   si   | d k r t  d ƒ ‚ n  | j d ƒ rI | j d ƒ rI t j |  | ƒ S| d k re t j |  | ƒ S|  S(   Nt   nexts    next method should not be calledt   __t   accept(   t   AttributeErrort
   startswitht   endswitht   objectt   __getattribute__(   R   t   name(    (    s+   lib/python2.7/site-packages/astroid/util.pyR#   (   s    c         O   s   |  S(   N(    (   R   t   argst   kwargs(    (    s+   lib/python2.7/site-packages/astroid/util.pyt   __call__1   s    c         C   s   t  S(   N(   t   False(   R   (    (    s+   lib/python2.7/site-packages/astroid/util.pyt   __bool__4   s    c         C   s   t  | d ƒ } | |  ƒ S(   Nt   visit_uninferable(   t   getattr(   R   t   visitort   func(    (    s+   lib/python2.7/site-packages/astroid/util.pyR   9   s    (
   R   R   t   __doc__R   t   __str__R#   R'   R)   t   __nonzero__R   (    (    (    s+   lib/python2.7/site-packages/astroid/util.pyR   !   s   					t   BadOperationMessagec           B   s   e  Z d  Z RS(   s¿   Object which describes a TypeError occurred somewhere in the inference chain

    This is not an exception, but a container object which holds the types and
    the error which occurred.
    (   R   R   R.   (    (    (    s+   lib/python2.7/site-packages/astroid/util.pyR1   =   s   t   BadUnaryOperationMessagec           B   s8   e  Z d  Z d „  Z e d „  ƒ Z d „  Z d „  Z RS(   s8   Object which describes operational failures on UnaryOps.c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   operandt   opt   error(   R   R3   R4   R5   (    (    s+   lib/python2.7/site-packages/astroid/util.pyt   __init__H   s    		c         C   s   t  d ƒ } | j S(   Nt   helpers(   R   t   object_type(   R   R7   (    (    s+   lib/python2.7/site-packages/astroid/util.pyt   _object_type_helperM   s    c         C   s#   |  j  | ƒ } | t k r d  S| S(   N(   R9   R   R   (   R   R   t   objtype(    (    s+   lib/python2.7/site-packages/astroid/util.pyt   _object_typeR   s    c         C   ss   t  |  j d ƒ r! |  j j } n9 |  j |  j ƒ } t  | d ƒ rN | j } n | j ƒ  } d } | j |  j | ƒ S(   NR$   s!   bad operand type for unary {}: {}(   t   hasattrR3   R$   R;   t	   as_stringt   formatR4   (   R   t   operand_typeR8   t   msg(    (    s+   lib/python2.7/site-packages/astroid/util.pyR/   Z   s    (   R   R   R.   R6   t   propertyR9   R;   R/   (    (    (    s+   lib/python2.7/site-packages/astroid/util.pyR2   E   s
   		t   BadBinaryOperationMessagec           B   s    e  Z d  Z d „  Z d „  Z RS(   s.   Object which describes type errors for BinOps.c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t	   left_typet
   right_typeR4   (   R   RC   R4   RD   (    (    s+   lib/python2.7/site-packages/astroid/util.pyR6   l   s    		c         C   s(   d } | j  |  j |  j j |  j j ƒ S(   Ns1   unsupported operand type(s) for {}: {!r} and {!r}(   R>   R4   RC   R$   RD   (   R   R@   (    (    s+   lib/python2.7/site-packages/astroid/util.pyR/   q   s    (   R   R   R.   R6   R/   (    (    (    s+   lib/python2.7/site-packages/astroid/util.pyRB   i   s   	c         C   sZ   |  j  } | j } | | k p* t | | ƒ } t j d |  j j | j f t d d ƒ| S(   NsF   %r is deprecated and slated for removal in astroid 2.0, use %r insteadt
   stackleveli   (   t   __wrapped__R   t
   issubclasst   warningst   warnR   t   PendingDeprecationWarning(   t   clst   othert   wrappedt	   other_clst   is_instance_of(    (    s+   lib/python2.7/site-packages/astroid/util.pyt   _instancecheckv   s    				
c            s@   t  |  t j f i t j d d 6t d 6ƒ } | ‡  f d †  ƒ S(   s7   Get a Proxy from the given name to the given node type.R   t   __instancecheck__c              s   ˆ  S(   N(    (    (   t	   node_type(    s+   lib/python2.7/site-packages/astroid/util.pyR   †   s    (   R   R	   R
   R"   t   __dict__RP   (   t
   alias_nameRR   t   proxy(    (   RR   s+   lib/python2.7/site-packages/astroid/util.pyt   proxy_alias   s    (   R   RH   R   R	   R   R   R   R   R"   t   __new__R   R1   R2   RB   RP   RV   t   YES(    (    (    s+   lib/python2.7/site-packages/astroid/util.pyt   <module>   s   				$			