3
tûœ]# ã               @   sì  d Z ddlZddlZddlZddlZddlZddlmZ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 dd
lmZ ddlmZ ejZejƒ Zejdd… dÇkZdd„ ZejdÈdd„ƒZdÉdd„Zeƒ Z dÊdd„Z!dËdd„Z"dÌdd„Z#dd„ e$dgdgdgd gd!gd"gd#gd$gd%gd&d'gd(d)gd*d+d,d-d.gd/gd0gd1ggƒD ƒZ%G d2d3„ d3ƒZ&G d4d5„ d5e&ƒZ'G d6d7„ d7ej(e&ej)ej*d8�Z+G d9d:„ d:ƒZ,G d;d<„ d<ej-e,ej(e&ƒZ.G d=d>„ d>ej-e,ej(e&ƒZ/G d?d@„ d@ej-e,e&ƒZ0G dAdB„ dBej1e&ƒZ2dÍdDdE„Z3dÎdFdG„Z4G dHdI„ dIej(e&ƒZ5G dJdK„ dKe'ƒZ6G dLdM„ dMej1e'ƒZ7G dNdO„ dOej1e'ƒZ8G dPdQ„ dQej1e'ƒZ9G dRdS„ dSe&ƒZ:G dTdU„ dUe&ƒZ;G dVdW„ dWe&ƒZ<G dXdY„ dYej-e'ƒZ=G dZd[„ d[e&ƒZ>G d\d"„ d"e&ƒZ?G d]d^„ d^e&ƒZ@G d_d`„ d`ej-e&ej)ƒZAG dadb„ dbej-e'ƒZBG dcdd„ dde&ƒZCG dedf„ dfej(e&ƒZDG dgdh„ dhej1e'ƒZEG didj„ dje&ej)ƒZFG dkdl„ dle'ƒZGG dmdn„ dnej-e&ƒZHG dodp„ dpej-e&ƒZIG dqdr„ drejJej1e'ƒZKG dsdt„ dte'ƒZLG dudv„ dve&ƒZMG dwdx„ dxejJejNej1e'ƒZOG dydz„ dzeOƒZPG d{d1„ d1e&ƒZQG d|d}„ d}ej-ejRe'ƒZSG d~d„ de&ƒZTG d€d�„ d�ej-e'ƒZUG d‚dƒ„ dƒejJejNe'ƒZVG d„d„ de&ƒZWG d…d†„ d†ej-ejRe'ƒZXG d‡dˆ„ dˆe&ƒZYG d‰dŠ„ dŠe&ƒZZG d‹dŒ„ dŒe+ƒZ[G d�dŽ„ dŽej-e'ƒZ\G d�d�„ d�ej-e'ƒZ]G d‘d’„ d’e'ƒZ^G d“d”„ d”e'ƒZ_G d•d–„ d–e'ƒZ`G d—d˜„ d˜e+ƒZaG d™dš„ dše&ƒZbG d›dœ„ dœej(e&ƒZcG d�dž„ dže&ƒZdG dŸd „ d ejJejNe'ƒZeG d¡d¢„ d¢ejJejNe'ƒZfG d£d¤„ d¤e+ƒZgG d¥d/„ d/e&ƒZhG d¦d§„ d§ejJejNe'ƒZiG d¨d©„ d©ejJejNej1e'ƒZjG dªd«„ d«ejƒZkG d¬d­„ d­e&ƒZlG d®d¯„ d¯elƒZmG d°d±„ d±ej-e&ƒZnG d²d³„ d³e&ƒZoG d´dµ„ dµe&ƒZpG d¶d·„ d·ej1e&ƒZqG d¸d¹„ d¹ej1e&ƒZrese[etegeueFeveaewdƒeAewexƒeAiZye�ržeAeyewdºƒ< d»d¼„ Zzezƒ  d½d¾„ Z{d¿dÀ„ Z|e[e{ege{eFe|eae{eAdÁdÂ„ iZ}dÃdÄ„ Z~dÅdÆ„ ZdS )Ïz<Module for some node classes. More nodes in scoped_nodes.py
é    N)Ú	lru_cacheÚsingledispatch)Ú	as_string)Úbases)Úcontext)Ú
decorators)Ú
exceptions)Úmanager)Úmixins)Úutilé   é   é   c             C   s   t | ttƒƒS )N)Ú
isinstanceÚtupleÚ	CONST_CLS)Úvalue© r   ú7/tmp/pip-build-fn42xldr/astroid/astroid/node_classes.pyÚ	_is_const4   s    r   c             c   s¶   t | ttfƒrLx0| jD ]&}|tjkr,|V  qt||ƒE dH  qW t| |d�S t| j	|ƒƒ}|| krt|V  t| |d�S x4| j	|ƒD ]&}|tjkr–|V  q€t||ƒE dH  q€W t| |d�S )zˆrecursively generate nodes inferred by the given statement.
    If the inferred value is a list or a tuple, recurse on the elements
    N)Únoder   )
r   ÚListÚTupleÚeltsr   ÚUninferableÚunpack_inferÚdictÚnextÚinfer)Ústmtr   ÚeltÚinferredr   r   r   r   8   s     

r   c             C   sl  i }i }| j }| }x"|r4d||< |||< |}|j }qW |j }|}�x$|�rf||k�rZt|tƒrŒ|dkrŒ|j|ƒd |j|| ƒd k	rŠdS nÊt|tƒ�rV|j|ƒ\}}|j|| ƒ\}	}
|
|k	�r6|dkoÚ|	dkoÚ|j|ƒ}|dkoø|	dkoø|| j|ƒ}|dk�o
|	dk}|dk�o|	dk}t||||fƒ�rVdS n |dk�rV|	dk�rV||| k	S dS |}|j }qDW dS )aß  return true if the two given statements are mutually exclusive

    `exceptions` may be a list of exception names. If specified, discard If
    branches and check one of the statement is in an exception handler catching
    one of the given exceptions.

    algorithm :
     1) index stmt1's parents
     2) climb among stmt2's parents until we find a common parent
     3) if the common parent is a If or TryExcept statement, look if nodes are
        in exclusive branches
    é   NTÚhandlersÚbodyÚorelseF)Úparentr   ÚIfÚlocate_childÚ	TryExceptÚcatchÚany)Zstmt1Zstmt2r   Zstmt1_parentsÚchildrenr   ÚpreviousZc2attrZc2nodeZc1attrZc1nodeZ first_in_body_caught_by_handlersZ!second_in_body_caught_by_handlersZfirst_in_else_other_in_handlersZ second_in_else_other_in_handlersr   r   r   Úare_exclusiveS   sR    






r.   c             C   s†   t | tƒr&t | jttdƒfƒr‚| jS n\| dkr2dS yt| j|d�ƒ}W n tjk
r\   Y n&X t |tƒr‚t |jttdƒfƒr‚|jS t	S )z'Get the value of the given slice index.N)r   )
r   ÚConstr   ÚintÚtyper   r   r   ÚInferenceErrorÚ_SLICE_SENTINEL)Úindexr   r!   r   r   r   Ú_slice_value£   s    

r5   c             C   s`   t | j|ƒ}t | j|ƒ}t | j|ƒ}tdd„ |||fD ƒƒrHt|||ƒS tjd| | j|d�‚d S )Nc             s   s   | ]}|t k	V  qd S )N)r3   )Ú.0Úelemr   r   r   ú	<genexpr>Â   s    z_infer_slice.<locals>.<genexpr>z'Could not infer slice used in subscript)Úmessager   r4   r   )	r5   ÚlowerÚupperÚstepÚallÚslicer   ÚAstroidTypeErrorr&   )r   r   r:   r;   r<   r   r   r   Ú_infer_slice¾   s    r@   c             C   sÊ   yLt |tƒr6t||d�}| jƒ }|| |_| j|_|S t |tƒrJ||j S W nj tk
r‚ } zt	j
d| ||d�|‚W Y dd}~X n6 tk
r¶ } zt	jd| ||d�|‚W Y dd}~X nX t	jd| ƒ‚dS )zHGet a slice or an item, using the given *index*, for the given sequence.)r   zIndex {index!s} out of range)r9   r   r4   r   NzType error {error!r}z#Could not use %s as subscript index)r   ÚSlicer@   Ú	__class__r   r&   r/   r   Ú
IndexErrorr   ÚAstroidIndexErrorÚ	TypeErrorr?   )Úinstancer   r4   r   Zindex_sliceZnew_clsÚexcr   r   r   Ú_container_getitemÍ   s*    


rH   c             C   s    i | ]\}}|D ]
}||“qqS r   r   )r6   Ú
precedenceÚopsÚopr   r   r   ú
<dictcomp>ç   s   rL   ÚLambdaÚIfExpÚorÚandÚnotÚCompareú|ú^ú&z<<z>>ú+ú-Ú*ú@ú/z//ú%ÚUnaryOpz**ÚAwaitc               @   s�  e Zd ZdZdZdZdZdZdZdZ	dZ
f Zf Zf ZdZdUdd„ZdVdd„Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Ze j!d&d'„ ƒZ"e j!d(d)„ ƒZ#d*d+„ Z$d,d-„ Z%d.d/„ Z&dWd0d1„Z'e j(d2d3„ ƒZ)d4d5„ Z*d6d7„ Z+d8d9„ Z,d:d;„ Z-dXd<d=„Z.d>d?„ Z/d@dA„ Z0dBdC„ Z1dDdE„ Z2dFdG„ Z3dHdI„ Z4dYdMdN„Z5dOdP„ Z6dQdR„ Z7dSdT„ Z8dS )ZÚNodeNGzm A node of the new Abstract Syntax Tree (AST).

    This is the base class for all Astroid node classes.
    FNc             C   s   || _ || _|| _dS )aa  
        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)ÚlinenoÚ
col_offsetr&   )Úselfr_   r`   r&   r   r   r   Ú__init__>  s    zNodeNG.__init__c             K   s¨   |dk	r|j j| |ƒ}| jdk	rHy| j| |f|ŽS  tjk
rF   Y nX |sZ| j|f|ŽS | |j|j|jf}||j	kr„t
|j	| ƒS |j|| j|f|Žƒ}tj|tjƒS )aV  Get a generator of the inferred values.

        This is the main entry point to the inference system.

        .. seealso:: :ref:`inference`

        If the instance has some explicit inference function set, it will be
        called instead of the default interface.

        :returns: The inferred values.
        :rtype: iterable
        N)Zextra_contextÚgetÚ_explicit_inferencer   ZUseInferenceDefaultÚ_inferZ
lookupnameZcallcontextZ	boundnoder!   ÚiterZcache_generatorr   Zlimit_inferenceÚMANAGERZmax_inferable_values)ra   r   ÚkwargsÚkeyÚgenr   r   r   r   N  s    

zNodeNG.inferc                s6   ddh}t ‡ fdd„|D ƒƒr2tˆ dtˆ ddƒƒS dS )z¯Get a name for nice representation.

        This is either :attr:`name`, :attr:`attrname`, or the empty string.

        :returns: The nice name.
        :rtype: str
        ÚnameÚattrnamec             3   s   | ]}|ˆ j kV  qd S )N)Ú_astroid_fields)r6   rk   )ra   r   r   r8   x  s    z$NodeNG._repr_name.<locals>.<genexpr>Ú )r=   Úgetattr)ra   Únamesr   )ra   r   Ú
_repr_nameo  s    zNodeNG._repr_namec             C   sò   | j ƒ }t| ƒj}|r0d}t|ƒt|ƒ d }nd}t|ƒd }g }xŽ| j| j D ]~}t| |ƒ}dt|ƒ | }tj|d|d�j	dƒ}	|	d g}
x&|	dd … D ]}|
j
d	| | ƒ qžW |j
d
|dj|
ƒf ƒ qRW |||dd	|  j|ƒdœ S )Nz%(cname)s.%(rname)s(%(fields)s)r   z%(cname)s(%(fields)s)r"   éP   )ÚindentÚwidthTr   ú z%s=%srn   z,
)ÚcnameÚrnameÚfields)rq   r1   Ú__name__ÚlenÚ_other_fieldsrm   ro   ÚpprintÚpformatÚ
splitlinesÚappendÚjoin)ra   rw   rv   ÚstringÚ	alignmentÚresultÚfieldr   rt   ÚlinesÚinnerÚliner   r   r   Ú__str__|  s(    


zNodeNG.__str__c             C   s4   | j ƒ }|rd}nd}|t| ƒj|| jt| ƒdœ S )Nz.<%(cname)s.%(rname)s l.%(lineno)s at 0x%(id)x>z$<%(cname)s l.%(lineno)s at 0x%(id)x>)rv   rw   r_   Úid)rq   r1   ry   Ú
fromlinenor‰   )ra   rw   r�   r   r   r   Ú__repr__–  s    zNodeNG.__repr__c             C   s   t |d| jjjƒ  ƒ}|| ƒS )z(Visit this node using the given visitor.Úvisit_)ro   rB   ry   r:   )ra   ÚvisitorÚfuncr   r   r   Úaccept£  s    zNodeNG.acceptc             c   sH   xB| j D ]8}t| |ƒ}|dkr qt|ttfƒr:|E dH  q|V  qW dS )zoGet the child nodes below this node.

        :returns: The children.
        :rtype: iterable(NodeNG)
        N)rm   ro   r   Úlistr   )ra   r„   Úattrr   r   r   Úget_children¨  s    
zNodeNG.get_childrenc             C   sF   x@| j ddd… D ],}t| |ƒ}|s&qt|ttfƒr<|d S |S W dS )z™An optimized version of list(get_children())[-1]

        :returns: The last child, or None if no children exist.
        :rtype: NodeNG or None
        Nr"   éÿÿÿÿr“   )rm   ro   r   r�   r   )ra   r„   r‘   r   r   r   Ú
last_child·  s    
zNodeNG.last_childc             C   s*   |j }x|dk	r$| |krdS |j }qW dS )a  Check if this node is the parent of the given node.

        :param node: The node to check if it is the child.
        :type node: NodeNG

        :returns: True if this node is the parent of the given node,
            False otherwise.
        :rtype: bool
        NTF)r&   )ra   r   r&   r   r   r   Ú	parent_ofÇ  s    


zNodeNG.parent_ofc             C   s   | j r
| S | jjƒ S )z�The first parent node, including self, marked as statement node.

        :returns: The first parent statement.
        :rtype: NodeNG
        )Úis_statementr&   Ú	statement)ra   r   r   r   r—   Ø  s    zNodeNG.statementc             C   s
   | j jƒ S )zçThe first parent frame node.

        A frame node is a :class:`Module`, :class:`FunctionDef`,
        or :class:`ClassDef`.

        :returns: The first parent frame node.
        :rtype: Module or FunctionDef or ClassDef
        )r&   Úframe)ra   r   r   r   r˜   â  s    	zNodeNG.framec             C   s
   | j jƒ S )z«The first parent node defining a new scope.

        :returns: The first parent scope node.
        :rtype: Module or FunctionDef or ClassDef or Lambda or GenExpr
        )r&   Úscope)ra   r   r   r   r™   í  s    zNodeNG.scopec             C   s   | j r| j jƒ S | S )zjReturn the root node of the syntax tree.

        :returns: The root node.
        :rtype: Module
        )r&   Úroot)ra   r   r   r   rš   õ  s    
zNodeNG.rootc             C   sd   x@| j D ]6}t| |ƒ}||kr$|gS t|ttfƒr||kr|S qW d}tj|t|ƒt| ƒf ƒ‚dS )a_  Search for the sequence that contains this child.

        :param child: The child node to search sequences for.
        :type child: NodeNG

        :returns: The sequence containing the given child node.
        :rtype: iterable(NodeNG)

        :raises AstroidError: If no sequence could be found that contains
            the given child.
        z"Could not find %s in %s's childrenN)rm   ro   r   r   r�   r   ÚAstroidErrorÚrepr)ra   Úchildr„   Únode_or_sequenceÚmsgr   r   r   Úchild_sequenceÿ  s    
zNodeNG.child_sequencec             C   sj   xF| j D ]<}t| |ƒ}||kr&||fS t|ttfƒr||kr||fS qW d}tj|t|ƒt| ƒf ƒ‚dS )aÇ  Find the field of this node that contains the given child.

        :param child: The child node to search fields for.
        :type child: NodeNG

        :returns: A tuple of the name of the field that contains the child,
            and the sequence or node that contains the child node.
        :rtype: tuple(str, iterable(NodeNG) or NodeNG)

        :raises AstroidError: If no field could be found that contains
            the given child.
        z"Could not find %s in %s's childrenN)rm   ro   r   r   r�   r   r›   rœ   )ra   r�   r„   rž   rŸ   r   r   r   r(     s    
zNodeNG.locate_childc             C   s
   | j jƒ S )z|The next sibling statement node.

        :returns: The next sibling statement node.
        :rtype: NodeNG or None
        )r&   Únext_sibling)ra   r   r   r   r¡   6  s    zNodeNG.next_siblingc             C   s
   | j jƒ S )zThe previous sibling statement.

        :returns: The previous sibling statement node.
        :rtype: NodeNG or None
        )r&   Úprevious_sibling)ra   r   r   r   r¢   >  s    zNodeNG.previous_siblingc             C   s   | j dkr| jƒ S | j S )zaThe first line that this node appears on in the source code.

        :type: int or None
        N)r_   Ú_fixed_source_line)ra   r   r   r   rŠ   I  s    
zNodeNG.fromlinenoc             C   s(   | j sd}n| jƒ }|dkr"| jS |jS )z`The last line that this node appears on in the source code.

        :type: int or None
        N)rm   r”   rŠ   Útolineno)ra   Z	lastchildr   r   r   r¤   T  s    zNodeNG.tolinenoc             C   sl   | j }| }y$x|dkr*t|jƒ ƒ}|j }qW W n8 tk
rf   | j}x|r`|dkr`|j }|j}qFW Y nX |S )a  Attempt to find the line that this node appears on.

        We need this method since not all nodes have :attr:`lineno` set.

        :returns: The line number of this node,
            or None if this could not be determined.
        :rtype: int or None
        N)r_   r   r’   ÚStopIterationr&   )ra   r‡   Ú_noder   r   r   r£   d  s    	
zNodeNG._fixed_source_linec             C   s
   || j fS )a@  Get a range from the given line number to where this node ends.

        :param lineno: The line number to start the range at.
        :type lineno: int

        :returns: The range of line numbers that this node belongs to,
            starting at the given line number.
        :rtype: tuple(int, int or None)
        )r¤   )ra   r_   r   r   r   Úblock_rangez  s    
zNodeNG.block_rangec             C   s   | j j||ƒ dS )aW  Define that the given name is declared in the given statement node.

        This definition is stored on the parent scope node.

        .. seealso:: :meth:`scope`

        :param name: The name that is being defined.
        :type name: str

        :param stmt: The statement that defines the given name.
        :type stmt: NodeNG
        N)r&   Ú	set_local)ra   rk   r   r   r   r   r¨   †  s    zNodeNG.set_localc             c   st   t | |ƒr| V  |dkr@x"| jƒ D ]}|j||ƒE dH  q"W dS x.| jƒ D ]"}t ||ƒrZqJ|j||ƒE dH  qJW dS )aÇ  Get the nodes (including this one or below) of the given types.

        :param klass: The types of node to search for.
        :type klass: builtins.type or tuple(builtins.type)

        :param skip_klass: The types of node to ignore. This is useful to ignore
            subclasses of :attr:`klass`.
        :type skip_klass: builtins.type or tuple(builtins.type)

        :returns: The node of the given types.
        :rtype: iterable(NodeNG)
        N)r   r’   Únodes_of_class)ra   ÚklassZ
skip_klassÚ
child_noder   r   r   r©   •  s    

zNodeNG.nodes_of_classc             C   s   g S )Nr   )ra   r   r   r   Ú_get_assign_nodes°  s    zNodeNG._get_assign_nodesc             c   s$   x| j ƒ D ]}|jƒ E d H  q
W d S )N)r’   Ú_get_name_nodes)ra   r«   r   r   r   r­   ´  s    zNodeNG._get_name_nodesc             c   s   f E d H  d S )Nr   )ra   r   r   r   Ú _get_return_nodes_skip_functions¸  s    z'NodeNG._get_return_nodes_skip_functionsc             c   s   f E d H  d S )Nr   )ra   r   r   r   Ú_get_yield_nodes_skip_lambdas»  s    z$NodeNG._get_yield_nodes_skip_lambdasc             C   s   d S )Nr   )ra   r˜   rk   r   r   r   Ú_infer_name¾  s    zNodeNG._infer_namec             C   s   t jd| |d�‚dS )z3we don't know how to resolve a statement by defaultz#No inference function for {node!r}.)r   r   N)r   r2   )ra   r   r   r   r   re   Â  s    zNodeNG._inferc             C   s   t | jƒ ƒS )z�Get a list of the inferred values.

        .. seealso:: :ref:`inference`

        :returns: The inferred values.
        :rtype: list
        )r�   r   )ra   r   r   r   r!   É  s    zNodeNG.inferredc             C   s   | S )zäInstantiate an instance of the defined class.

        .. note::

            On anything other than a :class:`ClassDef` this will return self.

        :returns: An instance of the defined class.
        :rtype: object
        r   )ra   r   r   r   Úinstantiate_classÓ  s    
zNodeNG.instantiate_classc             C   s   dS )zÄCheck if this node inherits from the given type.

        :param node: The node defining the base to look for.
            Usually this is a :class:`Name` node.
        :type node: NodeNG
        Fr   )ra   r   r   r   r   Úhas_baseß  s    zNodeNG.has_basec             C   s   dS )z´Whether this node defines something that is callable.

        :returns: True if this defines something that is callable,
            False otherwise.
        :rtype: bool
        Fr   )ra   r   r   r   Úcallableè  s    zNodeNG.callablec             C   s   dS )NFr   )ra   r   r   r   r   Úeqñ  s    z	NodeNG.eqc             C   s
   t j| ƒS )zoGet the source code that this node represents.

        :returns: The source code.
        :rtype: str
        )r   Zto_code)ra   r   r   r   r   ô  s    zNodeNG.as_stringú   r   rr   c       
         st   t d	‡fdd„	ƒ‰ ˆ jtƒˆ jtƒd
‡ ‡fdd„	ƒƒ}ˆ jtƒd‡ ‡‡‡‡‡fdd„	ƒ}g }	ˆ | |	tƒ ƒ dj|	ƒS )a  Get a string representation of the AST from this node.

        :param ids: If true, includes the ids with the node type names.
        :type ids: bool

        :param include_linenos: If true, includes the line numbers and
            column offsets.
        :type include_linenos: bool

        :param ast_state: If true, includes information derived from
            the whole AST like local and global variables.
        :type ast_state: bool

        :param indent: A string to use to indent the output string.
        :type indent: str

        :param max_depth: If set to a positive integer, won't return
            nodes deeper than max_depth in the string.
        :type max_depth: int

        :param max_width: Attempt to format the output string to stay
            within this number of characters, but can exceed it under some
            circumstances. Only positive integer values are valid, the default is 80.
        :type max_width: int

        :returns: The string representation of the AST.
        :rtype: str
        rn   r"   c                s\   t j| tˆtˆ ƒ dƒd�jdƒ}|j|d ƒ |j‡ fdd„|dd… D ƒƒ t|ƒdkS )z‚Outputs a representation of a non-tuple/list, non-node that's
            contained within an AST, including strings.
            r"   )rt   Tr   c                s   g | ]}ˆ | ‘qS r   r   )r6   r‡   )Ú
cur_indentr   r   ú
<listcomp>+  s    z8NodeNG.repr_tree.<locals>._repr_tree.<locals>.<listcomp>N)r|   r}   Úmaxrz   r~   r   Úextend)r   rƒ   Údoner¶   Údepthr…   )Ú	max_width)r¶   r   Ú
_repr_tree"  s     z$NodeNG.repr_tree.<locals>._repr_treec                s  |ˆ7 }|j dƒ | sd}næt| ƒdkr>ˆ | d ||||ƒ}nÄt| ƒdkrœˆ | d ||||ƒ}|sn|j dƒ n|j dƒ |j |ƒ ˆ | d ||||ƒp˜|}nf|j dƒ |j |ƒ x8| d	d… D ](}ˆ |||||ƒ |j dƒ |j |ƒ q¾W ˆ | d ||||ƒ d
}|j dƒ |S )zFOutputs a representation of a sequence that's contained within an AST.ú[Fr"   r   r   z, z,
Ú
NTú]r“   r“   )r   rz   )r   rƒ   rº   r¶   r»   Úbrokenr�   )r½   rs   r   r   Ú	_repr_seq/  s.    






z#NodeNG.repr_tree.<locals>._repr_seqc                s¸  | |kr,|j ˆdt| ƒjt| ƒf  ƒ dS |j| ƒ ˆrP|ˆkrP|j dƒ dS |d7 }|ˆ7 }ˆr‚|j dt| ƒjt| ƒf ƒ n|j dt| ƒj ƒ g }ˆr¨|jdƒ |j| jƒ |j| jƒ ˆrÐ|j| jƒ |sÚd}nÐt	|ƒdk�r|j d	|d
  ƒ ˆ t
| |d
 ƒ||||ƒ}n”|j dƒ |j |ƒ xN|dd… D ]>}|j d	| ƒ ˆ t
| |ƒ||||ƒ |j dƒ |j |ƒ �q8W |j d	|d  ƒ ˆ t
| |d ƒ||||ƒ d}|j dƒ |S )z4Outputs a strings representation of an astroid node.z<Recursion on %s with id=%sFz...r"   z
%s<0x%x>(
z%s(r_   r`   z%s=r   r¿   Nz,
Tú))r_   r`   r“   r“   r“   )r   r1   ry   r‰   Úaddr¹   r{   rm   Ú_other_other_fieldsrz   ro   )r   rƒ   rº   r¶   r»   rx   rÁ   r„   )r½   Ú	ast_stateÚidsÚinclude_linenosrs   Ú	max_depthr   r   Ú
_repr_nodeN  sN    






z$NodeNG.repr_tree.<locals>._repr_node)rn   r"   )rn   r"   )rn   r"   )Ú_singledispatchÚregisterr   r�   r^   Úsetr€   )
ra   rÇ   rÈ   rÆ   rs   rÉ   r¼   rÂ   rÊ   rƒ   r   )r½   rÆ   rÇ   rÈ   rs   rÉ   r¼   r   Ú	repr_treeü  s    &/zNodeNG.repr_treec             C   s   t jS )ak  Determine the boolean value of this node.

        The boolean value of a node can have three
        possible values:

            * False: For instance, empty data structures,
              False, empty strings, instances which return
              explicitly False from the __nonzero__ / __bool__
              method.
            * True: Most of constructs are True by default:
              classes, functions, modules etc
            * Uninferable: The inference engine is uncertain of the
              node's value.

        :returns: The boolean value of this node.
        :rtype: bool or Uninferable
        )r   r   )ra   r   r   r   Ú
bool_value‚  s    zNodeNG.bool_valuec             C   s   t j| jjtt ƒƒS )N)ÚOP_PRECEDENCErc   rB   ry   rz   )ra   r   r   r   Úop_precedence–  s    zNodeNG.op_precedencec             C   s   dS )NTr   )ra   r   r   r   Úop_left_associativeš  s    zNodeNG.op_left_associative)NNN)N)N)N)FFFrµ   r   rr   )9ry   Ú
__module__Ú__qualname__Ú__doc__r–   Úoptional_assignÚis_functionÚ	is_lambdar_   r`   r&   rm   r{   rÅ   rd   rb   r   rq   rˆ   r‹   r�   r’   r”   r•   r—   r˜   r™   rš   r    r(   r¡   r¢   r   ÚcachedpropertyrŠ   r¤   r£   r§   r¨   r©   Úcachedr¬   r­   r®   r¯   r°   re   r!   r±   r²   r³   r´   r   rÎ   rÏ   rÑ   rÒ   r   r   r   r   r^      sp   	

!




		
     
r^   c               @   s$   e Zd ZdZdZdd„ Zdd„ ZdS )Ú	Statementz&Statement node adding a few attributesTc             C   s<   | j j| ƒ}|j| ƒ}y||d  S  tk
r6   Y nX dS )z|The next sibling statement node.

        :returns: The next sibling statement node.
        :rtype: NodeNG or None
        r"   N)r&   r    r4   rC   )ra   Ústmtsr4   r   r   r   r¡   ¨  s    
zStatement.next_siblingc             C   s.   | j j| ƒ}|j| ƒ}|dkr*||d  S dS )zThe previous sibling statement.

        :returns: The previous sibling statement node.
        :rtype: NodeNG or None
        r"   N)r&   r    r4   )ra   rÜ   r4   r   r   r   r¢   µ  s
    
zStatement.previous_siblingN)ry   rÓ   rÔ   rÕ   r–   r¡   r¢   r   r   r   r   rÛ   Ÿ  s   rÛ   c                   sb   e Zd ZdZdZd‡ fdd„	Zdd„ Zeddd	„ƒZd
d„ Z	dd„ Z
ejdd„ ƒZdd„ Z‡  ZS )Ú_BaseContainerz.Base class for Set, FrozenSet, Tuple and List.r   Nc                s   g | _ tt| ƒj|||ƒ dS )aa  
        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)r   ÚsuperrÝ   rb   )ra   r_   r`   r&   )rB   r   r   rb   É  s    z_BaseContainer.__init__c             C   s
   || _ dS )z�Do some setup after initialisation.

        :param elts: The list of elements the that node contains.
        :type elts: list(NodeNG)
        N)r   )ra   r   r   r   r   ÚpostinitÝ  s    z_BaseContainer.postinitc             C   s*   | ƒ }|dkrg |_ ndd„ |D ƒ|_ |S )a  Create a node of this type from the given list of elements.

        :param elts: The list of elements that the node should contain.
        :type elts: list(NodeNG)

        :returns: A new node containing the given elements.
        :rtype: NodeNG
        Nc             S   s    g | ]}t |ƒrt|ƒn|‘qS r   )r   Úconst_factory)r6   Úer   r   r   r·   ó  s    z0_BaseContainer.from_elements.<locals>.<listcomp>)r   )Úclsr   r   r   r   r   Úfrom_elementså  s
    
z_BaseContainer.from_elementsc             C   s   | j S )z‰An iterator over the elements this node contains.

        :returns: The contents of this node.
        :rtype: iterable(NodeNG)
        )r   )ra   r   r   r   Úiteredö  s    z_BaseContainer.iteredc             C   s
   t | jƒS )z‰Determine the boolean value of this node.

        :returns: The boolean value of this node.
        :rtype: bool or Uninferable
        )Úboolr   )ra   r   r   r   rÏ   þ  s    z_BaseContainer.bool_valuec             C   s   dS )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        Nr   )ra   r   r   r   Úpytype  s    z_BaseContainer.pytypec             c   s   | j E d H  d S )N)r   )ra   r   r   r   r’     s    z_BaseContainer.get_children)r   )NNN)N)ry   rÓ   rÔ   rÕ   rm   rb   rß   Úclassmethodrã   rä   rÏ   ÚabcÚabstractmethodræ   r’   Ú__classcell__r   r   )rB   r   rÝ   Â  s   rÝ   )Ú	metaclassc               @   s:   e Zd ZdZedd�dd„ ƒZdd„ Zdd	„ Zd
d„ ZdS )ÚLookupMixInz+Mixin to look up a name in the right scope.N)Úmaxsizec             C   s   | j ƒ j| |ƒS )ad  Lookup where the given variable is assigned.

        The lookup starts from self's scope. If self is not a frame itself
        and the name is found in the inner frame locals, statements will be
        filtered to remove ignorable statements according to self's location.

        :param name: The name of the variable to find assignments for.
        :type name: str

        :returns: The scope node and the list of assignments associated to the
            given name according to the scope where it has been found (locals,
            globals or builtin).
        :rtype: tuple(str, list(NodeNG))
        )r™   Zscope_lookup)ra   rk   r   r   r   Úlookup  s    zLookupMixIn.lookupc             C   s$   | j |ƒ\}}tjƒ }tj|||ƒS )a
  Lookup the inferred values of the given variable.

        :param name: The variable name to find values for.
        :type name: str

        :returns: The inferred values of the statements returned from
            :meth:`lookup`.
        :rtype: iterable
        )rî   Ú
contextmodZInferenceContextr   Z_infer_stmts)ra   rk   r˜   rÜ   r   r   r   r   Úilookup'  s    
zLookupMixIn.ilookupc                sB   dd„ |D ƒ}t |ƒdkr>tdd„ |D ƒƒr>‡ fdd„|D ƒ}|S )Nc             S   s   g | ]}||j ƒ f‘qS r   )r—   )r6   r   r   r   r   r·   6  s    z=LookupMixIn._get_filtered_node_statements.<locals>.<listcomp>r"   c             s   s   | ]\}}t |tƒV  qd S )N)r   ÚExceptHandler)r6   Ú_r   r   r   r   r8   :  s    z<LookupMixIn._get_filtered_node_statements.<locals>.<genexpr>c                s"   g | ]\}}|j ˆ ƒr||f‘qS r   )r•   )r6   r   r   )ra   r   r   r·   =  s    )rz   r=   )ra   ÚnodesÚ
statementsr   )ra   r   Ú_get_filtered_node_statements5  s
    z)LookupMixIn._get_filtered_node_statementsc             C   sN  |dkr| j ƒ jj ƒ }n$| j ƒ }| jƒ |kr<|jr<|jj ƒ }| jƒ }||krt|jdk	rt|jdk	sht|ƒ‚|j| }nd}g }g }| j|ƒ}	�x¼|	D �]²\}
}|j|  ko°dkn  r¸P ||krÊt| ƒrÊq’t|
dƒsìt|
|
jƒ |
jƒ j	fƒ‚|
j
ƒ }|
j| ƒ�rP |j| |
||ƒ\}}|�rP |j}|�rF|j| ƒ�rF|
g}|jg}q’t|tƒ�rZ|
g}q’y|j|jƒ}W n tk
�r€   Y ndX || j
ƒ j|ƒ�r˜q’|�pªt|| |
ƒ�sä|
j �sØ|
jƒ dk�sØ|
j|| jk�rä||= ||= t|
tƒ�r| �r&|j|jk�r&g }g }nt|
tƒ�r&g }g }q’t| |
ƒs’|j|
ƒ |j|jƒ q’W |S )ap  Filter the given list of statements to remove ignorable statements.

        If self is not a frame itself and the name is found in the inner
        frame locals, statements will be filtered to remove ignorable
        statements according to self's location.

        :param stmts: The statements to filter.
        :type stmts: list(NodeNG)

        :param frame: The frame that all of the given statements belong to.
        :type frame: NodeNG

        :param offset: The line offset to filter statements up to.
        :type offset: int

        :returns: The filtered statements.
        :rtype: list(NodeNG)
        r"   Nr   Úassign_typeZPartialFunctionr“   )r˜   r&   r—   rŠ   ÚAssertionErrorrõ   Úis_from_decoratorÚhasattrr™   Úlocalsrö   r²   Ú_get_filtered_stmtsrÖ   r•   r   Ú	NamedExprr4   Ú
ValueErrorr.   r×   Úqnamerk   Ú
AssignNameÚDelNamer   )ra   rÜ   r˜   ÚoffsetZmyframeÚmystmtZmylinenoZ_stmtsZ_stmt_parentsrô   r   r   rö   rº   rÖ   Zpindexr   r   r   Ú_filter_stmtsA  sx    




zLookupMixIn._filter_stmts)	ry   rÓ   rÔ   rÕ   r   rî   rð   rõ   r  r   r   r   r   rì     s
   rì   c                   s&   e Zd ZdZdZd‡ fdd„	Z‡  ZS )rÿ   aû  Variation of :class:`ast.Assign` representing assignment to a name.

    An :class:`AssignName` is the name of something that is assigned to.
    This includes variables defined in a function signature or in a loop.

    >>> node = astroid.extract_node('variable = range(10)')
    >>> node
    <Assign l.1 at 0x7effe1db8550>
    >>> list(node.get_children())
    [<AssignName.variable l.1 at 0x7effe1db8748>, <Call l.1 at 0x7effe1db8630>]
    >>> list(node.get_children())[0].as_string()
    'variable'
    rk   Nc                s   || _ tt| ƒj|||ƒ dS )aµ  
        :param name: The name that is assigned to.
        :type name: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rk   rÞ   rÿ   rb   )ra   rk   r_   r`   r&   )rB   r   r   rb   î  s    zAssignName.__init__)rk   )NNNN)ry   rÓ   rÔ   rÕ   r{   rb   rê   r   r   )rB   r   rÿ   Û  s   rÿ   c                   s&   e Zd ZdZdZd‡ fdd„	Z‡  ZS )r   aQ  Variation of :class:`ast.Delete` representing deletion of a name.

    A :class:`DelName` is the name of something that is deleted.

    >>> node = astroid.extract_node("del variable #@")
    >>> list(node.get_children())
    [<DelName.variable l.1 at 0x7effe1da4d30>]
    >>> list(node.get_children())[0].as_string()
    'variable'
    rk   Nc                s   || _ tt| ƒj|||ƒ dS )a·  
        :param name: The name that is being deleted.
        :type name: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rk   rÞ   r   rb   )ra   rk   r_   r`   r&   )rB   r   r   rb     s    zDelName.__init__)rk   )NNNN)ry   rÓ   rÔ   rÕ   r{   rb   rê   r   r   )rB   r   r     s   r   c                   s.   e Zd ZdZdZd	‡ fdd„	Zdd„ Z‡  ZS )
ÚNamea³  Class representing an :class:`ast.Name` node.

    A :class:`Name` node is something that is named, but not covered by
    :class:`AssignName` or :class:`DelName`.

    >>> node = astroid.extract_node('range(10)')
    >>> node
    <Call l.1 at 0x7effe1db8710>
    >>> list(node.get_children())
    [<Name.range l.1 at 0x7effe1db86a0>, <Const.int l.1 at 0x7effe1db8518>]
    >>> list(node.get_children())[0].as_string()
    'range'
    rk   Nc                s   || _ tt| ƒj|||ƒ dS )aº  
        :param name: The name that this node refers to.
        :type name: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rk   rÞ   r  rb   )ra   rk   r_   r`   r&   )rB   r   r   rb   ?  s    zName.__init__c             c   s*   | V  x| j ƒ D ]}|jƒ E d H  qW d S )N)r’   r­   )ra   r«   r   r   r   r­   V  s    zName._get_name_nodes)rk   )NNNN)ry   rÓ   rÔ   rÕ   r{   rb   r­   rê   r   r   )rB   r   r  .  s   r  c            
       s€   e Zd ZdZd"ZdZdZd#Zd$‡ fdd„	Zd%dd„Z	dd„ Z
ej‡ fdd„ƒZdd„ Zdd„ Zdd„ Zd&dd„Zd d!„ Z‡  ZS )'Ú	Argumentsa;  Class representing an :class:`ast.arguments` node.

    An :class:`Arguments` node represents that arguments in a
    function definition.

    >>> node = astroid.extract_node('def foo(bar): pass')
    >>> node
    <FunctionDef.foo l.1 at 0x7effe1db8198>
    >>> node.args
    <Arguments l.1 at 0x7effe1db82e8>
    ÚargsÚdefaultsÚ
kwonlyargsÚposonlyargsÚkw_defaultsÚannotationsÚvarargannotationÚkwargannotationÚkwonlyargs_annotationsÚtype_comment_argsNÚvarargÚkwargc                sX   t t| ƒj|d� || _|| _g | _g | _g | _g | _g | _	g | _
g | _g | _g | _dS )a9  
        :param vararg: The name of the variable length arguments.
        :type vararg: str or None

        :param kwarg: The name of the variable length keyword arguments.
        :type kwarg: str or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        )r&   N)rÞ   r  rb   r  r  r  r  r  r	  r
  r  Úposonlyargs_annotationsr  r  )ra   r  r  r&   )rB   r   r   rb   Ž  s    zArguments.__init__c             C   sF   || _ || _|| _|| _|| _|| _|| _|| _|	| _|
| _	|| _
dS )aî  Do some setup after initialisation.

        :param args: The names of the required arguments.
        :type args: list(AssignName)

        :param defaults: The default values for arguments that can be passed
            positionally.
        :type defaults: list(NodeNG)

        :param kwonlyargs: The keyword arguments that cannot be passed
            positionally.
        :type kwonlyargs: list(AssignName)

        :param posonlyargs: The arguments that can only be passed
            positionally.
        :type kwonlyargs: list(AssignName)

        :param kw_defaults: The default values for keyword arguments that
            cannot be passed positionally.
        :type kw_defaults: list(NodeNG)

        :param annotations: The type annotations of arguments that can be
            passed positionally.
        :type annotations: list(NodeNG)

        :param kwonlyargs_annotations: The type annotations of arguments that
            cannot be passed positionally. This should always be passed in
            Python 3.
        :type kwonlyargs_annotations: list(NodeNG)

        :param posonlyargs_annotations: The type annotations of arguments that
            can only be passed positionally. This should always be passed in
            Python 3.
        :type posonlyargs_annotations: list(NodeNG)

        :param varargannotation: The type annotation for the variable length
            arguments.
        :type varargannotation: NodeNG

        :param kwargannotation: The type annotation for the variable length
            keyword arguments.
        :type kwargannotation: NodeNG

        :param type_comment_args: The type annotation,
            passed by a type comment, of each argument.
        :type type_comment_args: list(NodeNG or None)
        N)r  r  r  r	  r
  r  r  r  r  r  r  )ra   r  r  r  r
  r  r	  r  r  r  r  r  r   r   r   rß   à  s    =zArguments.postinitc             C   s   | j |kr|S d S )N)r&   )ra   r˜   rk   r   r   r   r°   +  s    
zArguments._infer_namec                s   t t| ƒj}t|| jjpdƒS )zaThe first line that this node appears on in the source code.

        :type: int or None
        r   )rÞ   r  rŠ   r¸   r&   )ra   r_   )rB   r   r   rŠ   0  s    zArguments.fromlinenoc             C   sö   g }g }| j }| j rN| jpg }| j t|ƒ d… }| j dt| j ƒt|ƒ … }| jrp|jt| j|ƒƒ |jdƒ | jr’|jt| j|t| ddƒƒƒ | jr¨|jd| j ƒ | jrÖ| js¾|jdƒ |jt| j| j	| j
ƒƒ | jrì|jd| j ƒ dj|ƒS )zoGet the arguments formatted as string.

        :returns: The formatted arguments.
        :rtype: str
        NrZ   r  z*%srX   z**%sz, )r  r  rz   r	  r   Ú_format_argsro   r  r  r
  r  r  r€   )ra   rƒ   Zpositional_only_defaultsZpositional_or_keyword_defaultsr  r   r   r   Úformat_args9  s6    


zArguments.format_argsc             C   sž   t tj| jpf | jpf ƒƒ}t||ƒd }|dk	rZ|t|ƒt| jƒ  }|dkrZ| j| S t|| jƒd }|dk	rŠ| j	| dk	rŠ| j	| S t
j| j|d�‚dS )zÿGet the default value for an argument.

        :param argname: The name of the argument to get the default value for.
        :type argname: str

        :raises NoDefault: If there is no default value defined for the
            given argument.
        r   N)rŽ   rk   )r�   Ú	itertoolsÚchainr	  r  Ú	_find_argrz   r  r  r
  r   Z	NoDefaultr&   )ra   Úargnamer  r4   Úidxr   r   r   Údefault_value`  s    	

zArguments.default_valuec             C   sP   || j krdS || jkrdS | j|dd�d dk	pN| joNt|| jdd�d dk	S )zûCheck if the given name is defined in the arguments.

        :param name: The name to check for.
        :type name: str

        :returns: True if the given name is defined in the arguments,
            False otherwise.
        :rtype: bool
        T)Úrecr"   N)r  r  Úfind_argnamer  r  )ra   rk   r   r   r   Úis_argumentt  s    


zArguments.is_argumentFc             C   s4   | j s| jr0tj| jpf | j p f ƒ}t|||ƒS dS )a�  Get the index and :class:`AssignName` node for given name.

        :param argname: The name of the argument to search for.
        :type argname: str

        :param rec: Whether or not to include arguments in unpacked tuples
            in the search.
        :type rec: bool

        :returns: The index and node for the argument.
        :rtype: tuple(str or None, AssignName or None)
        N)NN)r  r	  r  r  r  )ra   r  r  Ú	argumentsr   r   r   r  ˆ  s    zArguments.find_argnamec             c   sº   | j pf E d H  | jpf E d H  | jE d H  | jE d H  x| jD ]}|d k	r@|V  q@W x| jD ]}|d k	r^|V  q^W | jd k	r†| jV  | jd k	r˜| jV  x| jD ]}|d k	r |V  q W d S )N)	r	  r  r  r  r
  r  r  r  r  )ra   r    r   r   r   r’   œ  s"    



zArguments.get_children)
r  r  r  r	  r
  r  r  r  r  r  )r  r  )NNN)NNNNNN)F)ry   rÓ   rÔ   rÕ   rm   r  r  r{   rb   rß   r°   r   rÙ   rŠ   r  r  r  r  r’   rê   r   r   )rB   r   r  ]  s8            Y     
?	'
r  Fc             C   sX   xRt |ƒD ]F\}}t|tƒr>|rPt| |jƒ}|d d k	rP|S q
|j| kr
||fS q
W dS )Nr   )NN)Ú	enumerater   r   r  r   rk   )r  r  r  ÚiÚargÚfoundr   r   r   r  ¶  s    

r  c             C   sô   g }| d krdS |d krg }|d k	r4t | ƒt |ƒ }tj| |ƒ}x¨t|ƒD ]œ\}\}}t|tƒrv|jdt|jƒ ƒ qJ|j	}	d}
|d k	rœ|	d|j
ƒ  7 }	d}
|j|	ƒ |d k	rJ||krJ|||  d k	rJ|d  |
|||  j
ƒ  7  < qJW dj|ƒS )	Nrn   z(%s)ú=z: z = r"   z, r“   )rz   r  Úzip_longestr  r   r   r   r  r   rk   r   r€   )r  r  r  ÚvaluesZdefault_offsetÚpackedr   r!  Ú
annotationr  Zdefault_sepr   r   r   r  Â  s*    

$r  c                   s@   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zd	d
„ Z	‡  Z
S )Ú
AssignAttraz  Variation of :class:`ast.Assign` representing assignment to an attribute.

    >>> node = astroid.extract_node('self.attribute = range(10)')
    >>> node
    <Assign l.1 at 0x7effe1d521d0>
    >>> list(node.get_children())
    [<AssignAttr.attribute l.1 at 0x7effe1d52320>, <Call l.1 at 0x7effe1d522e8>]
    >>> list(node.get_children())[0].as_string()
    'self.attribute'
    Úexprrl   Nc                s   || _ tt| ƒj|||ƒ dS )aÌ  
        :param attrname: The name of the attribute being assigned to.
        :type attrname: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rl   rÞ   r(  rb   )ra   rl   r_   r`   r&   )rB   r   r   rb   ð  s    zAssignAttr.__init__c             C   s
   || _ dS )z—Do some setup after initialisation.

        :param expr: What has the attribute that is being assigned to.
        :type expr: NodeNG or None
        N)r)  )ra   r)  r   r   r   rß     s    zAssignAttr.postinitc             c   s   | j V  d S )N)r)  )ra   r   r   r   r’     s    zAssignAttr.get_children)r)  )rl   )NNNN)N)ry   rÓ   rÔ   rÕ   rm   r{   r)  rb   rß   r’   rê   r   r   )rB   r   r(  Ü  s   

r(  c               @   s.   e Zd ZdZd	ZdZdZd
dd„Zdd„ ZdS )ÚAssertz÷Class representing an :class:`ast.Assert` node.

    An :class:`Assert` node represents an assert statement.

    >>> node = astroid.extract_node('assert len(things) == 10, "Not enough things"')
    >>> node
    <Assert l.1 at 0x7effe1d527b8>
    ÚtestÚfailNc             C   s   || _ || _dS )z÷Do some setup after initialisation.

        :param test: The test that passes or fails the assertion.
        :type test: NodeNG or None

        :param fail: The message shown when the assertion fails.
        :type fail: NodeNG or None
        N)r,  r+  )ra   r+  r,  r   r   r   rß   )  s    	zAssert.postinitc             c   s   | j V  | jd k	r| jV  d S )N)r+  r,  )ra   r   r   r   r’   5  s    
zAssert.get_children)r+  r,  )NN)	ry   rÓ   rÔ   rÕ   rm   r+  r,  rß   r’   r   r   r   r   r*    s   
r*  c               @   sL   e Zd ZdZdZdZdZdZdZddd„Z	dd	„ Z
ejd
d„ ƒZdd„ ZdS )ÚAssignzøClass representing an :class:`ast.Assign` node.

    An :class:`Assign` is a statement where something is explicitly
    asssigned to.

    >>> node = astroid.extract_node('variable = range(10)')
    >>> node
    <Assign l.1 at 0x7effe1db8550>
    Útargetsr   Útype_annotationNc             C   s   || _ || _|| _dS )zìDo some setup after initialisation.

        :param targets: What is being assigned to.
        :type targets: list(NodeNG) or None

        :param value: The value being assigned to the variables.
        :type: NodeNG or None
        N)r.  r   r/  )ra   r.  r   r/  r   r   r   rß   Y  s    	zAssign.postinitc             c   s   | j E d H  | jV  d S )N)r.  r   )ra   r   r   r   r’   f  s    zAssign.get_childrenc             C   s   | gt | jjƒ ƒ S )N)r�   r   r¬   )ra   r   r   r   r¬   k  s    zAssign._get_assign_nodesc             c   s   | j jƒ E d H  d S )N)r   r¯   )ra   r   r   r   r¯   o  s    z$Assign._get_yield_nodes_skip_lambdas)r.  r   )r/  )NNN)ry   rÓ   rÔ   rÕ   rm   rÅ   r.  r   r/  rß   r’   r   rÚ   r¬   r¯   r   r   r   r   r-  <  s   	
r-  c               @   s:   e Zd ZdZdZdZdZdZdZdZ	ddd„Z
d	d
„ ZdS )Ú	AnnAssignzöClass representing an :class:`ast.AnnAssign` node.

    An :class:`AnnAssign` is an assignment with a type annotation.

    >>> node = astroid.extract_node('variable: List[int] = range(10)')
    >>> node
    <AnnAssign l.1 at 0x7effe1d4c630>
    Útargetr'  r   ÚsimpleNc             C   s   || _ || _|| _|| _dS )a¼  Do some setup after initialisation.

        :param target: What is being assigned to.
        :type target: NodeNG

        :param annotation: The type annotation of what is being assigned to.
        :type: NodeNG

        :param simple: Whether :attr:`target` is a pure name
            or a complex statement.
        :type simple: int

        :param value: The value being assigned to the variables.
        :type: NodeNG or None
        N)r1  r'  r   r2  )ra   r1  r'  r2  r   r   r   r   rß   ”  s    zAnnAssign.postinitc             c   s&   | j V  | jV  | jd k	r"| jV  d S )N)r1  r'  r   )ra   r   r   r   r’   ©  s    
zAnnAssign.get_children)r1  r'  r   )r2  )N)ry   rÓ   rÔ   rÕ   rm   r{   r1  r'  r   r2  rß   r’   r   r   r   r   r0  s  s   
r0  c                   sX   e Zd ZdZdZdZdZdZd‡ fdd„	Zddd	„Z	dd
d„Z
ddd„Zdd„ Z‡  ZS )Ú	AugAssignzåClass representing an :class:`ast.AugAssign` node.

    An :class:`AugAssign` is an assignment paired with an operator.

    >>> node = astroid.extract_node('variable += 1')
    >>> node
    <AugAssign l.1 at 0x7effe1db4d68>
    r1  r   rK   Nc                s   || _ tt| ƒj|||ƒ dS )a÷  
        :param op: The operator that is being combined with the assignment.
            This includes the equals sign.
        :type op: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rK   rÞ   r3  rb   )ra   rK   r_   r`   r&   )rB   r   r   rb   È  s    zAugAssign.__init__c             C   s   || _ || _dS )zãDo some setup after initialisation.

        :param target: What is being assigned to.
        :type target: NodeNG or None

        :param value: The value being assigned to the variable.
        :type: NodeNG or None
        N)r1  r   )ra   r1  r   r   r   r   rß   â  s    	zAugAssign.postinitc             C   s   t ‚d S )N)ÚNotImplementedError)ra   r   r   r   r   Ú_infer_augassignï  s    zAugAssign._infer_augassignc             C   s6   y| j |d�}dd„ |D ƒS  tjk
r0   g S X dS )a&  Get a list of type errors which can occur during inference.

        Each TypeError is represented by a :class:`BadBinaryOperationMessage` ,
        which holds the original exception.

        :returns: The list of possible type errors.
        :rtype: list(BadBinaryOperationMessage)
        )r   c             S   s   g | ]}t |tjƒr|‘qS r   )r   r   ÚBadBinaryOperationMessage)r6   rƒ   r   r   r   r·   þ  s   z)AugAssign.type_errors.<locals>.<listcomp>N)r5  r   r2   )ra   r   Úresultsr   r   r   Útype_errorsò  s    	zAugAssign.type_errorsc             c   s   | j V  | jV  d S )N)r1  r   )ra   r   r   r   r’     s    zAugAssign.get_children)r1  r   )rK   )NNNN)NN)N)N)ry   rÓ   rÔ   rÕ   rm   r{   r1  r   rb   rß   r5  r8  r’   rê   r   r   )rB   r   r3  ±  s   


r3  c               @   s"   e Zd ZdZdZdZddd„ZdS )ÚRepra  Class representing an :class:`ast.Repr` node.

    A :class:`Repr` node represents the backtick syntax,
    which is a deprecated alias for :func:`repr` removed in Python 3.

    >>> node = astroid.extract_node('`variable`')
    >>> node
    <Repr l.1 at 0x7fa0951d75d0>
    r   Nc             C   s
   || _ dS )z‘Do some setup after initialisation.

        :param value: What is having :func:`repr` called on it.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß     s    zRepr.postinit)r   )N)ry   rÓ   rÔ   rÕ   rm   r   rß   r   r   r   r   r9  
  s   	r9  c                   sh   e Zd ZdZdZdZdZdZd‡ fdd„	Zddd	„Z	dd
d„Z
ddd„Zdd„ Zdd„ Zdd„ Z‡  ZS )ÚBinOpzÓClass representing an :class:`ast.BinOp` node.

    A :class:`BinOp` node is an application of a binary operator.

    >>> node = astroid.extract_node('a + b')
    >>> node
    <BinOp l.1 at 0x7f23b2e8cfd0>
    ÚleftÚrightrK   Nc                s   || _ tt| ƒj|||ƒ dS )až  
        :param op: The operator.
        :type: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rK   rÞ   r:  rb   )ra   rK   r_   r`   r&   )rB   r   r   rb   <  s    zBinOp.__init__c             C   s   || _ || _dS )a  Do some setup after initialisation.

        :param left: What is being applied to the operator on the left side.
        :type left: NodeNG or None

        :param right: What is being applied to the operator on the right side.
        :type right: NodeNG or None
        N)r;  r<  )ra   r;  r<  r   r   r   rß   S  s    	zBinOp.postinitc             C   s   t ‚d S )N)r4  )ra   r   r   r   r   Ú_infer_binop`  s    zBinOp._infer_binopc             C   s6   y| j |d�}dd„ |D ƒS  tjk
r0   g S X dS )a%  Get a list of type errors which can occur during inference.

        Each TypeError is represented by a :class:`BadBinaryOperationMessage`,
        which holds the original exception.

        :returns: The list of possible type errors.
        :rtype: list(BadBinaryOperationMessage)
        )r   c             S   s   g | ]}t |tjƒr|‘qS r   )r   r   r6  )r6   rƒ   r   r   r   r·   o  s   z%BinOp.type_errors.<locals>.<listcomp>N)r=  r   r2   )ra   r   r7  r   r   r   r8  c  s    	zBinOp.type_errorsc             c   s   | j V  | jV  d S )N)r;  r<  )ra   r   r   r   r’   v  s    zBinOp.get_childrenc             C   s
   t | j S )N)rÐ   rK   )ra   r   r   r   rÑ   z  s    zBinOp.op_precedencec             C   s
   | j dkS )Nz**)rK   )ra   r   r   r   rÒ   }  s    zBinOp.op_left_associative)r;  r<  )rK   )NNNN)NN)N)N)ry   rÓ   rÔ   rÕ   rm   r{   r;  r<  rb   rß   r=  r8  r’   rÑ   rÒ   rê   r   r   )rB   r   r:  %  s   


r:  c                   sH   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zd	d
„ Z	dd„ Z
‡  ZS )ÚBoolOpzÓClass representing an :class:`ast.BoolOp` node.

    A :class:`BoolOp` is an application of a boolean operator.

    >>> node = astroid.extract_node('a and b')
    >>> node
    <BinOp l.1 at 0x7f23b2e71c50>
    r%  rK   Nc                s   || _ tt| ƒj|||ƒ dS )až  
        :param op: The operator.
        :type: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rK   rÞ   r>  rb   )ra   rK   r_   r`   r&   )rB   r   r   rb   ”  s    zBoolOp.__init__c             C   s
   || _ dS )z™Do some setup after initialisation.

        :param values: The values being applied to the operator.
        :type values: list(NodeNG) or None
        N)r%  )ra   r%  r   r   r   rß   «  s    zBoolOp.postinitc             c   s   | j E d H  d S )N)r%  )ra   r   r   r   r’   ³  s    zBoolOp.get_childrenc             C   s
   t | j S )N)rÐ   rK   )ra   r   r   r   rÑ   ¶  s    zBoolOp.op_precedence)r%  )rK   )NNNN)N)ry   rÓ   rÔ   rÕ   rm   r{   r%  rb   rß   r’   rÑ   rê   r   r   )rB   r   r>  ‚  s   
r>  c               @   s   e Zd ZdZdS )ÚBreakz�Class representing an :class:`ast.Break` node.

    >>> node = astroid.extract_node('break')
    >>> node
    <Break l.1 at 0x7f23b2e9e5c0>
    N)ry   rÓ   rÔ   rÕ   r   r   r   r   r?  º  s   r?  c               @   sJ   e Zd ZdZdZdZdZdZddd„Ze	dd	„ ƒZ
e	d
d„ ƒZdd„ ZdS )ÚCallzÓClass representing an :class:`ast.Call` node.

    A :class:`Call` node is a call to a function, method, etc.

    >>> node = astroid.extract_node('function()')
    >>> node
    <Call l.1 at 0x7f23b2e71eb8>
    rŽ   r  ÚkeywordsNc             C   s   || _ || _|| _dS )ab  Do some setup after initialisation.

        :param func: What is being called.
        :type func: NodeNG or None

        :param args: The positional arguments being given to the call.
        :type args: list(NodeNG) or None

        :param keywords: The keyword arguments being given to the call.
        :type keywords: list(NodeNG) or None
        N)rŽ   r  rA  )ra   rŽ   r  rA  r   r   r   rß   Þ  s    zCall.postinitc             C   s   | j pg }dd„ |D ƒS )zVThe positional arguments that unpack something.

        :type: list(Starred)
        c             S   s   g | ]}t |tƒr|‘qS r   )r   ÚStarred)r6   r!  r   r   r   r·   õ  s    z!Call.starargs.<locals>.<listcomp>)r  )ra   r  r   r   r   Ústarargsî  s    
zCall.starargsc             C   s   | j pg }dd„ |D ƒS )zSThe keyword arguments that unpack something.

        :type: list(Keyword)
        c             S   s   g | ]}|j d kr|‘qS )N)r!  )r6   Úkeywordr   r   r   r·   þ  s    zCall.kwargs.<locals>.<listcomp>)rA  )ra   rA  r   r   r   rh   ÷  s    
zCall.kwargsc             c   s(   | j V  | jE d H  | jpf E d H  d S )N)rŽ   r  rA  )ra   r   r   r   r’    	  s    zCall.get_children)rŽ   r  rA  )NNN)ry   rÓ   rÔ   rÕ   rm   rŽ   r  rA  rß   ÚpropertyrC  rh   r’   r   r   r   r   r@  Ã  s   
		r@  c               @   s6   e Zd ZdZdZdZdZddd„Zdd„ Zd	d
„ Z	dS )rR   a5  Class representing an :class:`ast.Compare` node.

    A :class:`Compare` node indicates a comparison.

    >>> node = astroid.extract_node('a <= b <= c')
    >>> node
    <Compare l.1 at 0x7f23b2e9e6d8>
    >>> node.ops
    [('<=', <Name.b l.1 at 0x7f23b2e9e2b0>), ('<=', <Name.c l.1 at 0x7f23b2e9e390>)]
    r;  rJ   Nc             C   s   || _ || _dS )aH  Do some setup after initialisation.

        :param left: The value at the left being applied to a comparison
            operator.
        :type left: NodeNG or None

        :param ops: The remainder of the operators
            and their relevant right hand value.
        :type ops: list(tuple(str, NodeNG)) or None
        N)r;  rJ   )ra   r;  rJ   r   r   r   rß    	  s    zCompare.postinitc             c   s&   | j V  x| jD ]\}}|V  qW dS )zÏGet the child nodes below this node.

        Overridden to handle the tuple fields and skip returning the operator
        strings.

        :returns: The children.
        :rtype: iterable(NodeNG)
        N)r;  rJ   )ra   rò   Z
comparatorr   r   r   r’   .	  s    	zCompare.get_childrenc             C   s   | j d d S )zsAn optimized version of list(get_children())[-1]

        :returns: The last child.
        :rtype: NodeNG
        r"   r“   )rJ   )ra   r   r   r   r”   ;	  s    zCompare.last_child)r;  rJ   )NN)
ry   rÓ   rÔ   rÕ   rm   r;  rJ   rß   r’   r”   r   r   r   r   rR   	  s   

c                   s`   e Zd ZdZdZdZdZdZdZdZ	d‡ fdd„	Z
dd	d
„ZdZdd„ Zdd„ Zdd„ Z‡  ZS )ÚComprehensiona­  Class representing an :class:`ast.comprehension` node.

    A :class:`Comprehension` indicates the loop inside any type of
    comprehension including generator expressions.

    >>> node = astroid.extract_node('[x for x in some_values]')
    >>> list(node.get_children())
    [<Name.x l.1 at 0x7f23b2e352b0>, <Comprehension l.1 at 0x7f23b2e35320>]
    >>> list(node.get_children())[1].as_string()
    'for x in some_values'
    r1  rf   ÚifsÚis_asyncNc                s   t t| ƒjƒ  || _dS )zi
        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rÞ   rF  rb   r&   )ra   r&   )rB   r   r   rb   j	  s    zComprehension.__init__c             C   s   || _ || _|| _|| _dS )aî  Do some setup after initialisation.

        :param target: What is assigned to by the comprehension.
        :type target: NodeNG or None

        :param iter: What is iterated over by the comprehension.
        :type iter: NodeNG or None

        :param ifs: The contents of any if statements that filter
            the comprehension.
        :type ifs: list(NodeNG) or None

        :param is_async: Whether this is an asynchronous comprehension or not.
        :type: bool or None
        N)r1  rf   rG  rH  )ra   r1  rf   rG  rH  r   r   r   rß   s	  s    zComprehension.postinitTc             C   s   | S )zwThe type of assignment that this node performs.

        :returns: The assignment type.
        :rtype: NodeNG
        r   )ra   r   r   r   rö   Ž	  s    zComprehension.assign_typec             C   s@   | |kr"t |ttfƒr8|gdfS n| jƒ |kr8|gdfS |dfS )zmethod used in filter_stmtsTF)r   r/   r  r—   )ra   Zlookup_noder   rÜ   r  r   r   r   rû   –	  s    
z!Comprehension._get_filtered_stmtsc             c   s    | j V  | jV  | jE d H  d S )N)r1  rf   rG  )ra   r   r   r   r’   ¤	  s    zComprehension.get_children)r1  rf   rG  )rH  )N)NNNN)ry   rÓ   rÔ   rÕ   rm   r{   r1  rf   rG  rH  rb   rß   rÖ   rö   rû   r’   rê   r   r   )rB   r   rF  F	  s   	
rF  c                   s\   e Zd ZdZdZd‡ fdd„	Z‡ fdd„Zddd	„Zd
d„ Zdd„ Z	dd„ Z
dd„ Z‡  ZS )r/   aÅ  Class representing any constant including num, str, bool, None, bytes.

    >>> node = astroid.extract_node('(5, "This is a string.", True, None, b"bytes")')
    >>> node
    <Tuple.tuple l.1 at 0x7f23b2e358d0>
    >>> list(node.get_children())
    [<Const.int l.1 at 0x7f23b2e35940>,
    <Const.str l.1 at 0x7f23b2e35978>,
    <Const.bool l.1 at 0x7f23b2e359b0>,
    <Const.NoneType l.1 at 0x7f23b2e359e8>,
    <Const.bytes l.1 at 0x7f23b2e35a20>]
    r   Nc                s   || _ tt| ƒj|||ƒ dS )a¼  
        :param value: The value that the constant represents.
        :type value: object

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)r   rÞ   r/   rb   )ra   r   r_   r`   r&   )rB   r   r   rb   »	  s    zConst.__init__c                s   |dkrt ‚tƒ j|ƒS )Nr   )ÚAttributeErrorrÞ   Ú__getattr__)ra   rk   )rB   r   r   rJ  Ò	  s    zConst.__getattr__c             C   sä   t |tƒr|j}n,t |tƒr*t||d�}ntjdjt|ƒƒƒ‚y"t | jt	t
fƒr^t| j| ƒS W nj tk
r– } ztjd| ||d�|‚W Y dd}~X n6 tk
rÊ } ztjd| ||d�|‚W Y dd}~X nX tjd| | jf ƒ‚dS )a%  Get an item from this node if subscriptable.

        :param index: The node to use as a subscript index.
        :type index: Const or Slice

        :raises AstroidTypeError: When the given index cannot be used as a
            subscript index, or if this node is not subscriptable.
        )r   z(Could not use type {} as subscript indexzIndex {index!r} out of range)r9   r   r4   r   NzType error {error!r}z%r (value=%s))r   r/   r   rA   r@   r   r?   Úformatr1   ÚstrÚbytesrC   rD   rE   )ra   r4   r   Zindex_valuerG   r   r   r   ÚgetitemÝ	  s*    	

zConst.getitemc             C   s   dS )a  Check if the node has a custom __getattr__ or __getattribute__.

        :returns: True if the class has a custom
            __getattr__ or __getattribute__, False otherwise.
            For a :class:`Const` this is always ``False``.
        :rtype: bool
        Fr   )ra   r   r   r   Úhas_dynamic_getattr
  s    zConst.has_dynamic_getattrc             C   s   t | jtƒr| jS tƒ ‚dS )zÞAn iterator over the elements this node contains.

        :returns: The contents of this node.
        :rtype: iterable(str)

        :raises TypeError: If this node does not represent something that is iterable.
        N)r   r   rL  rE   )ra   r   r   r   rä   
  s    zConst.iteredc             C   s
   | j jƒ S )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        )Ú_proxiedrþ   )ra   r   r   r   ræ   
  s    zConst.pytypec             C   s
   t | jƒS )zzDetermine the boolean value of this node.

        :returns: The boolean value of this node.
        :rtype: bool
        )rå   r   )ra   r   r   r   rÏ   
  s    zConst.bool_value)r   )NNN)N)ry   rÓ   rÔ   rÕ   r{   rb   rJ  rN  rO  rä   ræ   rÏ   rê   r   r   )rB   r   r/   «	  s   
$
r/   c               @   s   e Zd ZdZdS )ÚContinuez™Class representing an :class:`ast.Continue` node.

    >>> node = astroid.extract_node('continue')
    >>> node
    <Continue l.1 at 0x7f23b2e35588>
    N)ry   rÓ   rÔ   rÕ   r   r   r   r   rQ  (
  s   rQ  c               @   s0   e Zd ZdZd
ZdZdd„ Zdd„ Zdd	„ ZdS )Ú
Decoratorsa‚  A node representing a list of decorators.

    A :class:`Decorators` is the decorators that are applied to
    a method or function.

    >>> node = astroid.extract_node('''
    @property
    def my_property(self):
        return 3
    ''')
    >>> node
    <FunctionDef.my_property l.2 at 0x7f23b2e35d30>
    >>> list(node.get_children())[0]
    <Decorators l.1 at 0x7f23b2e35d68>
    ró   Nc             C   s
   || _ dS )z“Do some setup after initialisation.

        :param nodes: The decorators that this node contains.
        :type nodes: list(Name or Call)
        N)ró   )ra   ró   r   r   r   rß   I
  s    zDecorators.postinitc             C   s   | j j jƒ S )z«The first parent node defining a new scope.

        :returns: The first parent scope node.
        :rtype: Module or FunctionDef or ClassDef or Lambda or GenExpr
        )r&   r™   )ra   r   r   r   r™   Q
  s    zDecorators.scopec             c   s   | j E d H  d S )N)ró   )ra   r   r   r   r’   Z
  s    zDecorators.get_children)ró   )	ry   rÓ   rÔ   rÕ   rm   ró   rß   r™   r’   r   r   r   r   rR  1
  s   	rR  c                   s@   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zd	d
„ Z	‡  Z
S )ÚDelAttra   Variation of :class:`ast.Delete` representing deletion of an attribute.

    >>> node = astroid.extract_node('del self.attr')
    >>> node
    <Delete l.1 at 0x7f23b2e35f60>
    >>> list(node.get_children())[0]
    <DelAttr.attr l.1 at 0x7f23b2e411d0>
    r)  rl   Nc                s   || _ tt| ƒj|||ƒ dS )aÐ  
        :param attrname: The name of the attribute that is being deleted.
        :type attrname: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rl   rÞ   rS  rb   )ra   rl   r_   r`   r&   )rB   r   r   rb   p
  s    zDelAttr.__init__c             C   s
   || _ dS )z‡Do some setup after initialisation.

        :param expr: The name that this node represents.
        :type expr: Name or None
        N)r)  )ra   r)  r   r   r   rß   ‡
  s    zDelAttr.postinitc             c   s   | j V  d S )N)r)  )ra   r   r   r   r’   �
  s    zDelAttr.get_children)r)  )rl   )NNNN)N)ry   rÓ   rÔ   rÕ   rm   r{   r)  rb   rß   r’   rê   r   r   )rB   r   rS  ^
  s   
rS  c               @   s*   e Zd ZdZdZdZd	dd„Zdd„ ZdS )
ÚDeletezäClass representing an :class:`ast.Delete` node.

    A :class:`Delete` is a ``del`` statement this is deleting something.

    >>> node = astroid.extract_node('del self.attr')
    >>> node
    <Delete l.1 at 0x7f23b2e35f60>
    r.  Nc             C   s
   || _ dS )zˆDo some setup after initialisation.

        :param targets: What is being deleted.
        :type targets: list(NodeNG) or None
        N)r.  )ra   r.  r   r   r   rß   ¤
  s    zDelete.postinitc             c   s   | j E d H  d S )N)r.  )ra   r   r   r   r’   ¬
  s    zDelete.get_children)r.  )N)ry   rÓ   rÔ   rÕ   rm   r.  rß   r’   r   r   r   r   rT  “
  s
   
rT  c                   sn   e Zd ZdZdZd‡ fdd„	Zdd„ Zeddd	„ƒZd
d„ Z	dd„ Z
dd„ Zdd„ Zddd„Zdd„ Z‡  ZS )ÚDictzßClass representing an :class:`ast.Dict` node.

    A :class:`Dict` is a dictionary that is created with ``{}`` syntax.

    >>> node = astroid.extract_node('{1: "1"}')
    >>> node
    <Dict.dict l.1 at 0x7f23b2e35cc0>
    ÚitemsNc                s   g | _ tt| ƒj|||ƒ dS )aa  
        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rV  rÞ   rU  rb   )ra   r_   r`   r&   )rB   r   r   rb   ¼
  s    zDict.__init__c             C   s
   || _ dS )z¥Do some setup after initialisation.

        :param items: The key-value pairs contained in the dictionary.
        :type items: list(tuple(NodeNG, NodeNG))
        N)rV  )ra   rV  r   r   r   rß   Ð
  s    zDict.postinitc             C   s.   | ƒ }|dkrg |_ ndd„ |j ƒ D ƒ|_ |S )zÚCreate a :class:`Dict` of constants from a live dictionary.

        :param items: The items to store in the node.
        :type items: dict

        :returns: The created dictionary node.
        :rtype: Dict
        Nc             S   s4   g | ],\}}t |ƒrt|ƒt |ƒr*t|ƒn|f‘qS r   )r   rà   )r6   ÚkÚvr   r   r   r·   ç
  s   z&Dict.from_elements.<locals>.<listcomp>)rV  )râ   rV  r   r   r   r   rã   Ø
  s    
zDict.from_elementsc             C   s   dt  S )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        z%s.dict)ÚBUILTINS)ra   r   r   r   ræ   î
  s    zDict.pytypec             c   s$   x| j D ]\}}|V  |V  qW dS )zïGet the key and value nodes below this node.

        Children are returned in the order that they are defined in the source
        code, key first then the value.

        :returns: The children.
        :rtype: iterable(NodeNG)
        N)rV  )ra   ri   r   r   r   r   r’   ö
  s    	zDict.get_childrenc             C   s   | j r| j d d S dS )z™An optimized version of list(get_children())[-1]

        :returns: The last child, or None if no children exist.
        :rtype: NodeNG or None
        r"   Nr“   )rV  )ra   r   r   r   r”     s    zDict.last_childc             C   s   dd„ | j D ƒS )z�An iterator over the keys this node contains.

        :returns: The keys of this node.
        :rtype: iterable(NodeNG)
        c             S   s   g | ]\}}|‘qS r   r   )r6   ri   rò   r   r   r   r·     s    zDict.itered.<locals>.<listcomp>)rV  )ra   r   r   r   rä     s    zDict.iteredc             C   sœ   xŒ| j D ]‚\}}t|tƒrFy|j||ƒS  tjtjfk
rD   wY nX xB|j|ƒD ]4}|tj	krbqRt|t
ƒrRt|t
ƒrR|j|jkrR|S qRW qW tj|ƒ‚dS )ax  Get an item from this node.

        :param index: The node to use as a subscript index.
        :type index: Const or Slice

        :raises AstroidTypeError: When the given index cannot be used as a
            subscript index, or if this node is not subscriptable.
        :raises AstroidIndexError: If the given index does not exist in the
            dictionary.
        N)rV  r   Ú
DictUnpackrN  r   r?   rD   r   r   r   r/   r   )ra   r4   r   ri   r   Zinferredkeyr   r   r   rN    s    

zDict.getitemc             C   s
   t | jƒS )zzDetermine the boolean value of this node.

        :returns: The boolean value of this node.
        :rtype: bool
        )rå   rV  )ra   r   r   r   rÏ   0  s    zDict.bool_value)rV  )NNN)N)N)ry   rÓ   rÔ   rÕ   rm   rb   rß   rç   rã   ræ   r’   r”   rä   rN  rÏ   rê   r   r   )rB   r   rU  °
  s   

rU  c               @   s2   e Zd ZdZd
ZdZddd„Zdd„ Zdd	„ ZdS )ÚExpra  Class representing an :class:`ast.Expr` node.

    An :class:`Expr` is any expression that does not have its value used or
    stored.

    >>> node = astroid.extract_node('method()')
    >>> node
    <Call l.1 at 0x7f23b2e352b0>
    >>> node.parent
    <Expr l.1 at 0x7f23b2e35278>
    r   Nc             C   s
   || _ dS )z�Do some setup after initialisation.

        :param value: What the expression does.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß   M  s    zExpr.postinitc             c   s   | j V  d S )N)r   )ra   r   r   r   r’   U  s    zExpr.get_childrenc             c   s   | j js| j jƒ E d H  d S )N)r   rØ   r¯   )ra   r   r   r   r¯   X  s    z"Expr._get_yield_nodes_skip_lambdas)r   )N)	ry   rÓ   rÔ   rÕ   rm   r   rß   r’   r¯   r   r   r   r   r[  9  s   
r[  c               @   s   e Zd ZdZdd„ ZdS )ÚEllipsiszÅClass representing an :class:`ast.Ellipsis` node.

    An :class:`Ellipsis` is the ``...`` syntax.

    >>> node = astroid.extract_node('...')
    >>> node
    <Ellipsis l.1 at 0x7f23b2e35160>
    c             C   s   dS )z¸Determine the boolean value of this node.

        :returns: The boolean value of this node.
            For an :class:`Ellipsis` this is always ``True``.
        :rtype: bool
        Tr   )ra   r   r   r   rÏ   g  s    zEllipsis.bool_valueN)ry   rÓ   rÔ   rÕ   rÏ   r   r   r   r   r\  ]  s   r\  c               @   s   e Zd ZdZdZdS )Ú	EmptyNodezAHolds an arbitrary object in the :attr:`LocalsDictNodeNG.locals`.N)ry   rÓ   rÔ   rÕ   Úobjectr   r   r   r   r]  q  s   r]  c               @   sL   e Zd ZdZdZdZdZdZdZdd„ Z	ddd	„Z
ejd
d„ ƒZdd„ ZdS )rñ   a™  Class representing an :class:`ast.ExceptHandler`. node.

    An :class:`ExceptHandler` is an ``except`` block on a try-except.

    >>> node = astroid.extract_node('''
        try:
            do_something()
        except Exception as error:
            print("Error!")
        ''')
    >>> node
    <TryExcept l.2 at 0x7f23b2e9d908>
    >>> >>> node.handlers
    [<ExceptHandler l.4 at 0x7f23b2e9e860>]
    r1   rk   r$   Nc             c   s4   | j d k	r| j V  | jd k	r$| jV  | jE d H  d S )N)r1   rk   r$   )ra   r   r   r   r’   š  s
    

zExceptHandler.get_childrenc             C   s   || _ || _|| _dS )aY  Do some setup after initialisation.

        :param type: The types that the block handles.
        :type type: Tuple or NodeNG or None

        :param name: The name that the caught exception is assigned to.
        :type name: AssignName or None

        :param body:The contents of the block.
        :type body: list(NodeNG) or None
        N)r1   rk   r$   )ra   r1   rk   r$   r   r   r   rß   ¤  s    zExceptHandler.postinitc             C   s"   | j r| j jS | jr| jjS | jS )zPThe line on which the beginning of this block ends.

        :type: int
        )rk   r¤   r1   r_   )ra   r   r   r   Úblockstart_tolineno´  s
    z!ExceptHandler.blockstart_tolinenoc             C   s<   | j dks|dkrdS x | j jƒ D ]}|j|kr"dS q"W dS )zíCheck if this node handles any of the given exceptions.

        If ``exceptions`` is empty, this will default to ``True``.

        :param exceptions: The name of the exceptions to check for.
        :type exceptions: list(str)
        NTF)r1   r­   rk   )ra   r   r   r   r   r   r*   À  s    
zExceptHandler.catch)r1   rk   r$   )r$   )NNN)ry   rÓ   rÔ   rÕ   rm   Ú_multi_line_block_fieldsr1   rk   r$   r’   rß   r   rÙ   r_  r*   r   r   r   r   rñ   w  s   

rñ   c               @   s*   e Zd ZdZdZdZdZdZd	dd„ZdS )
ÚExecz‘Class representing the ``exec`` statement.

    >>> node = astroid.extract_node('exec "True"')
    >>> node
    <Exec l.1 at 0x7f0e8106c6d0>
    r)  Úglobalsrú   Nc             C   s   || _ || _|| _dS )aN  Do some setup after initialisation.

        :param expr: The expression to be executed.
        :type expr: NodeNG or None

        :param globals:The globals dictionary to execute with.
        :type globals: NodeNG or None

        :param locals: The locals dictionary to execute with.
        :type locals: NodeNG or None
        N)r)  rb  rú   )ra   r)  rb  rú   r   r   r   rß   ê  s    zExec.postinit)r)  rb  rú   )NNN)	ry   rÓ   rÔ   rÕ   rm   r)  rb  rú   rß   r   r   r   r   ra  Ð  s   ra  c               @   s"   e Zd ZdZdZdZddd„ZdS )ÚExtSlicea  Class representing an :class:`ast.ExtSlice` node.

    An :class:`ExtSlice` is a complex slice expression.

    >>> node = astroid.extract_node('l[1:3, 5]')
    >>> node
    <Subscript l.1 at 0x7f23b2e9e550>
    >>> node.slice
    <ExtSlice l.1 at 0x7f23b7b05ef0>
    ÚdimsNc             C   s
   || _ dS )zŸDo some setup after initialisation.

        :param dims: The simple dimensions that form the complete slice.
        :type dims: list(NodeNG) or None
        N)rd  )ra   rd  r   r   r   rß     s    zExtSlice.postinit)rd  )N)ry   rÓ   rÔ   rÕ   rm   rd  rß   r   r   r   r   rc  û  s   
rc  c               @   sT   e Zd ZdZdZdZdZdZdZdZ	dZ
dZddd	„Zd
Zejdd„ ƒZdd„ ZdS )ÚForz¨Class representing an :class:`ast.For` node.

    >>> node = astroid.extract_node('for thing in things: print(thing)')
    >>> node
    <For l.1 at 0x7f23b2e8cf28>
    r1  rf   r$   r%   r/  Nc             C   s"   || _ || _|| _|| _|| _dS )a±  Do some setup after initialisation.

        :param target: What the loop assigns to.
        :type target: NodeNG or None

        :param iter: What the loop iterates over.
        :type iter: NodeNG or None

        :param body: The contents of the body of the loop.
        :type body: list(NodeNG) or None

        :param orelse: The contents of the ``else`` block of the loop.
        :type orelse: list(NodeNG) or None
        N)r1  rf   r$   r%   r/  )ra   r1  rf   r$   r%   r/  r   r   r   rß   B  s
    zFor.postinitTc             C   s   | j jS )zPThe line on which the beginning of this block ends.

        :type: int
        )rf   r¤   )ra   r   r   r   r_  a  s    zFor.blockstart_tolinenoc             c   s,   | j V  | jV  | jE d H  | jE d H  d S )N)r1  rf   r$   r%   )ra   r   r   r   r’   i  s    zFor.get_children)r1  rf   r$   r%   )r/  )r$   r%   )NNNNN)ry   rÓ   rÔ   rÕ   rm   rÅ   r`  r1  rf   r$   r%   r/  rß   rÖ   r   rÙ   r_  r’   r   r   r   r   re    s   
re  c               @   s   e Zd ZdZdS )ÚAsyncFora™  Class representing an :class:`ast.AsyncFor` node.

    An :class:`AsyncFor` is an asynchronous :class:`For` built with
    the ``async`` keyword.

    >>> node = astroid.extract_node('''
    async def func(things):
        async for thing in things:
            print(thing)
    ''')
    >>> node
    <AsyncFunctionDef.func l.2 at 0x7f23b2e416d8>
    >>> node.body[0]
    <AsyncFor l.3 at 0x7f23b2e417b8>
    N)ry   rÓ   rÔ   rÕ   r   r   r   r   rf  q  s   rf  c               @   s*   e Zd ZdZdZdZd	dd„Zdd„ ZdS )
r]   a‘  Class representing an :class:`ast.Await` node.

    An :class:`Await` is the ``await`` keyword.

    >>> node = astroid.extract_node('''
    async def func(things):
        await other_func()
    ''')
    >>> node
    <AsyncFunctionDef.func l.2 at 0x7f23b2e41748>
    >>> node.body[0]
    <Expr l.3 at 0x7f23b2e419e8>
    >>> list(node.body[0].get_children())[0]
    <Await l.3 at 0x7f23b2e41a20>
    r   Nc             C   s
   || _ dS )zyDo some setup after initialisation.

        :param value: What to wait for.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß   ›  s    zAwait.postinitc             c   s   | j V  d S )N)r   )ra   r   r   r   r’   £  s    zAwait.get_children)r   )N)ry   rÓ   rÔ   rÕ   rm   r   rß   r’   r   r   r   r   r]   ƒ  s
   
c                   s&   e Zd ZdZd	Zd
‡ fdd„	Z‡  ZS )Ú
ImportFromzµClass representing an :class:`ast.ImportFrom` node.

    >>> node = astroid.extract_node('from my_package import my_module')
    >>> node
    <ImportFrom l.1 at 0x7f23b2e415c0>
    Úmodnamerp   Úlevelr   Nc                s*   || _ || _|| _tt| ƒj|||ƒ dS )a‡  
        :param fromname: The module that is being imported from.
        :type fromname: str or None

        :param names: What is being imported from the module.
        :type names: list(tuple(str, str or None))

        :param level: The level of relative import.
        :type level: int

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rh  rp   ri  rÞ   rg  rb   )ra   Úfromnamerp   ri  r_   r`   r&   )rB   r   r   rb   ±  s    		zImportFrom.__init__)rh  rp   ri  )r   NNN)ry   rÓ   rÔ   rÕ   r{   rb   rê   r   r   )rB   r   rg  §  s   rg  c                   s@   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zd	d
„ Z	‡  Z
S )Ú	Attributez2Class representing an :class:`ast.Attribute` node.r)  rl   Nc                s   || _ tt| ƒj|||ƒ dS )aº  
        :param attrname: The name of the attribute.
        :type attrname: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rl   rÞ   rk  rb   )ra   rl   r_   r`   r&   )rB   r   r   rb   ð  s    zAttribute.__init__c             C   s
   || _ dS )z‡Do some setup after initialisation.

        :param expr: The name that this node represents.
        :type expr: Name or None
        N)r)  )ra   r)  r   r   r   rß     s    zAttribute.postinitc             c   s   | j V  d S )N)r)  )ra   r   r   r   r’     s    zAttribute.get_children)r)  )rl   )NNNN)N)ry   rÓ   rÔ   rÕ   rm   r{   r)  rb   rß   r’   rê   r   r   )rB   r   rk  å  s   
rk  c                   s.   e Zd ZdZdZd	‡ fdd„	Zdd„ Z‡  ZS )
ÚGlobalzœClass representing an :class:`ast.Global` node.

    >>> node = astroid.extract_node('global a_global')
    >>> node
    <Global l.1 at 0x7f23b2e9de10>
    rp   Nc                s   || _ tt| ƒj|||ƒ dS )a»  
        :param names: The names being declared as global.
        :type names: list(str)

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rp   rÞ   rl  rb   )ra   rp   r_   r`   r&   )rB   r   r   rb     s    zGlobal.__init__c             C   s   |S )Nr   )ra   r˜   rk   r   r   r   r°   4  s    zGlobal._infer_name)rp   )NNN)ry   rÓ   rÔ   rÕ   r{   rb   r°   rê   r   r   )rB   r   rl    s   rl  c               @   sT   e Zd ZdZdZdZdZdZdZddd„Z	e
jdd	„ ƒZd
d„ Zdd„ Zdd„ ZdS )r'   zžClass representing an :class:`ast.If` node.

    >>> node = astroid.extract_node('if condition: print(True)')
    >>> node
    <If l.1 at 0x7f23b2e9dd30>
    r+  r$   r%   Nc             C   s   || _ || _|| _dS )aN  Do some setup after initialisation.

        :param test: The condition that the statement tests.
        :type test: NodeNG or None

        :param body: The contents of the block.
        :type body: list(NodeNG) or None

        :param orelse: The contents of the ``else`` block.
        :type orelse: list(NodeNG) or None
        N)r+  r$   r%   )ra   r+  r$   r%   r   r   r   rß   R  s    zIf.postinitc             C   s   | j jS )zPThe line on which the beginning of this block ends.

        :type: int
        )r+  r¤   )ra   r   r   r   r_  b  s    zIf.blockstart_tolinenoc             C   sT   || j d jkr||fS || j d jkr8|| j d jfS | j|| j| j d jd ƒS )a8  Get a range from the given line number to where this node ends.

        :param lineno: The line number to start the range at.
        :type lineno: int

        :returns: The range of line numbers that this node belongs to,
            starting at the given line number.
        :rtype: tuple(int, int)
        r   r"   r“   r“   )r$   rŠ   r¤   Ú_elsed_block_ranger%   )ra   r_   r   r   r   r§   j  s
    
zIf.block_rangec             c   s$   | j V  | jE d H  | jE d H  d S )N)r+  r$   r%   )ra   r   r   r   r’   z  s    zIf.get_childrenc             C   s   t | jƒdkot| jd tƒS )Nr"   r   )rz   r%   r   r'   )ra   r   r   r   Úhas_elif_block€  s    zIf.has_elif_block)r+  r$   r%   )r$   r%   )NNN)ry   rÓ   rÔ   rÕ   rm   r`  r+  r$   r%   rß   r   rÙ   r_  r§   r’   rn  r   r   r   r   r'   8  s   
r'   c               @   s:   e Zd ZdZdZdZdZdZddd„Zdd	„ Z	d
d„ Z
dS )rN   z¨Class representing an :class:`ast.IfExp` node.

    >>> node = astroid.extract_node('value if condition else other')
    >>> node
    <IfExp l.1 at 0x7f23b2e9dbe0>
    r+  r$   r%   Nc             C   s   || _ || _|| _dS )aN  Do some setup after initialisation.

        :param test: The condition that the statement tests.
        :type test: NodeNG or None

        :param body: The contents of the block.
        :type body: list(NodeNG) or None

        :param orelse: The contents of the ``else`` block.
        :type orelse: list(NodeNG) or None
        N)r+  r$   r%   )ra   r+  r$   r%   r   r   r   rß   �  s    zIfExp.postinitc             c   s   | j V  | jV  | jV  d S )N)r+  r$   r%   )ra   r   r   r   r’   ­  s    zIfExp.get_childrenc             C   s   dS )NFr   )ra   r   r   r   rÒ   ²  s    zIfExp.op_left_associative)r+  r$   r%   )NNN)ry   rÓ   rÔ   rÕ   rm   r+  r$   r%   rß   r’   rÒ   r   r   r   r   rN   „  s   
c                   s&   e Zd ZdZdZd‡ fdd„	Z‡  ZS )ÚImportz›Class representing an :class:`ast.Import` node.

    >>> node = astroid.extract_node('import astroid')
    >>> node
    <Import l.1 at 0x7f23b2e4e5c0>
    rp   Nc                s   || _ tt| ƒj|||ƒ dS )aÍ  
        :param names: The names being imported.
        :type names: list(tuple(str, str or None)) or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rp   rÞ   ro  rb   )ra   rp   r_   r`   r&   )rB   r   r   rb   Â  s    	zImport.__init__)rp   )NNNN)ry   rÓ   rÔ   rÕ   r{   rb   rê   r   r   )rB   r   ro  ¸  s   ro  c               @   s*   e Zd ZdZdZdZd	dd„Zdd„ ZdS )
ÚIndexzûClass representing an :class:`ast.Index` node.

    An :class:`Index` is a simple subscript.

    >>> node = astroid.extract_node('things[1]')
    >>> node
    <Subscript l.1 at 0x7f23b2e9e2b0>
    >>> node.slice
    <Index l.1 at 0x7f23b2e9e6a0>
    r   Nc             C   s
   || _ dS )z„Do some setup after initialisation.

        :param value: The value to subscript with.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß   ð  s    zIndex.postinitc             c   s   | j V  d S )N)r   )ra   r   r   r   r’   ø  s    zIndex.get_children)r   )N)ry   rÓ   rÔ   rÕ   rm   r   rß   r’   r   r   r   r   rp  Ý  s
   

rp  c                   s@   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zd	d
„ Z	‡  Z
S )ÚKeywordzÞClass representing an :class:`ast.keyword` node.

    >>> node = astroid.extract_node('function(a_kwarg=True)')
    >>> node
    <Call l.1 at 0x7f23b2e9e320>
    >>> node.keywords
    [<Keyword l.1 at 0x7f23b2e9e9b0>]
    r   r!  Nc                s   || _ tt| ƒj|||ƒ dS )a¶  
        :param arg: The argument being assigned to.
        :type arg: Name or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)r!  rÞ   rq  rb   )ra   r!  r_   r`   r&   )rB   r   r   rb     s    zKeyword.__init__c             C   s
   || _ dS )z™Do some setup after initialisation.

        :param value: The value being assigned to the ketword argument.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß   %  s    zKeyword.postinitc             c   s   | j V  d S )N)r   )ra   r   r   r   r’   -  s    zKeyword.get_children)r   )r!  )NNNN)N)ry   rÓ   rÔ   rÕ   rm   r{   r   rb   rß   r’   rê   r   r   )rB   r   rq  ü  s   
rq  c                   s8   e Zd ZdZd
Zd‡ fdd„	Zdd„ Zddd	„Z‡  ZS )r   z—Class representing an :class:`ast.List` node.

    >>> node = astroid.extract_node('[1, 2, 3]')
    >>> node
    <List.list l.1 at 0x7f23b2e9e128>
    ÚctxNc                s   || _ tt| ƒj|||ƒ dS )aÉ  
        :param ctx: Whether the list is assigned to or loaded from.
        :type ctx: Context or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rr  rÞ   r   rb   )ra   rr  r_   r`   r&   )rB   r   r   rb   ;  s    zList.__init__c             C   s   dt  S )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        z%s.list)rY  )ra   r   r   r   ræ   R  s    zList.pytypec             C   s   t | | j||d�S )z…Get an item from this node.

        :param index: The node to use as a subscript index.
        :type index: Const or Slice
        )r   )rH   r   )ra   r4   r   r   r   r   rN  Z  s    zList.getitem)rr  )NNNN)N)	ry   rÓ   rÔ   rÕ   r{   rb   ræ   rN  rê   r   r   )rB   r   r   1  s
   r   c                   s.   e Zd ZdZdZd	‡ fdd„	Zdd„ Z‡  ZS )
ÚNonlocala	  Class representing an :class:`ast.Nonlocal` node.

    >>> node = astroid.extract_node('''
    def function():
        nonlocal var
    ''')
    >>> node
    <FunctionDef.function l.2 at 0x7f23b2e9e208>
    >>> node.body[0]
    <Nonlocal l.3 at 0x7f23b2e9e908>
    rp   Nc                s   || _ tt| ƒj|||ƒ dS )a¾  
        :param names: The names being declared as not local.
        :type names: list(str)

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rp   rÞ   rs  rb   )ra   rp   r_   r`   r&   )rB   r   r   rb   r  s    zNonlocal.__init__c             C   s   |S )Nr   )ra   r˜   rk   r   r   r   r°   ‰  s    zNonlocal._infer_name)rp   )NNN)ry   rÓ   rÔ   rÕ   r{   rb   r°   rê   r   r   )rB   r   rs  c  s   rs  c               @   s   e Zd ZdZdS )ÚPassz�Class representing an :class:`ast.Pass` node.

    >>> node = astroid.extract_node('pass')
    >>> node
    <Pass l.1 at 0x7f23b2e9e748>
    N)ry   rÓ   rÔ   rÕ   r   r   r   r   rt  �  s   rt  c                   s8   e Zd ZdZd	ZdZdZd
‡ fdd„	Zddd„Z‡  Z	S )ÚPrintzœClass representing an :class:`ast.Print` node.

    >>> node = astroid.extract_node('print "A message"')
    >>> node
    <Print l.1 at 0x7f0e8101d290>
    Údestr%  Nc                s   || _ tt| ƒj|||ƒ dS )a±  
        :param nl: Whether to print a new line.
        :type nl: bool or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)ÚnlrÞ   ru  rb   )ra   rw  r_   r`   r&   )rB   r   r   rb   ª  s    zPrint.__init__c             C   s   || _ || _dS )zÊDo some setup after initialisation.

        :param dest: Where to print to.
        :type dest: NodeNG or None

        :param values: What to print.
        :type values: list(NodeNG) or None
        N)rv  r%  )ra   rv  r%  r   r   r   rß   Á  s    	zPrint.postinit)rv  r%  )NNNN)NN)
ry   rÓ   rÔ   rÕ   rm   rv  r%  rb   rß   rê   r   r   )rB   r   ru  –  s   ru  c               @   s6   e Zd ZdZdZdZdZddd„Zdd„ Zd	d
„ Z	dS )ÚRaisez¸Class representing an :class:`ast.Raise` node.

    >>> node = astroid.extract_node('raise RuntimeError("Something bad happened!")')
    >>> node
    <Raise l.1 at 0x7f23b2e9e828>
    NrG   Úcausec             C   s   || _ || _dS )zàDo some setup after initialisation.

        :param exc: What is being raised.
        :type exc: NodeNG or None

        :param cause: The exception being used to raise this one.
        :type cause: NodeNG or None
        N)rG   ry  )ra   rG   ry  r   r   r   rß   â  s    	zRaise.postinitc             C   s0   | j s
dS x | j jƒ D ]}|jdkrdS qW dS )zÀCheck if this node raises a :class:`NotImplementedError`.

        :returns: True if this node raises a :class:`NotImplementedError`,
            False otherwise.
        :rtype: bool
        Fr4  T)rG   r­   rk   )ra   rk   r   r   r   Úraises_not_implementedî  s    
zRaise.raises_not_implementedc             c   s(   | j d k	r| j V  | jd k	r$| jV  d S )N)rG   ry  )ra   r   r   r   r’   ü  s    

zRaise.get_children)rG   ry  )NN)
ry   rÓ   rÔ   rÕ   rG   rm   ry  rß   rz  r’   r   r   r   r   rx  Î  s   
rx  c               @   s:   e Zd ZdZdZdZddd„Zdd„ Zdd	„ Zd
d„ Z	dS )ÚReturnz˜Class representing an :class:`ast.Return` node.

    >>> node = astroid.extract_node('return True')
    >>> node
    <Return l.1 at 0x7f23b8211908>
    r   Nc             C   s
   || _ dS )z�Do some setup after initialisation.

        :param value: The value being returned.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß     s    zReturn.postinitc             c   s   | j d k	r| j V  d S )N)r   )ra   r   r   r   r’     s    
zReturn.get_childrenc             C   s   t | jtƒS )N)r   r   r   )ra   r   r   r   Úis_tuple_return  s    zReturn.is_tuple_returnc             c   s
   | V  d S )Nr   )ra   r   r   r   r®   "  s    z'Return._get_return_nodes_skip_functions)r   )N)
ry   rÓ   rÔ   rÕ   rm   r   rß   r’   r|  r®   r   r   r   r   r{    s   
r{  c               @   s   e Zd ZdZdd„ ZdS )ÚSetz”Class representing an :class:`ast.Set` node.

    >>> node = astroid.extract_node('{1, 2, 3}')
    >>> node
    <Set.set l.1 at 0x7f23b2e71d68>
    c             C   s   dt  S )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        z%s.set)rY  )ra   r   r   r   ræ   .  s    z
Set.pytypeN)ry   rÓ   rÔ   rÕ   ræ   r   r   r   r   r}  &  s   r}  c               @   sd   e Zd ZdZdZdZdZdZddd„Zdd	„ Z	e
jd
d„ ƒZdd„ Zddd„Zddd„Zdd„ ZdS )rA   zÏClass representing an :class:`ast.Slice` node.

    >>> node = astroid.extract_node('things[1:3]')
    >>> node
    <Subscript l.1 at 0x7f23b2e71f60>
    >>> node.slice
    <Slice l.1 at 0x7f23b2e71e80>
    r:   r;   r<   Nc             C   s   || _ || _|| _dS )a:  Do some setup after initialisation.

        :param lower: The lower index in the slice.
        :value lower: NodeNG or None

        :param upper: The upper index in the slice.
        :value upper: NodeNG or None

        :param step: The step to take between index.
        :param step: NodeNG or None
        N)r:   r;   r<   )ra   r:   r;   r<   r   r   r   rß   R  s    zSlice.postinitc             C   s   |st |ƒ}| |_|S |S )z7Wrap the empty attributes of the Slice in a Const node.)rà   r&   )ra   r‘   Úconstr   r   r   Ú_wrap_attributeb  s
    zSlice._wrap_attributec             C   s   t j}|jdƒd S )Nr>   r   )rg   Zbuiltins_modulero   )ra   Úbuiltinsr   r   r   rP  j  s    zSlice._proxiedc             C   s   dt  S )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        z%s.slice)rY  )ra   r   r   r   ræ   o  s    zSlice.pytypec             c   s`   |dkr| j | jƒV  nD|dkr0| j | jƒV  n,|dkrH| j | jƒV  n| j||d�E dH  dS )zóInfer the possible values of the given attribute on the slice.

        :param attrname: The name of the attribute to infer.
        :type attrname: str

        :returns: The inferred possible values.
        :rtype: iterable(NodeNG)
        ÚstartÚstopr<   )r   N)r  r:   r;   r<   ro   )ra   rl   r   r   r   r   Úigetattrw  s    	zSlice.igetattrc             C   s   | j j||ƒS )N)rP  ro   )ra   rl   r   r   r   r   ro   ‰  s    zSlice.getattrc             c   s:   | j d k	r| j V  | jd k	r$| jV  | jd k	r6| jV  d S )N)r:   r;   r<   )ra   r   r   r   r’   Œ  s    


zSlice.get_children)r:   r;   r<   )NNN)N)N)ry   rÓ   rÔ   rÕ   rm   r:   r;   r<   rß   r  r   rÙ   rP  ræ   rƒ  ro   r’   r   r   r   r   rA   7  s   


rA   c                   s@   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zd	d
„ Z	‡  Z
S )rB  z”Class representing an :class:`ast.Starred` node.

    >>> node = astroid.extract_node('*args')
    >>> node
    <Starred l.1 at 0x7f23b2e41978>
    r   rr  Nc                s    || _ tt| ƒj|||d� dS )aÉ  
        :param ctx: Whether the list is assigned to or loaded from.
        :type ctx: Context or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        )r_   r`   r&   N)rr  rÞ   rB  rb   )ra   rr  r_   r`   r&   )rB   r   r   rb   §  s    
zStarred.__init__c             C   s
   || _ dS )zDo some setup after initialisation.

        :param value: What is being unpacked.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß   À  s    zStarred.postinitc             c   s   | j V  d S )N)r   )ra   r   r   r   r’   È  s    zStarred.get_children)r   )rr  )NNNN)N)ry   rÓ   rÔ   rÕ   rm   r{   r   rb   rß   r’   rê   r   r   )rB   r   rB  —  s   
rB  c                   sD   e Zd ZdZdZdZdZdZd‡ fdd„	Zddd	„Z	d
d„ Z
‡  ZS )Ú	SubscriptzžClass representing an :class:`ast.Subscript` node.

    >>> node = astroid.extract_node('things[1:3]')
    >>> node
    <Subscript l.1 at 0x7f23b2e71f60>
    r   r>   rr  Nc                s    || _ tt| ƒj|||d� dS )aÕ  
        :param ctx: Whether the subscripted item is assigned to or loaded from.
        :type ctx: Context or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        )r_   r`   r&   N)rr  rÞ   r„  rb   )ra   rr  r_   r`   r&   )rB   r   r   rb   á  s    
zSubscript.__init__c             C   s   || _ || _dS )zÙDo some setup after initialisation.

        :param value: What is being indexed.
        :type value: NodeNG or None

        :param slice: The slice being used to lookup.
        :type slice: NodeNG or None
        N)r   r>   )ra   r   r>   r   r   r   rß   û  s    	zSubscript.postinitc             c   s   | j V  | jV  d S )N)r   r>   )ra   r   r   r   r’     s    zSubscript.get_children)r   r>   )rr  )NNNN)NN)ry   rÓ   rÔ   rÕ   rm   r{   r   r>   rb   rß   r’   rê   r   r   )rB   r   r„  Ì  s   
r„  c               @   sF   e Zd ZdZdZdZdZdZdZddd„Z	dd	„ Z
d
d„ Zdd„ ZdS )r)   a  Class representing an :class:`ast.TryExcept` node.

    >>> node = astroid.extract_node('''
        try:
            do_something()
        except Exception as error:
            print("Error!")
        ''')
    >>> node
    <TryExcept l.2 at 0x7f23b2e9d908>
    r$   r#   r%   Nc             C   s   || _ || _|| _dS )al  Do some setup after initialisation.

        :param body: The contents of the block to catch exceptions from.
        :type body: list(NodeNG) or None

        :param handlers: The exception handlers.
        :type handlers: list(ExceptHandler) or None

        :param orelse: The contents of the ``else`` block.
        :type orelse: list(NodeNG) or None
        N)r$   r#   r%   )ra   r$   r#   r%   r   r   r   rß   +  s    zTryExcept.postinitc             C   s   |S )Nr   )ra   r˜   rk   r   r   r   r°   ;  s    zTryExcept._infer_namec             C   sŽ   d}xx| j D ]n}|jr*||jjkr*||fS |jd j|  koL|jd jkn  rb||jd jfS |dkr|jd jd }qW | j|| j|ƒS )a8  Get a range from the given line number to where this node ends.

        :param lineno: The line number to start the range at.
        :type lineno: int

        :returns: The range of line numbers that this node belongs to,
            starting at the given line number.
        :rtype: tuple(int, int)
        Nr   r"   r“   r“   )r#   r1   rŠ   r$   r¤   rm  r%   )ra   r_   ÚlastZ	exhandlerr   r   r   r§   >  s    
(zTryExcept.block_rangec             c   s0   | j E d H  | jpf E d H  | jp$f E d H  d S )N)r$   r#   r%   )ra   r   r   r   r’   R  s    zTryExcept.get_children)r$   r#   r%   )r$   r#   r%   )NNN)ry   rÓ   rÔ   rÕ   rm   r`  r$   r#   r%   rß   r°   r§   r’   r   r   r   r   r)     s   
r)   c               @   s:   e Zd ZdZdZdZdZdZddd„Zdd„ Z	d	d
„ Z
dS )Ú
TryFinallya  Class representing an :class:`ast.TryFinally` node.

    >>> node = astroid.extract_node('''
    try:
        do_something()
    except Exception as error:
        print("Error!")
    finally:
        print("Cleanup!")
    ''')
    >>> node
    <TryFinally l.2 at 0x7f23b2e41d68>
    r$   Ú	finalbodyNc             C   s   || _ || _dS )a  Do some setup after initialisation.

        :param body: The try-except that the finally is attached to.
        :type body: list(TryExcept) or None

        :param finalbody: The contents of the ``finally`` block.
        :type finalbody: list(NodeNG) or None
        N)r$   r‡  )ra   r$   r‡  r   r   r   rß   u  s    	zTryFinally.postinitc             C   sT   | j d }t|tƒrF|j| jkrF|j|  ko6| jkn  rF|j|ƒS | j|| jƒS )a8  Get a range from the given line number to where this node ends.

        :param lineno: The line number to start the range at.
        :type lineno: int

        :returns: The range of line numbers that this node belongs to,
            starting at the given line number.
        :rtype: tuple(int, int)
        r   )r$   r   r)   rŠ   r¤   r§   rm  r‡  )ra   r_   r�   r   r   r   r§   �  s    



zTryFinally.block_rangec             c   s   | j E d H  | jE d H  d S )N)r$   r‡  )ra   r   r   r   r’   •  s    zTryFinally.get_children)r$   r‡  )r$   r‡  )NN)ry   rÓ   rÔ   rÕ   rm   r`  r$   r‡  rß   r§   r’   r   r   r   r   r†  Y  s   
r†  c                   s8   e Zd ZdZd
Zd‡ fdd„	Zdd„ Zddd	„Z‡  ZS )r   zšClass representing an :class:`ast.Tuple` node.

    >>> node = astroid.extract_node('(1, 2, 3)')
    >>> node
    <Tuple.tuple l.1 at 0x7f23b2e41780>
    rr  Nc                s   || _ tt| ƒj|||ƒ dS )aÊ  
        :param ctx: Whether the tuple is assigned to or loaded from.
        :type ctx: Context or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rr  rÞ   r   rb   )ra   rr  r_   r`   r&   )rB   r   r   rb   ¤  s    zTuple.__init__c             C   s   dt  S )zyGet the name of the type that this node represents.

        :returns: The name of the type.
        :rtype: str
        z%s.tuple)rY  )ra   r   r   r   ræ   »  s    zTuple.pytypec             C   s   t | | j||d�S )z…Get an item from this node.

        :param index: The node to use as a subscript index.
        :type index: Const or Slice
        )r   )rH   r   )ra   r4   r   r   r   r   rN  Ã  s    zTuple.getitem)rr  )NNNN)N)	ry   rÓ   rÔ   rÕ   r{   rb   ræ   rN  rê   r   r   )rB   r   r   š  s
   r   c                   s`   e Zd ZdZdZdZdZd‡ fdd„	Zddd„Zdd	d
„Z	ddd„Z
dd„ Z‡ fdd„Z‡  ZS )r\   z‘Class representing an :class:`ast.UnaryOp` node.

    >>> node = astroid.extract_node('-5')
    >>> node
    <UnaryOp l.1 at 0x7f23b2e4e198>
    ÚoperandrK   Nc                s   || _ tt| ƒj|||ƒ dS )až  
        :param op: The operator.
        :type: str or None

        :param lineno: The line that this node appears on in the source code.
        :type lineno: int or None

        :param col_offset: The column that this node appears on in the
            source code.
        :type col_offset: int or None

        :param parent: The parent node in the syntax tree.
        :type parent: NodeNG or None
        N)rK   rÞ   r\   rb   )ra   rK   r_   r`   r&   )rB   r   r   rb   Ü  s    zUnaryOp.__init__c             C   s
   || _ dS )z’Do some setup after initialisation.

        :param operand: What the unary operator is applied to.
        :type operand: NodeNG or None
        N)rˆ  )ra   rˆ  r   r   r   rß   ó  s    zUnaryOp.postinitc             C   s   t ‚d S )N)r4  )ra   r   r   r   r   Ú_infer_unaryopü  s    zUnaryOp._infer_unaryopc             C   s6   y| j |d�}dd„ |D ƒS  tjk
r0   g S X dS )a%  Get a list of type errors which can occur during inference.

        Each TypeError is represented by a :class:`BadBinaryOperationMessage`,
        which holds the original exception.

        :returns: The list of possible type errors.
        :rtype: list(BadBinaryOperationMessage)
        )r   c             S   s   g | ]}t |tjƒr|‘qS r   )r   r   ZBadUnaryOperationMessage)r6   rƒ   r   r   r   r·     s   z'UnaryOp.type_errors.<locals>.<listcomp>N)r‰  r   r2   )ra   r   r7  r   r   r   r8  ÿ  s    	zUnaryOp.type_errorsc             c   s   | j V  d S )N)rˆ  )ra   r   r   r   r’     s    zUnaryOp.get_childrenc                s   | j dkrt| j  S tƒ jƒ S )NrQ   )rK   rÐ   rÞ   rÑ   )ra   )rB   r   r   rÑ     s    

zUnaryOp.op_precedence)rˆ  )rK   )NNNN)N)N)N)ry   rÓ   rÔ   rÕ   rm   r{   rˆ  rb   rß   r‰  r8  r’   rÑ   rê   r   r   )rB   r   r\   Ì  s   
	

c               @   sL   e Zd ZdZdZdZdZdZdZddd„Z	e
jdd	„ ƒZd
d„ Zdd„ ZdS )ÚWhilezÁClass representing an :class:`ast.While` node.

    >>> node = astroid.extract_node('''
    while condition():
        print("True")
    ''')
    >>> node
    <While l.2 at 0x7f23b2e4e390>
    r+  r$   r%   Nc             C   s   || _ || _|| _dS )aH  Do some setup after initialisation.

        :param test: The condition that the loop tests.
        :type test: NodeNG or None

        :param body: The contents of the loop.
        :type body: list(NodeNG) or None

        :param orelse: The contents of the ``else`` block.
        :type orelse: list(NodeNG) or None
        N)r+  r$   r%   )ra   r+  r$   r%   r   r   r   rß   9  s    zWhile.postinitc             C   s   | j jS )zPThe line on which the beginning of this block ends.

        :type: int
        )r+  r¤   )ra   r   r   r   r_  I  s    zWhile.blockstart_tolinenoc             C   s   | j || jƒS )a8  Get a range from the given line number to where this node ends.

        :param lineno: The line number to start the range at.
        :type lineno: int

        :returns: The range of line numbers that this node belongs to,
            starting at the given line number.
        :rtype: tuple(int, int)
        )rm  r%   )ra   r_   r   r   r   r§   Q  s    
zWhile.block_rangec             c   s$   | j V  | jE d H  | jE d H  d S )N)r+  r$   r%   )ra   r   r   r   r’   ]  s    zWhile.get_children)r+  r$   r%   )r$   r%   )NNN)ry   rÓ   rÔ   rÕ   rm   r`  r+  r$   r%   rß   r   rÙ   r_  r§   r’   r   r   r   r   rŠ    s   	
rŠ  c               @   sH   e Zd ZdZdZdZdZdZdZdZ	ddd„Z
ejdd	„ ƒZd
d„ ZdS )ÚWithzÑClass representing an :class:`ast.With` node.

    >>> node = astroid.extract_node('''
    with open(file_path) as file_:
        print(file_.read())
    ''')
    >>> node
    <With l.2 at 0x7f23b2e4e710>
    rV  r$   r/  Nc             C   s   || _ || _|| _dS )a9  Do some setup after initialisation.

        :param items: The pairs of context managers and the names
            they are assigned to.
        :type items: list(tuple(NodeNG, AssignName or None)) or None

        :param body: The contents of the ``with`` block.
        :type body: list(NodeNG) or None
        N)rV  r$   r/  )ra   rV  r$   r/  r   r   r   rß   ‡  s    
zWith.postinitc             C   s   | j d d jS )zPThe line on which the beginning of this block ends.

        :type: int
        r"   r   r“   )rV  r¤   )ra   r   r   r   r_  •  s    zWith.blockstart_tolinenoc             c   s4   x"| j D ]\}}|V  |r|V  qW | jE dH  dS )zoGet the child nodes below this node.

        :returns: The children.
        :rtype: iterable(NodeNG)
        N)rV  r$   )ra   r)  Úvarr   r   r   r’   �  s
    
zWith.get_children)rV  r$   )r/  )r$   )NNN)ry   rÓ   rÔ   rÕ   rm   rÅ   r`  rV  r$   r/  rß   r   rÙ   r_  r’   r   r   r   r   r‹  d  s   
r‹  c               @   s   e Zd ZdZdS )Ú	AsyncWithz7Asynchronous ``with`` built with the ``async`` keyword.N)ry   rÓ   rÔ   rÕ   r   r   r   r   r�  ª  s   r�  c               @   s2   e Zd ZdZd
ZdZddd„Zdd„ Zdd	„ ZdS )ÚYieldz•Class representing an :class:`ast.Yield` node.

    >>> node = astroid.extract_node('yield True')
    >>> node
    <Yield l.1 at 0x7f23b2e4e5f8>
    r   Nc             C   s
   || _ dS )z{Do some setup after initialisation.

        :param value: The value to yield.
        :type value: NodeNG or None
        N)r   )ra   r   r   r   r   rß   ½  s    zYield.postinitc             c   s   | j d k	r| j V  d S )N)r   )ra   r   r   r   r’   Å  s    
zYield.get_childrenc             c   s
   | V  d S )Nr   )ra   r   r   r   r¯   É  s    z#Yield._get_yield_nodes_skip_lambdas)r   )N)	ry   rÓ   rÔ   rÕ   rm   r   rß   r’   r¯   r   r   r   r   rŽ  ®  s   
rŽ  c               @   s   e Zd ZdZdS )Ú	YieldFromz2Class representing an :class:`ast.YieldFrom` node.N)ry   rÓ   rÔ   rÕ   r   r   r   r   r�  Í  s   r�  c               @   s   e Zd ZdZdS )rZ  z>Represents the unpacking of dicts into dicts using :pep:`448`.N)ry   rÓ   rÔ   rÕ   r   r   r   r   rZ  Ñ  s   rZ  c               @   s2   e Zd ZdZd	ZdZdZdZd
dd„Zdd„ Z	dS )ÚFormattedValuea9  Class representing an :class:`ast.FormattedValue` node.

    Represents a :pep:`498` format string.

    >>> node = astroid.extract_node('f"Format {type_}"')
    >>> node
    <JoinedStr l.1 at 0x7f23b2e4ed30>
    >>> node.values
    [<Const.str l.1 at 0x7f23b2e4eda0>, <FormattedValue l.1 at 0x7f23b2e4edd8>]
    r   Úformat_specNc             C   s   || _ || _|| _dS )at  Do some setup after initialisation.

        :param value: The value to be formatted into the string.
        :type value: NodeNG

        :param conversion: The type of formatting to be applied to the value.
        :type conversion: int or None

        :param format_spec: The formatting to be applied to the value.
        :type format_spec: JoinedStr or None
        N)r   Ú
conversionr‘  )ra   r   r’  r‘  r   r   r   rß   ø  s    zFormattedValue.postinitc             c   s   | j V  | jd k	r| jV  d S )N)r   r‘  )ra   r   r   r   r’     s    
zFormattedValue.get_children)r   r‘  )NN)
ry   rÓ   rÔ   rÕ   rm   r   r’  r‘  rß   r’   r   r   r   r   r�  Õ  s   
	
r�  c               @   s*   e Zd ZdZdZdZd	dd„Zdd„ ZdS )
Ú	JoinedStrz§Represents a list of string expressions to be joined.

    >>> node = astroid.extract_node('f"Format {type_}"')
    >>> node
    <JoinedStr l.1 at 0x7f23b2e4ed30>
    r%  Nc             C   s
   || _ dS )zžDo some setup after initialisation.

        :param value: The string expressions to be joined.

        :type: list(FormattedValue or Const) or None
        N)r%  )ra   r%  r   r   r   rß     s    zJoinedStr.postinitc             c   s   | j E d H  d S )N)r%  )ra   r   r   r   r’   '  s    zJoinedStr.get_children)r%  )N)ry   rÓ   rÔ   rÕ   rm   r%  rß   r’   r   r   r   r   r“    s
   
	r“  c               @   s$   e Zd ZdZdZdZdZdd„ ZdS )rü   z²Represents the assignment from the assignment expression

    >>> module = astroid.parse('if a := 1: pass')
    >>> module.body[0].test
    <NamedExpr l.1 at 0x7f23b2e4ed30>
    r1  r   Nc             C   s   || _ || _d S )N)r1  r   )ra   r1  r   r   r   r   rß   ?  s    zNamedExpr.postinit)r1  r   )ry   rÓ   rÔ   rÕ   rm   r1  r   rß   r   r   r   r   rü   +  s
   rü   c               @   s&   e Zd ZdZd Zdd„ Zddd„ZdS )ÚUnknownzßThis node represents a node in a constructed AST where
    introspection is not possible.  At the moment, it's only used in
    the args attribute of FunctionDef nodes where function signature
    introspection failed.
    c             C   s   dS )Nr”  r   )ra   r   r   r   rþ   M  s    zUnknown.qnameNc             k   s   t jV  dS )z4Inference on an Unknown node immediately terminates.N)r   r   )ra   r   rh   r   r   r   r   P  s    zUnknown.infer)N)ry   rÓ   rÔ   rÕ   rk   rþ   r   r   r   r   r   r”  D  s   r”  .c              C   s*   t tttttf} x| D ]}tt|< qW dS )z?update constant classes, so the keys of CONST_CLS can be reusedN)rå   r0   ÚfloatÚcomplexrL  rM  r/   r   )ZklassesZklsr   r   r   Ú_update_const_classesc  s    
r—  c             C   s   | ƒ }|j |ƒ |S )N)rß   )râ   r   rF   r   r   r   Ú_two_step_initializationm  s    
r˜  c             C   s    t |tƒrt|jƒ ƒ}t| |ƒS )N)r   r   r   rV  r˜  )râ   r   r   r   r   Ú_dict_initializations  s    
r™  c             C   s   | |ƒS )Nr   )râ   r   r   r   r   Ú<lambda>~  s    rš  c             C   sr   t | tƒ st‚t | ttttfƒr(g }n| }yt| j }t	| }|||ƒS  t
tfk
rl   tƒ }| |_|S X dS )z)return an astroid node for a python valueN)r   r^   r÷   r�   rÍ   r   r   r   rB   Ú_CONST_CLS_CONSTRUCTORSÚKeyErrorrI  r]  r^  )r   r   Zinitializer_clsZinitializerr   r   r   r   rà   ‚  s    

rà   c             C   s,   | j }x |dk	r&t|tƒrdS |j }qW dS )z9Return True if the given node is the child of a decoratorNTF)r&   r   rR  )r   r&   r   r   r   rø   ž  s    


rø   )r   r   )N)N)N)N)N)F)NN)€rÕ   rè   r€  Zbuiltins_modr  r|   ÚsysÚ	functoolsr   r   rË   Zastroidr   r   r   rï   r   r   r	   r
   r   ry   rY  ZAstroidManagerrg   Úversion_infoZPY38r   Zraise_if_nothing_inferredr   r.   r^  r3   r5   r@   rH   r  rÐ   r^   rÛ   ZParentAssignTypeMixinZInstanceÚABCMetarÝ   rì   ZNoChildrenMixinrÿ   r   r  ZAssignTypeMixinr  r  r  r(  r*  r-  r0  r3  r9  r:  r>  r?  r@  rR   rF  r/   rQ  rR  rS  rT  rU  r[  r\  r]  ZMultiLineBlockMixinrñ   ra  rc  ZBlockRangeMixInre  rf  r]   ZImportFromMixinrg  rk  rl  r'   rN   ro  rp  rq  r   rs  rt  ru  rx  r{  r}  rA   rB  r„  r)   r†  r   r\   rŠ  r‹  r�  rŽ  r�  rZ  r�  r“  rü   r”  r�   r   r   rÍ   r1   ÚNotImplementedr   r—  r˜  r™  r›  rà   rø   r   r   r   r   Ú<module>   s,  
L


     $#
O J
*
'/  [

7)7>Y]8	E>e}	-5 
$Y+
V$>.%L4%52*	86"`5@MA2PH
B: