ó
î%![c           @   sh  d  Z  d d l 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 d d l m Z d d	 l m	 Z	 e j
 j j Z e	 j d
 ƒ Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ e j e f e j _ d S(   s"  
Inference objects are a way to represent composite AST nodes,
which are used only as inference results, so they can't be found in the
original AST tree. For instance, inferring the following frozenset use,
leads to an inferred FrozenSet:

    Call(func=Name('frozenset'), args=Tuple(...))
iÿÿÿÿN(   t   bases(   t
   decorators(   t
   exceptions(   t   MANAGER(   t   node_classes(   t   scoped_nodes(   t   utils   interpreter.objectmodelt	   FrozenSetc           B   s5   e  Z d  Z d „  Z d d „ Z e j d „  ƒ Z RS(   s-   class representing a FrozenSet composite nodec         C   s   d t  S(   Ns   %s.frozenset(   t   BUILTINS(   t   self(    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   pytype#   s    c         c   s	   |  Vd  S(   N(    (   R	   t   context(    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   _infer&   s    c         C   s   t  j t } | j d ƒ d S(   Nt	   frozenseti    (   R   t   astroid_cacheR   t   getattr(   R	   t   builtins(    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   _proxied)   s    N(	   t   __name__t
   __module__t   __doc__R
   t   NoneR   R   t   cachedpropertyR   (    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR       s   	t   Superc           B   s‰   e  Z d  Z e j d „  ƒ Z d „  Z d d „ Z d „  Z	 e
 j d „  ƒ Z d „  Z d „  Z e d „  ƒ Z d d	 „ Z d d
 „ Z RS(   sá  Proxy class over a super call.

    This class offers almost the same behaviour as Python's super,
    which is MRO lookups for retrieving attributes from the parents.

    The *mro_pointer* is the place in the MRO from where we should
    start looking, not counting it. *mro_type* is the object which
    provides the MRO, it can be both a type or an instance.
    *self_class* is the class where the super call is, while
    *scope* is the function where the super call is.
    c           C   s
   t  j ƒ  S(   N(   t   objectmodelt
   SuperModel(    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   <lambda><   s    c         C   s1   | |  _  | |  _ t |  _ | |  _ | |  _ d  S(   N(   t   typet   mro_pointert   Falset   _class_basedt   _self_classt   _scope(   R	   R   t   mro_typet
   self_classt   scope(    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   __init__?   s
    				c         c   s	   |  Vd  S(   N(    (   R	   R   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR   F   s    c         C   s  t  |  j t j ƒ s- t j d d |  ƒ‚ n  t  |  j t j ƒ rW t |  _ |  j } nH t	 |  j d d ƒ } t  | t j t j f ƒ sŸ t j d d |  ƒ‚ n  | j sÀ t j d d |  ƒ‚ n  | j ƒ  } |  j | k ró t j d d |  ƒ‚ n  | j |  j ƒ } | | d S(   sB   Get the MRO which will be used to lookup attributes in this super.sI   The first argument to super must be a subtype of type, not {mro_pointer}.t   super_R   sP   The second argument to super must be an instance or subtype of type, not {type}.s*   Unable to call super on old-style classes.i   N(   t
   isinstanceR   R   t   ClassDefR   t
   SuperErrorR   t   TrueR   R   R   R    t   Instancet   newstylet   mrot   index(   R	   R!   R,   R-   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyt	   super_mroI   s*    		c         C   s   t  j t } | j d ƒ d S(   Nt   superi    (   R   R   R   R   (   R	   R   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR   i   s    c         C   s   d t  S(   Ns   %s.super(   R   (   R	   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR
   n   s    c         C   s   d S(   Ns   Super of(    (   R	   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   display_typeq   s    c         C   s
   |  j  j S(   s    Get the name of the MRO pointer.(   R   t   name(   R	   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR1   t   s    c   	      c   s"  | |  j  k r$ |  j  j | ƒ Vd Sy |  j ƒ  } Wn– t j k
 r} } t j t j d d |  d | d | d | j ƒƒ nP t j	 k
 rÌ } t j t j d d |  d | d | d | j
 d	 | j ƒƒ n Xt } x!| D]} | | j k rõ qÚ n  t } xõ t j | | g | d
 |  ƒD]Ô } t | t j ƒ s>| Vqn  | j d k rat j | | ƒ Vq|  j j d k rŠ| j d k rŠ| Vq|  j s¢| j d k rª| Vqt j | ƒ rÞx3 | j |  | ƒ D] } | VqÌWqt j | | ƒ VqWqÚ W| st j d |  d | d | ƒ ‚ n  d S(   s9   Retrieve the inferred values of the given attribute name.NsH   Lookup for {name} on {target!r} because super call {super!r} is invalid.t   targett	   attributeR   R%   sJ   Lookup for {name} on {target!r} failed because {cls!r} has an invalid MRO.t   mrost   clst   framet   classmethodt   methodt   staticmethod(   t   special_attributest   lookupR.   R   R(   R   t   reraiset   AttributeInferenceErrorR%   t   MroErrorR4   R5   R   t   localsR)   R    t   _infer_stmtsR&   R   t   FunctionDefR   t   BoundMethodR    R   t   _is_propertyt   infer_call_result(	   R	   R1   R   R,   t   exct   foundR5   t   inferredt   value(    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   igetattry   sJ    "&!c         C   s   t  |  j | d | ƒƒ S(   NR   (   t   listRI   (   R	   R1   R   (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR   ®   s    N(   R   R   R   R   t   lazy_descriptorR:   R$   R   R   R.   R   R   R   R
   R0   t   propertyR1   RI   R   (    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR   /   s   		 		5t   ExceptionInstancec           B   s    e  Z d  Z e j d „  ƒ Z RS(   sÐ   Class for instances of exceptions

    It has special treatment for some of the exceptions's attributes,
    which are transformed at runtime into certain concrete objects, such as
    the case of .args.
    c           C   s
   t  j ƒ  S(   N(   R   t   ExceptionInstanceModel(    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR   »   s    (   R   R   R   R   RK   R:   (    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyRM   ²   s   t   DictInstancec           B   s    e  Z d  Z e j d „  ƒ Z RS(   sÊ   Special kind of instances for dictionaries

    This instance knows the underlying object model of the dictionaries, which means
    that methods such as .values or .items can be properly inferred.
    c           C   s
   t  j ƒ  S(   N(   R   t	   DictModel(    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyR   Æ   s    (   R   R   R   R   RK   R:   (    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyRO   ¾   s   t	   DictItemsc           B   s    e  Z e j j Z e j j Z RS(    (   R   R   R   t   NodeNGt   __str__t   __repr__(    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyRQ   Ì   s   t   DictKeysc           B   s    e  Z e j j Z e j j Z RS(    (   R   R   R   RR   RS   RT   (    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyRU   Ñ   s   t
   DictValuesc           B   s    e  Z e j j Z e j j Z RS(    (   R   R   R   RR   RS   RT   (    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyRV   Ö   s   (   R   t   sixt   astroidR    R   R   R   R   R   R   t   movesR   R   R   t   lazy_importR   t   _BaseContainerR   RR   R   R*   RM   RO   t   ProxyRQ   RU   RV   t   Dictt	   __bases__(    (    (    s.   lib/python2.7/site-packages/astroid/objects.pyt   <module>   s$   ƒ