ó
î%![c           @   sö  d  Z  d d l Z d d l Z d d l Z d d l m Z d d l Z e j d d ƒ Z e j	 Z	 e j
 Z
 e j Z [ d d l m Z d d l Td d l Td d	 l m Z d d
 l m Z d d l m Z m Z m Z m Z d d l m Z m Z d d l m Z d d l m Z m  Z  d d l! m" Z" m# Z# d d l$ m% Z% e% ƒ  Z& [% d e' f d „  ƒ  YZ( e) d „ Z* d „  Z+ e j, j- e j, j. e/ ƒ d ƒ Z0 e0 e j, k r¸e j, j1 e0 ƒ n  x7 e j2 e0 ƒ D]& Z3 e3 j4 d ƒ rÈe5 e3 d  ƒ qÈqÈWd S(   sÑ  Python Abstract Syntax Tree New Generation

The aim of this module is to provide a common base representation of
python source code for projects such as pychecker, pyreverse,
pylint... Well, actually the development of this library is essentially
governed by pylint's needs.

It extends class defined in the python's _ast module with some
additional methods and attributes. Instance attributes are added by a
builder object, which can either generate extended ast (let's call
them astroid ;) by visiting an existent ast tree or by inspecting living
object. Methods are added by monkey patching ast classes.

Main modules are:

* nodes and scoped_nodes for more information about methods and
  attributes added to different node classes

* the manager contains a high level object to get astroid trees from
  source files and living objects. It maintains a cache of previously
  constructed tree for quick access

* builder contains the class responsible to build astroid trees
iÿÿÿÿN(   t
   attrgettert   Contexts   Load Store Deli   (   t   version(   t   *(   t	   inference(   t   raw_building(   t   BaseInstancet   Instancet   BoundMethodt   UnboundMethod(   t   are_exclusivet   unpack_infer(   t   builtin_lookup(   t   parset   extract_node(   t   Uninferablet   YES(   t   AstroidManagert   AsStringRegexpPredicatec           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s/  ClassDef to be used as predicate that may be given to `register_transform`

    First argument is a regular expression that will be searched against the `as_string`
    representation of the node onto which it's applied.

    If specified, the second argument is an `attrgetter` expression that will be
    applied on the node first to get the actual node on which `as_string` should
    be called.

    WARNING: This can be fairly slow, as it has to convert every AST node back
    to Python code; you should consider examining the AST directly instead.
    c         C   s   t  j | ƒ |  _ | |  _ d  S(   N(   t   ret   compilet   regexpt
   expression(   t   selfR   R   (    (    s/   lib/python2.7/site-packages/astroid/__init__.pyt   __init__Z   s    c         C   s=   |  j  d  k	 r' t |  j  ƒ | ƒ } n  |  j j | j ƒ  ƒ S(   N(   R   t   NoneR    R   t   searcht	   as_string(   R   t   node(    (    s/   lib/python2.7/site-packages/astroid/__init__.pyt   __call__^   s    N(   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s/   lib/python2.7/site-packages/astroid/__init__.pyR   M   s   c            s   |  ‡  f d † } | S(   s“  Given an instance specific inference function, return a function to be
    given to MANAGER.register_transform to set this inference function.

    :param bool raise_on_overwrite: Raise an `InferenceOverwriteError`
        if the inference tip will overwrite another. Used for debugging

    Typical usage

    .. sourcecode:: python

       MANAGER.register_transform(Call, inference_tip(infer_named_tuple),
                                  predicate)

    .. Note::

        Using an inference tip will override
        any previously set inference tip for the given
        node. Use a predicate in the transform to prevent
        excess overwrites.
    c            s[   ˆ  rN |  j  d  k	 rN |  j  | k	 rN t d j d | d |  j  d |  ƒ ƒ ‚ n  | |  _  |  S(   Nsb   Inference already set to {existing_inference}. Trying to overwrite with {new_inference} for {node}t   existing_inferencet   new_inferenceR   (   t   _explicit_inferenceR   t   InferenceOverwriteErrort   format(   R   t   infer_function(   t   raise_on_overwrite(    s/   lib/python2.7/site-packages/astroid/__init__.pyt	   transformy   s    			(    (   R&   R'   R(   (    (   R'   s/   lib/python2.7/site-packages/astroid/__init__.pyt   inference_tipd   s    c            s/   ‡  f d †  } |  j  t | ‡ f d †  ƒ d  S(   Nc            sf   ˆ  ƒ  } xV | j  j ƒ  D]E \ } } | |  j  | <x) | D]! } | j | k r9 |  | _ q9 q9 Wq Wd  S(   N(   t   localst   itemst   parent(   R   t   extension_modulet   namet   objst   obj(   t   get_extension_mod(    s/   lib/python2.7/site-packages/astroid/__init__.pyR(   ‰   s    	c            s   |  j  ˆ  k S(   N(   R.   (   t   n(   t   module_name(    s/   lib/python2.7/site-packages/astroid/__init__.pyt   <lambda>‘   s    (   t   register_transformt   Module(   t   managerR3   R1   R(   (    (   R1   R3   s/   lib/python2.7/site-packages/astroid/__init__.pyt   register_module_extenderˆ   s    t   brains   .pyiýÿÿÿ(6   R    t   ost   sysR   t   operatorR    t   enumt   Enumt   _Contextt   Loadt   Storet   Delt   __pkginfo__R   t   __version__t   astroid.exceptionst   astroid.nodest   astroidR   R   t   astroid.basesR   R   R   R	   t   astroid.node_classesR
   R   t   astroid.scoped_nodesR   t   astroid.builderR   R   t   astroid.utilR   R   t   astroid.managerR   t   MANAGERt   objectR   t   FalseR)   R8   t   patht   joint   dirnamet   __file__t   BRAIN_MODULES_DIRt   appendt   listdirt   modulet   endswitht
   __import__(    (    (    s/   lib/python2.7/site-packages/astroid/__init__.pyt   <module>   s@   			

"	$	!