Ë
    Kæõi—’  ã                   óä  — d Z ddlZddlmZ ddlmZmZ ddlmZm	Z	m
Z
mZmZmZ ddlmZ ddlmZ  eg d¢«      Z ed	d
g«      ez  Z eg d¢«      ez  Z eg d¢«      Z eddg«      Z G d„ d«      Z G d„ d«      Z G d„ dee
«      Z G d„ de«      Z G d„ dee	«      Z G d„ dee«      Z G d„ dee«      Z G d„ dee«      Z G d„ d e«      Z  G d!„ d"e«      Z! G d#„ d$e«      Z" G d%„ d&e«      Z# G d'„ d(e#«      Z$ G d)„ d*e#«      Z% G d+„ d,e«      Z& G d-„ d.e«      Z' G d/„ d0e«      Z( G d1„ d2«      Z) G d3„ d4ee)«      Z* G d5„ d6ee)«      Z+ G d7„ d8ee«      Z, G d9„ d:e,«      Z- G d;„ d<e«      Z. G d=„ d>e,«      Z/ G d?„ d@e/«      Z0dA„ Z1 G dB„ dCe/«      Z2 G dD„ dEe2«      Z3 G dF„ dGe«      Z4 G dH„ dIe4«      Z5 G dJ„ dKe4«      Z6 G dL„ dMe4«      Z7 G dN„ dOe4«      Z8 G dP„ dQe4«      Z9 G dR„ dSe«      Z: G dT„ dUe:«      Z; G dV„ dWe:«      Z< G dX„ dYe«      Z= G dZ„ d[e=«      Z> G d\„ d]e=«      Z? G d^„ d_e=«      Z@ G d`„ dae«      ZAdb„ ZB G dc„ ddee«      ZC G de„ dfe«      ZD G dg„ dhe«      ZE G di„ dje«      ZFeFZG G dk„ dle«      ZHy)ma  
This is the syntax tree for Python 3 syntaxes. The classes represent
syntax elements like functions and imports.

All of the nodes can be traced back to the `Python grammar file
<https://docs.python.org/3/reference/grammar.html>`_. If you want to know how
a tree is structured, just analyse that file (for each Python version it's a
bit different).

There's a lot of logic here that makes it easier for Jedi (and other libraries)
to deal with a Python syntax tree.

By using :py:meth:`parso.tree.NodeOrLeaf.get_code` on a module, you can get
back the 1-to-1 representation of the input given to the parser. This is
important if you want to refactor a parser tree.

>>> from parso import parse
>>> parser = parse('import os')
>>> module = parser.get_root_node()
>>> module
<Module: @1-1>

Any subclasses of :class:`Scope`, including :class:`Module` has an attribute
:attr:`iter_imports <Scope.iter_imports>`:

>>> list(module.iter_imports())
[<ImportName: import os@1,0>]

Changes to the Python Grammar
-----------------------------

A few things have changed when looking at Python grammar files:

- :class:`Param` does not exist in Python grammar files. It is essentially a
  part of a ``parameters`` node.  |parso| splits it up to make it easier to
  analyse parameters. However this just makes it easier to deal with the syntax
  tree, it doesn't actually change the valid syntax.
- A few nodes like `lambdef` and `lambdef_nocond` have been merged in the
  syntax tree to make it easier to do deal with them.

Parser Tree Classes
-------------------
é    N)ÚMapping)ÚTupleÚAny)ÚNodeÚBaseNodeÚLeafÚ	ErrorNodeÚ	ErrorLeafÚsearch_ancestor)Úsplit_prefix)Úsplit_lines)Úif_stmtÚ
while_stmtÚfor_stmtÚtry_stmtÚ	with_stmtÚ
async_stmtÚsuiter   Úsimple_stmt)r   r   Ú	decoratedÚasync_funcdef)	Ú	expr_stmtÚsync_comp_forr   r   Úimport_nameÚimport_fromÚparamÚdel_stmtÚnamedexpr_testr   r   c                   ó6   — e Zd ZU dZeed<   ded<   eed<   d„ Zy)ÚDocstringMixin© Útypeú	list[Any]ÚchildrenÚparentc                 óÌ  — | j                   dk(  r| j                  d   }n–| j                   dv rJ| j                  | j                  j                  d«      dz      }|j                   dk(  rN|j                  d   }n>| j                  }|j                  j                  }|j                  |«      }|sy||dz
     }|j                   dk(  r|j                  d   }|j                   d	k(  r|S y)
zN
        Returns the string leaf of a docstring. e.g. ``r'''foo'''``.
        Ú
file_inputr   ©ÚfuncdefÚclassdefÚ:é   r   Nr   Ústring)r"   r$   Úindexr%   )ÚselfÚnoder   Úcr.   s        úb/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/parso/python/tree.pyÚget_doc_nodezDocstringMixin.get_doc_nodeJ   sÐ   € ð �9‰9˜Ò$Ø—=‘= Ñ#‰DØ�Y‰YÐ1Ñ1Ø—=‘= §¡×!4Ñ!4°SÓ!9¸AÑ!=Ñ>ˆDØ�y‰y˜GÒ#Ø—}‘} QÑ'‘àŸ+™+ˆKØ×"Ñ"×+Ñ+ˆAØ—G‘G˜KÓ(ˆEÙØØ�U˜Q‘Y‘<ˆDà�9‰9˜Ò%Ø—=‘= Ñ#ˆDØ�9‰9˜Ò ØˆKØó    N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__ÚstrÚ__annotations__r   r3   r!   r4   r2   r    r    D   s   … Ø€IØ
ƒIØÓØƒKór4   r    c                   ó&   — e Zd ZU dZdZded<   d„ Zy)ÚPythonMixinz)
    Some Python specific utilities.
    r!   r#   r$   c                 óà   — | j                   D ]_  }t        |t        «      r6|j                  dk(  sŒ#|j                  |cxk  r|j
                  k  sŒC|c S  ŒI|j                  |«      }|€Œ]|c S  y)z„
        Given a (line, column) tuple, returns a :py:class:`Name` or ``None`` if
        there is no name at that position.
        ÚnameN)r$   Ú
isinstancer   r"   Ú	start_posÚend_posÚget_name_of_position)r/   Úpositionr1   Úresults       r2   rB   z PythonMixin.get_name_of_positionj   si   € ð
 —”ˆAÜ˜!œTÔ"Ø—6‘6˜VÓ#¨¯©°xÔ(LÀ1Ç9Á9Ó(LØ’Hñ )Mð ×/Ñ/°Ó9�ØÑ%Ø!’Mð ð r4   N)r5   r6   r7   Ú__doc__r8   r:   rB   r!   r4   r2   r<   r<   c   s   … ñð €IØÓór4   r<   c                   ó   — e Zd ZdZd„ Zd„ Zy)Ú
PythonLeafr!   c                 ó6   — t        | | j                  «       «      S ©N)r   Úget_start_pos_of_prefix©r/   s    r2   Ú_split_prefixzPythonLeaf._split_prefix}   s   € Ü˜D $×">Ñ">Ó"@ÓAÐAr4   c                 ó   — | j                  «       }|�-|j                  dk(  r|j                  dv r|j                  «       }|€2t        | j                  «      }| j
                  t        |«      z
  dz   dfS |j                  S )z[
        Basically calls :py:meth:`parso.tree.NodeOrLeaf.get_start_pos_of_prefix`.
        Ú
error_leaf)ÚINDENTÚDEDENTÚERROR_DEDENTr,   r   )Úget_previous_leafr"   Ú
token_typer   ÚprefixÚlineÚlenrA   )r/   Úprevious_leafÚliness      r2   rJ   z"PythonLeaf.get_start_pos_of_prefix€   s   € ð ×.Ñ.Ó0ˆØÐ$¨×);Ñ);¸|Ò)KØ!×,Ñ,Ð0TÑTØ)×;Ñ;Ó=ˆMàÐ Ü §¡Ó,ˆEà—9‘9œs 5›zÑ)¨AÑ-¨qÐ0Ð0Ø×$Ñ$Ð$r4   N)r5   r6   r7   r8   rL   rJ   r!   r4   r2   rG   rG   z   s   „ Ø€IòBó%r4   rG   c                   ó4   — e Zd ZdZdZedeeef   fd„«       Zy)Ú_LeafWithoutNewlinesz.
    Simply here to optimize performance.
    r!   Úreturnc                 ó^   — | j                   | j                  t        | j                  «      z   fS rI   )rU   ÚcolumnrV   ÚvaluerK   s    r2   rA   z_LeafWithoutNewlines.end_pos˜   s"   € à�y‰y˜$Ÿ+™+¬¨D¯J©J«Ñ7Ð7Ð7r4   N)	r5   r6   r7   rE   r8   Úpropertyr   ÚintrA   r!   r4   r2   rZ   rZ   ’   s/   „ ñð €Iàð8˜˜s C˜x™ò 8ó ñ8r4   rZ   c                   ó   — e Zd ZdZy)ÚPythonBaseNoder!   N©r5   r6   r7   r8   r!   r4   r2   rb   rb   ž   ó   „ Ø�Ir4   rb   c                   ó   — e Zd ZdZy)Ú
PythonNoder!   Nrc   r!   r4   r2   rf   rf   ¢   rd   r4   rf   c                   ó   — e Zd ZdZy)ÚPythonErrorNoder!   Nrc   r!   r4   r2   rh   rh   ¦   rd   r4   rh   c                   ó   — e Zd ZdZy)ÚPythonErrorLeafr!   Nrc   r!   r4   r2   rj   rj   ª   rd   r4   rj   c                   ó   — e Zd ZdZdZd„ Zy)Ú	EndMarkerr!   Ú	endmarkerc                 óz   — dt        | «      j                  ›dt        | j                  «      ›d| j                  ›d�S )NÚ<z	: prefix=z	 end_pos=Ú>)r"   r5   ÚreprrT   rA   rK   s    r2   Ú__repr__zEndMarker.__repr__²   s*   � ä�‹J×Ó¤ d§k¡kÕ!2°D·L³Lð
ð 	
r4   N)r5   r6   r7   r8   r"   rr   r!   r4   r2   rl   rl   ®   s   „ Ø€IØ€Dó
r4   rl   c                   ó   — e Zd ZdZdZdZd„ Zy)ÚNewlinez&Contains NEWLINE and ENDMARKER tokens.r!   Únewlinec                 ó`   — dt        | «      j                  ›dt        | j                  «      ›d�S )Nro   ú: rp   )r"   r5   rq   r^   rK   s    r2   rr   zNewline.__repr__½   s    � Ü! $›Z×0Ó0´$°t·z±zÕ2BÐCÐCr4   N)r5   r6   r7   rE   r8   r"   rr   r!   r4   r2   rt   rt   ¸   s   „ Ù0Ø€IØ€DóDr4   rt   c                   ó.   — e Zd ZdZdZdZd„ Zdd„Zd	d„Zy)
ÚNameza
    A string. Sometimes it is important to know if the string belongs to a name
    or not.
    r>   r!   c           	      ó‚   — dt        | «      j                  ›d| j                  ›d| j                  ›d| j                  ›d�	S )Nro   rw   Ú@Ú,rp   )r"   r5   r^   rU   r]   rK   s    r2   rr   zName.__repr__É   s,   � Ü#'¨£:×#6Ó#6¸¿
»
Ø#'§9£9¨d¯k«kð;ð 	;r4   c                 ó*   — | j                  |¬«      duS )z<
        Returns True if the name is being defined.
        )Úinclude_setitemN)Úget_definition©r/   r~   s     r2   Úis_definitionzName.is_definitionÍ   s   € ð ×"Ñ"°?Ð"ÓCÈ4ÐOÐOr4   c                 óh  — | j                   }|j                  }|dv r| |j                  k(  r|S y|dk(  r | j                  «       dk(  r|j                   S y|�]|j                  dk(  ry|j                  t        v r,| |j                  |«      v r|S |r|j                  t        v r|S y|j                   }|�Œ]y)zî
        Returns None if there's no definition for a name.

        :param import_name_always: Specifies if an import name is always a
            definition. Normally foo in `from foo import bar` is not a
            definition.
        r(   NÚexcept_clauseÚasr   )r%   r"   r>   Úget_previous_siblingÚ_GET_DEFINITION_TYPESÚget_defined_namesÚ_IMPORTS)r/   Úimport_name_alwaysr~   r0   Útype_s        r2   r   zName.get_definitionÓ   s¿   € ð �{‰{ˆØ—	‘	ˆàÐ+Ñ+Ø�t—y‘yÒ Ø�Øà�OÒ#Ø×(Ñ(Ó*¨dÒ2Ø—{‘{Ð"ØàÐØ�y‰y˜GÒ#ØØ�y‰yÔ1Ñ1Ø˜4×1Ñ1°/ÓBÑBØ�KÙ%¨$¯)©)´xÑ*?Ø�KØØ—;‘;ˆDð Ñð r4   N©F)FF)	r5   r6   r7   rE   r"   r8   rr   r�   r   r!   r4   r2   ry   ry   Á   s#   „ ñð €DØ€Iò;óPôr4   ry   c                   ó   — e Zd ZdZy)ÚLiteralr!   Nrc   r!   r4   r2   r�   r�   õ   rd   r4   r�   c                   ó   — e Zd ZdZdZy)ÚNumberÚnumberr!   N©r5   r6   r7   r"   r8   r!   r4   r2   r�   r�   ù   s   „ Ø€DØ�Ir4   r�   c                   ó*   — e Zd ZdZdZed„ «       Zd„ Zy)ÚStringr-   r!   c                 ó`   — t        j                  d| j                  «      j                  d«      S )Nz\w*(?=[\'"])r   )ÚreÚmatchr^   ÚgrouprK   s    r2   Ústring_prefixzString.string_prefix  s"   € ä�x‰x˜¨¯©Ó4×:Ñ:¸1Ó=Ð=r4   c                 ó¼   — t        j                  d| j                  t         j                  ¬«      }|j	                  d«      d t        |j	                  d«      «        S )Nz('{3}|"{3}|'|")(.*)$)Úflagsé   r,   )r•   Úsearchr^   ÚDOTALLr—   rV   )r/   r–   s     r2   Ú_get_payloadzString._get_payload  sI   € Ü—	‘	Ø'Ø�J‰JÜ—)‘)ô
ˆð
 �{‰{˜1‹~Ð3¤ E§K¡K°£NÓ 3Ð3Ð4Ð4r4   N)r5   r6   r7   r"   r8   r_   r˜   rž   r!   r4   r2   r“   r“   þ   s#   „ Ø€DØ€Iàñ>ó ð>ó5r4   r“   c                   ó   — e Zd ZdZdZdZy)ÚFStringStringúx
    f-strings contain f-string expressions and normal python strings. These are
    the string parts of f-strings.
    Úfstring_stringr!   N©r5   r6   r7   rE   r"   r8   r!   r4   r2   r    r      s   „ ñð €DØ�Ir4   r    c                   ó   — e Zd ZdZdZdZy)ÚFStringStartr¡   Úfstring_startr!   Nr£   r!   r4   r2   r¥   r¥     s   „ ñð €DØ�Ir4   r¥   c                   ó   — e Zd ZdZdZdZy)Ú
FStringEndr¡   Úfstring_endr!   Nr£   r!   r4   r2   r¨   r¨   !  s   „ ñð €DØ�Ir4   r¨   c                   ó(   — e Zd ZU dZeed<   d„ Zd„ Zy)Ú_StringComparisonMixinr!   r^   c                 óH   — t        |t        «      r| j                  |k(  S | |u S )ze
        Make comparisons with strings easy.
        Improves the readability of the parser.
        )r?   r9   r^   ©r/   Úothers     r2   Ú__eq__z_StringComparisonMixin.__eq__.  s'   € ô
 �eœSÔ!Ø—:‘: Ñ&Ð&à�uˆ}Ðr4   c                 ó,   — t        | j                  «      S rI   )Úhashr^   rK   s    r2   Ú__hash__z_StringComparisonMixin.__hash__8  ó   € Ü�D—J‘JÓÐr4   N)r5   r6   r7   r8   r   r:   r¯   r²   r!   r4   r2   r«   r«   *  s   … Ø€IØƒJòó r4   r«   c                   ó   — e Zd ZdZdZy)ÚOperatorÚoperatorr!   Nr‘   r!   r4   r2   rµ   rµ   <  s   „ Ø€DØ�Ir4   rµ   c                   ó   — e Zd ZdZdZy)ÚKeywordÚkeywordr!   Nr‘   r!   r4   r2   r¸   r¸   A  s   „ Ø€DØ�Ir4   r¸   c                   óJ   ‡ — e Zd ZdZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zˆ xZS )
ÚScopez“
    Super class for the parser tree, which represents the state of a python
    text file.
    A Scope is either a function, class or lambda.
    r!   c                 ó$   •— t         ‰| �  |«       y rI   ©ÚsuperÚ__init__©r/   r$   Ú	__class__s     €r2   r¿   zScope.__init__N  ó   ø€ Ü‰Ñ˜Õ"r4   c                 ó$   — | j                  d«      S )z9
        Returns a generator of `funcdef` nodes.
        r)   ©Ú_search_in_scoperK   s    r2   Úiter_funcdefszScope.iter_funcdefsQ  s   € ð ×$Ñ$ YÓ/Ð/r4   c                 ó$   — | j                  d«      S )z:
        Returns a generator of `classdef` nodes.
        r*   rÄ   rK   s    r2   Úiter_classdefszScope.iter_classdefsW  s   € ð ×$Ñ$ ZÓ0Ð0r4   c                 ó&   — | j                  dd«      S )zO
        Returns a generator of `import_name` and `import_from` nodes.
        r   r   rÄ   rK   s    r2   Úiter_importszScope.iter_imports]  s   € ð ×$Ñ$ ]°MÓBÐBr4   c                 ó6   ‡‡— ˆˆfd„Š ‰| j                   «      S )Nc              3   óž   •K  — | D ]A  }|j                   ‰v r|–— |j                   t        v sŒ( ‰|j                  «      E d {  –—†  ŒC y 7 Œ­wrI   )r"   Ú_FUNC_CONTAINERSr$   )r$   ÚelementÚnamesÚscans     €€r2   rÐ   z$Scope._search_in_scope.<locals>.scand  sH   øè ø€ Û#�Ø—<‘< 5Ñ(Ø!’MØ—<‘<Ô#3Ò3Ù# G×$4Ñ$4Ó5×5Ñ5ñ	 $ð 6ús   ƒ*A®AÁAÁA©r$   )r/   rÏ   rÐ   s    `@r2   rÅ   zScope._search_in_scopec  s   ù€ õ	6ñ �D—M‘MÓ"Ð"r4   c                 ó    — | j                   d   S )zD
        Returns the part that is executed by the function.
        éÿÿÿÿrÑ   rK   s    r2   Ú	get_suitezScope.get_suitem  s   € ð �}‰}˜RÑ Ð r4   c           	      óÊ   — 	 | j                   j                  }dt        | «      j                  ›d|›d| j
                  d   ›d| j                  d   ›d�	S # t        $ r d}Y ŒIw xY w)NÚ ro   rw   r{   r   Ú-rp   )r>   r^   ÚAttributeErrorr"   r5   r@   rA   )r/   r>   s     r2   rr   zScope.__repr__s  s^   € ð	Ø—9‘9—?‘?ˆDøô $(¨£:×#6Ó#6ºØ#'§>¡>°!Ó#4°d·l±lÀ1³oðGð 	Gøô ò 	ØŠDð	ús   ‚A ÁA"Á!A")r5   r6   r7   rE   r8   r¿   rÆ   rÈ   rÊ   rÅ   rÔ   rr   Ú__classcell__©rÁ   s   @r2   r»   r»   F  s4   ø„ ñð
 €Iô#ò0ò1òCò#ò!öGr4   r»   c                   ó6   ‡ — e Zd ZdZdZdZˆ fd„Zd„ Zd„ Zˆ xZ	S )ÚModulez“
    The top scope, which is always a module.
    Depending on the underlying parser this may be a full module or just a part
    of a module.
    )Ú_used_namesr'   c                 ó2   •— t         ‰| �  |«       d | _        y rI   )r¾   r¿   rÝ   rÀ   s     €r2   r¿   zModule.__init__†  s   ø€ Ü‰Ñ˜Ô"ØˆÕr4   c              #   ó  K  — | j                  «       D ]o  }|j                  dk(  sŒ|j                  dk(  sŒ#|j                  «       D ]:  }|D �cg c]  }|j                  ‘Œ }}t        |«      dk(  sŒ+|d   dk(  sŒ4|d   –— Œ< Œq yc c}w ­w)zU
        :return: A list of future import names.
        :rtype: list of str
        r   r   r›   Ú
__future__r,   N)rÊ   r"   ÚlevelÚ	get_pathsr^   rV   )r/   ÚimpÚpathr>   rÏ   s        r2   Ú_iter_future_import_namesz Module._iter_future_import_namesŠ  s}   è ø€ ð ×$Ñ$Ö&ˆCØ�x‰x˜=Ó(¨S¯Y©Y¸!«^ØŸM™MžO�DÙ48Ó9±D¨D˜TŸZ›Z°D�EÐ9Ü˜5“z Q“¨5°©8°|Ó+CØ# A™h›ñ ,ñ 'ùò :ùs'   ‚#B¦B¶BÁBÁ BÁ1BÁ:Bc                 óv   ‡‡— | j                   € i Šˆˆfd„Š ‰| «       t        ‰«      | _         | j                   S )z�
        Returns all the :class:`Name` leafs that exist in this module. This
        includes both definitions and references of names.
        c                 óØ   •— 	 | j                   }|D ]
  } ‰|«       Œ y # t        $ rA | j                  dk(  r/‰j                  | j                  g «      }|j                  | «       Y y Y y w xY w)Nr>   )r$   rØ   r"   Ú
setdefaultr^   Úappend)r0   r$   ÚchildÚarrÚdctÚrecurses       €€r2   rí   z&Module.get_used_names.<locals>.recurse£  sf   ø€ ð'Ø#Ÿ}™}�Hó "*˜Ù �ñ "*øô &ò )Ø—y‘y FÒ*Ø!Ÿn™n¨T¯Z©Z¸Ó<˜ØŸ
™
 4Ö(ñ +ð)ús   ƒ ŸAA)Á(A))rÝ   ÚUsedNamesMapping)r/   rì   rí   s    @@r2   Úget_used_nameszModule.get_used_namesš  s=   ù€ ð
 ×ÑÐ#àˆCõ	'ñ �DŒMÜ/°Ó4ˆDÔØ×ÑÐr4   )
r5   r6   r7   rE   r8   r"   r¿   rå   rï   rÙ   rÚ   s   @r2   rÜ   rÜ   }  s#   ø„ ñð
 !€IØ€Dô ò'ö  r4   rÜ   c                   ó   — e Zd ZdZdZy)Ú	DecoratorÚ	decoratorr!   Nr‘   r!   r4   r2   rñ   rñ   ³  s   „ Ø€DØ�Ir4   rñ   c                   ó&   — e Zd ZdZed„ «       Zd„ Zy)ÚClassOrFuncr!   c                 ó    — | j                   d   S )zR
        Returns the `Name` leaf that defines the function or class name.
        r,   rÑ   rK   s    r2   r>   zClassOrFunc.name»  s   € ð
 �}‰}˜QÑÐr4   c                 óú   — | j                   }|j                  dk(  r|j                   }|j                  dk(  rD|j                  d   j                  dk(  r|j                  d   j                  S |j                  dd S g S )z4
        :rtype: list of :class:`Decorator`
        r   r   r   Ú
decoratorsNr,   )r%   r"   r$   )r/   r   s     r2   Úget_decoratorszClassOrFunc.get_decoratorsÂ  sx   € ð —K‘Kˆ	Ø�>‰>˜_Ò,Ø!×(Ñ(ˆIà�>‰>˜[Ò(Ø×!Ñ! !Ñ$×)Ñ)¨\Ò9Ø ×)Ñ)¨!Ñ,×5Ñ5Ð5à ×)Ñ)¨"¨1Ð-Ð-àˆIr4   N)r5   r6   r7   r8   r_   r>   rø   r!   r4   r2   rô   rô   ¸  s   „ Ø€Iàñ ó ð ór4   rô   c                   ó0   ‡ — e Zd ZdZdZdZˆ fd„Zd„ Zˆ xZS )ÚClassz>
    Used to store the parsed contents of a python class.
    r*   r!   c                 ó$   •— t         ‰| �  |«       y rI   r½   rÀ   s     €r2   r¿   zClass.__init__Ú  rÂ   r4   c                 ó‚   — t        | j                  «      D ]'  \  }}|dk(  sŒ| j                  |dz      }|dk(  r y|c S  y)z
        Returns the `arglist` node that defines the super classes. It returns
        None if there are no arguments.
        Ú(r,   Ú)N©Ú	enumerater$   )r/   Úirê   Ú
next_childs       r2   Úget_super_arglistzClass.get_super_arglistÝ  sJ   € ô
 " $§-¡-Ö0‰HˆAˆuØ˜‹|Ø!Ÿ]™]¨1¨q©5Ñ1�
Ø Ò$ÙØ!Ò!ð 1ð r4   )	r5   r6   r7   rE   r"   r8   r¿   r  rÙ   rÚ   s   @r2   rú   rú   Ó  s   ø„ ñð €DØ€Iô#ör4   rú   c                 óÀ  — 	 |d   }|j                  dv rt        |g| «      gS |dk(  r|gS |j                  dk(  r|g}n|j                  }g }d}t	        |dgz   d«      D ]l  \  }}|�|dk(  sŒ||| }|sŒ|d   dk(  rt        |«      dk(  s|d   dk(  s|d   dk(  r|D ]	  }	| |	_        Œ ||z  }n|j                  t        || «      «       |}Œn |S # t         $ r g cY S w xY w)	aø  
    `argslist_list` is a list that can contain an argslist as a first item, but
    most not. It's basically the items between the parameter brackets (which is
    at most one item).
    This function modifies the parser structure. It generates `Param` objects
    from the normal ast. Those param objects do not exist in a normal ast, but
    make the evaluation of the ast tree so much easier.
    You could also say that this function replaces the argslist node with a
    list of Param objects.
    r   )r>   ÚfpdefÚ*ÚtfpdefNr,   r|   Ú/)Ú
IndexErrorr"   ÚParamr$   r   rV   r%   ré   )
r%   Úargslist_listÚfirstr$   Únew_childrenÚstartÚendrê   Úparam_childrenÚps
             r2   Ú_create_paramsr  ë  s#  € ðØ˜aÑ ˆð ‡z�zÐ&Ñ&Ü�u�g˜vÓ&Ð'Ð'Ø	�#ŠØˆwˆà�:‰:˜Ò!Ø�w‰Hà—~‘~ˆHØˆØˆä# H°¨vÑ$5°qÖ9‰JˆC�Øˆ} ¨£Ø!)¨%°Ð!4�Ú!Ø% aÑ(¨CÒ/Ü!$ ^Ó!4¸Ò!9Ø$2°1Ñ$5¸Ò$<Ø-¨aÑ0°CÒ7Û!/˜AØ'-˜A�Hð "0à$¨Ñ6™à$×+Ñ+¬E°.À&Ó,IÔJØ‘Eð :ð Ðøô; ò ØŠ	ðús   ‚C ÃCÃCc                   ót   ‡ — e Zd ZdZdZdZˆ fd„Zd„ Zd„ Zd„ Z	e
d„ «       Zd	„ Zd
„ Zd„ Zd„ Ze
d„ «       Zˆ xZS )ÚFunctionan  
    Used to store the parsed contents of a python function.

    Children::

        0. <Keyword: def>
        1. <Name>
        2. parameter list (including open-paren and close-paren <Operator>s)
        3. or 5. <Operator: :>
        4. or 6. Node() representing function body
        3. -> (if annotation is also present)
        4. annotation (if present)
    r)   r!   c                 óº   •— t         ‰| �  |«       | j                  «       }|j                  dd }t	        d„ |D «       «      st        ||«      |j                  dd y y )Nr,   rÓ   c              3   ó<   K  — | ]  }t        |t        «      –— Œ y ­wrI   ©r?   r
  ©Ú.0rê   s     r2   Ú	<genexpr>z$Function.__init__.<locals>.<genexpr>-  ó   è ø€ ÐMÑ9L°”:˜e¤U×+Ñ9Lùó   ‚)r¾   r¿   Ú_find_parametersr$   Úanyr  )r/   r$   Ú
parametersÚparameters_childrenrÁ   s       €r2   r¿   zFunction.__init__)  sc   ø€ Ü‰Ñ˜Ô"Ø×*Ñ*Ó,ˆ
Ø(×1Ñ1°!°BÐ7ÐÜÑMÑ9LÓMÔMÜ(6ØÐ/ó)ˆJ×Ñ  "Ñ%ð Nr4   c                 ó`   — | j                   D ]  }|j                  dk(  sŒ|c S  t        d«      ‚)Nr  z(A function should always have parameters)r$   r"   Ú	Exception)r/   rê   s     r2   r  zFunction._find_parameters2  s/   € Ø—]”]ˆEØ�z‰z˜\Ó)Ø’ð #ô ÐBÓCÐCr4   c                 ó6   — | j                  «       j                  S rI   )r  r$   rK   s    r2   Ú_get_param_nodeszFunction._get_param_nodes8  s   € Ø×$Ñ$Ó&×/Ñ/Ð/r4   c                 óh   — | j                  «       D �cg c]  }|j                  dk(  sŒ|‘Œ c}S c c}w )z.
        Returns a list of `Param()`.
        r   )r$  r"   )r/   r  s     r2   Ú
get_paramszFunction.get_params;  s2   € ð  ×0Ñ0Ô2ÓHÑ2�a°a·f±fÀÓ6G’Ð2ÑHÐHùÒHs   “/¨/c                 ó    — | j                   d   S ©Nr,   rÑ   rK   s    r2   r>   zFunction.nameA  ó   € à�}‰}˜QÑÐr4   c                 ó2   ‡— ˆfd„Š ‰| j                   «      S )z6
        Returns a generator of `yield_expr`.
        c              3   ó  •K  — | D ].  }|j                   dv rŒ	 |j                  } ‰|«      E d {  –—†  Œ0 y 7 Œ# t        $ r> |j                  dk(  r,|j                  j                   dk(  r|j                  –— n|–— Y Œzw xY w­w)N)r*   r)   ÚlambdefÚyieldÚ
yield_expr)r"   r$   rØ   r^   r%   )r$   rÎ   Únested_childrenrÐ   s      €r2   rÐ   z'Function.iter_yield_exprs.<locals>.scanI  s„   øè ø€ Û#�Ø—<‘<Ð#EÑEØð	5Ø&-×&6Ñ&6�Oñ  $ OÓ4×4Ñ4ñ $ð 5ùô &ò *Ø—}‘}¨Ò/Ø"Ÿ>™>×.Ñ.°,Ò>Ø")§.¡.Ó0à")šMùð*üs/   ƒB™:¥B°8±BºABÁ>BÂ BÂBrÑ   ©r/   rÐ   s    @r2   Úiter_yield_exprszFunction.iter_yield_exprsE  s   ø€ ô	5ñ  �D—M‘MÓ"Ð"r4   c                 ó2   ‡— ˆfd„Š ‰| j                   «      S )z7
        Returns a generator of `return_stmt`.
        c              3   óÜ   •K  — | D ]`  }|j                   dk(  s|j                   dk(  r|j                  dk(  r|–— |j                   t        v sŒG ‰|j                  «      E d {  –—†  Œb y 7 Œ­w)NÚreturn_stmtr¹   r[   ©r"   r^   Ú_RETURN_STMT_CONTAINERSr$   ©r$   rÎ   rÐ   s     €r2   rÐ   z(Function.iter_return_stmts.<locals>.scan_  s_   øè ø€ Û#�Ø—<‘< =Ò0Ø"Ÿ<™<¨9Ò4¸¿¹È(Ò9RØ!’MØ—<‘<Ô#:Ò:Ù# G×$4Ñ$4Ó5×5Ñ5ñ $ð
 6úó   ƒA	A,ÁA,Á"A*Á#A,rÑ   r0  s    @r2   Úiter_return_stmtszFunction.iter_return_stmts[  ó   ø€ ô	6ñ �D—M‘MÓ"Ð"r4   c                 ó2   ‡— ˆfd„Š ‰| j                   «      S )zi
        Returns a generator of `raise_stmt`. Includes raise statements inside try-except blocks
        c              3   óÜ   •K  — | D ]`  }|j                   dk(  s|j                   dk(  r|j                  dk(  r|–— |j                   t        v sŒG ‰|j                  «      E d {  –—†  Œb y 7 Œ­w)NÚ
raise_stmtr¹   Úraiser5  r7  s     €r2   rÐ   z'Function.iter_raise_stmts.<locals>.scanm  s_   øè ø€ Û#�Ø—<‘< <Ò/Ø"Ÿ<™<¨9Ò4¸¿¹È'Ò9QØ!’MØ—<‘<Ô#:Ò:Ù# G×$4Ñ$4Ó5×5Ñ5ñ $ð
 6úr8  rÑ   r0  s    @r2   Úiter_raise_stmtszFunction.iter_raise_stmtsi  r:  r4   c                 ó:   — t        | j                  «       d«      duS )zK
        :return bool: Checks if a function is a generator or not.
        N)Únextr1  rK   s    r2   Úis_generatorzFunction.is_generatorw  s   € ô �D×)Ñ)Ó+¨TÓ2¸$Ð>Ð>r4   c                 óp   — t        | j                  «      D ]  \  }}|dk(  sŒ| j                  |dz      c S  y)zW
        Returns the test node after `->` or `None` if there is no annotation.
        z->r,   Nrÿ   )r/   r  rê   s      r2   Ú
annotationzFunction.annotation}  s:   € ô
 " $§-¡-Ö0‰HˆAˆuØ˜‹}Ø—}‘} Q¨¡UÑ+Ò+ð 1ð r4   )r5   r6   r7   rE   r"   r8   r¿   r  r$  r&  r_   r>   r1  r9  r?  rB  rD  rÙ   rÚ   s   @r2   r  r    sf   ø„ ñð €DØ€IôòDò0òIð ñ ó ð ò#ò,#ò#ò?ð ñó ôr4   r  c                   óV   ‡ — e Zd ZdZdZdZˆ fd„Zed„ «       Zd„ Z	ed„ «       Z
d„ Zˆ xZS )	ÚLambdazé
    Lambdas are basically trimmed functions, so give it the same interface.

    Children::

         0. <Keyword: lambda>
         *. <Param x> for each argument x
        -2. <Operator: :>
        -1. Node() representing body
    r,  r!   c                 ó¢   •— t         t        | �  |«       | j                  dd }t	        d„ |D «       «      st        | |«      | j                  dd y y )Nr,   éþÿÿÿc              3   ó<   K  — | ]  }t        |t        «      –— Œ y ­wrI   r  r  s     r2   r  z"Lambda.__init__.<locals>.<genexpr>�  r  r  )r¾   r  r¿   r$   r  r  )r/   r$   r   rÁ   s      €r2   r¿   zLambda.__init__–  sR   ø€ äŒh˜Ñ& xÔ0à"Ÿm™m¨A¨bÐ1Ðô ÑMÑ9LÓMÔMÜ"0°Ð7JÓ"KˆD�M‰M˜!˜BÑð Nr4   c                 ó   — t        d«      ‚)zN
        Raises an AttributeError. Lambdas don't have a defined name.
        zlambda is not named.)rØ   rK   s    r2   r>   zLambda.name   s   € ô
 Ð3Ó4Ð4r4   c                 ó    — | j                   dd S )Nr,   rH  rÑ   rK   s    r2   r$  zLambda._get_param_nodes§  s   € Ø�}‰}˜Q˜rÐ"Ð"r4   c                  ó   — y)zA
        Returns `None`, lambdas don't have annotations.
        Nr!   rK   s    r2   rD  zLambda.annotationª  s   € ð
 r4   c                 óP   — d| j                   j                  ›d| j                  ›d�S )Nro   r{   rp   )rÁ   r5   r@   rK   s    r2   rr   zLambda.__repr__±  s   � Ø ŸN™N×3Ó3°T·^³^ÐDÐDr4   )r5   r6   r7   rE   r"   r8   r¿   r_   r>   r$  rD  rr   rÙ   rÚ   s   @r2   rF  rF  ˆ  sM   ø„ ñ	ð €DØ€IôLð ñ5ó ð5ò#ð ñó ðöEr4   rF  c                   ó   — e Zd ZdZy)ÚFlowr!   Nrc   r!   r4   r2   rO  rO  µ  rd   r4   rO  c                   ó&   — e Zd ZdZdZd„ Zd„ Zd„ Zy)ÚIfStmtr   r!   c              #   óx   K  — t        | j                  «      D ]  \  }}|dv sŒ| j                  |dz      –— Œ  y­w)z 
        E.g. returns all the `test` nodes that are named as x, below:

            if x:
                pass
            elif x:
                pass
        )ÚelifÚifr,   Nrÿ   )r/   r  r1   s      r2   Úget_test_nodeszIfStmt.get_test_nodes½  s:   è ø€ ô ˜dŸm™mÖ,‰DˆAˆqØ�NÒ"Ø—m‘m A¨¡EÑ*Ó*ñ -ùs   ‚ :£:c                 ó²   — |j                   }t        t        | j                  «       «      «      D ]&  }|j                   |k  sŒ||j                  k  r y|c S  y)zÝ
        Searches for the branch in which the node is and returns the
        corresponding test node (see function above). However if the node is in
        the test node itself and not in the suite return None.
        N)r@   ÚreversedÚlistrU  rA   )r/   r0   r@   Ú
check_nodes       r2   Úget_corresponding_test_nodez"IfStmt.get_corresponding_test_nodeÊ  sR   € ð —N‘Nˆ	Ü"¤4¨×(;Ñ(;Ó(=Ó#>Ö?ˆJØ×#Ñ# iÓ/Ø˜z×1Ñ1Ò1Ùð &Ò%ñ @r4   c                 óh   — | j                   D ]#  }|dk(  sŒ	|j                  |j                  kD  sŒ# y y)z;
        Checks if a node is defined after `else`.
        ÚelseTF)r$   r@   )r/   r0   r1   s      r2   Úis_node_after_elsezIfStmt.is_node_after_elseÚ  s1   € ð —”ˆAØ�F‹{Ø—>‘> A§K¡KÓ/Ùð ð
 r4   N)r5   r6   r7   r"   r8   rU  rZ  r]  r!   r4   r2   rQ  rQ  ¹  s   „ Ø€DØ€Iò+ò&ó 	r4   rQ  c                   ó   — e Zd ZdZdZy)Ú	WhileStmtr   r!   Nr‘   r!   r4   r2   r_  r_  æ  ó   „ Ø€DØ�Ir4   r_  c                   ó"   — e Zd ZdZdZd„ Zdd„Zy)ÚForStmtr   r!   c                 ó    — | j                   d   S )zE
        Returns the input node ``y`` from: ``for x in y:``.
        é   rÑ   rK   s    r2   Úget_testlistzForStmt.get_testlistï  s   € ð �}‰}˜QÑÐr4   c                 ó4   — t        | j                  d   |«      S r(  ©Ú_defined_namesr$   r€   s     r2   r‡   zForStmt.get_defined_namesõ  ó   € Ü˜dŸm™m¨AÑ.°Ó@Ð@r4   Nr‹   )r5   r6   r7   r"   r8   re  r‡   r!   r4   r2   rb  rb  ë  s   „ Ø€DØ€Iò ôAr4   rb  c                   ó   — e Zd ZdZdZd„ Zy)ÚTryStmtr   r!   c              #   ó„   K  — | j                   D ]-  }|j                  dk(  r|j                   d   –— Œ$|dk(  sŒ*d–— Œ/ y­w)z˜
        Returns the ``test`` nodes found in ``except_clause`` nodes.
        Returns ``[None]`` for except clauses without an exception given.
        rƒ   r,   ÚexceptN©r$   r"   ©r/   r0   s     r2   Úget_except_clause_testszTryStmt.get_except_clause_testsý  s>   è ø€ ð
 —M”MˆDØ�y‰y˜OÒ+Ø—m‘m AÑ&Ó&Ø˜Ó!Ø“
ñ	 "ùs
   ‚6A ¹A N)r5   r6   r7   r"   r8   rp  r!   r4   r2   rk  rk  ù  s   „ Ø€DØ€Ió	r4   rk  c                   ó"   — e Zd ZdZdZdd„Zd„ Zy)ÚWithStmtr   r!   c                 ó�   — g }| j                   ddd…   D ].  }|j                  dk(  sŒ|t        |j                   d   |«      z  }Œ0 |S )z}
        Returns the a list of `Name` that the with statement defines. The
        defined names are set after `as`.
        r,   rH  r›   Ú	with_item)r$   r"   rh  )r/   r~   rÏ   rt  s       r2   r‡   zWithStmt.get_defined_names  sQ   € ð
 ˆØŸ™ q¨¨A vÔ.ˆIà�~‰~ Ó,Øœ¨	×(:Ñ(:¸1Ñ(=¸ÓOÑO‘ð /ð ˆr4   c                 ó\   — |j                  d«      }|€t        d«      ‚|j                  d   S )Nrt  z2The name is not actually part of a with statement.r   )r   Ú
ValueErrorr$   )r/   r>   r0   s      r2   Úget_test_node_from_namez WithStmt.get_test_node_from_name  s2   € Ø×#Ñ# KÓ0ˆØˆ<ÜÐQÓRÐRØ�}‰}˜QÑÐr4   Nr‹   )r5   r6   r7   r"   r8   r‡   rw  r!   r4   r2   rr  rr  	  s   „ Ø€DØ€Ió
ó r4   rr  c                   ó>   — e Zd ZU dZeed<   eed<   d„ Zd„ Zd„ Zd„ Z	y)	ÚImportr!   râ   Ú_aliasesc                 óÂ   — 	 | j                  «       |   }| j                  «       D ]  }||v sŒ|d|j                  |«      dz    c S  t	        d«      ‚# t        $ r Y ŒHw xY w)zo
        The path is the list of names that leads to the searched name.

        :return list of Name:
        Nr,   z+Name should be defined in the import itself)rz  ÚKeyErrorrâ   r.   rv  )r/   r>   rä   s      r2   Úget_path_for_namezImport.get_path_for_name%  so   € ð	à—=‘=“? 4Ñ(ˆDð —N‘NÖ$ˆDØ�tŠ|ØÐ1˜TŸZ™Z¨Ó-°Ñ1Ð2Ò2ð %ô ÐFÓGÐGøô ò 	Ùð	ús   ‚A Á	AÁAc                  ó   — y)NFr!   rK   s    r2   Ú	is_nestedzImport.is_nested6  s   € Ør4   c                 ó&   — | j                   d   dk(  S )NrÓ   r  rÑ   rK   s    r2   Úis_star_importzImport.is_star_import9  s   € Ø�}‰}˜RÑ  CÑ'Ð'r4   c                 ó   — t        d«      ‚)NzUse ImportFrom or ImportName)ÚNotImplementedErrorrK   s    r2   r‡   zImport.get_defined_names<  s   € Ü!Ð"@ÓAÐAr4   N)
r5   r6   r7   r8   r   r:   r}  r  r�  r‡   r!   r4   r2   ry  ry     s'   … Ø€IØƒNØƒMòHò"ò(óBr4   ry  c                   óD   — e Zd ZdZdZd
d„Zd„ Zd„ Zed„ «       Z	d„ Z
d„ Zy	)Ú
ImportFromr   r!   c                 ó\   — | j                  «       D ��cg c]  \  }}|xs |‘Œ c}}S c c}}w )z¿
        Returns the a list of `Name` that the import defines. The
        defined names are set after `import` or in case an alias - `as` - is
        present that name is returned.
        )Ú_as_name_tuples)r/   r~   r>   Úaliass       r2   r‡   zImportFrom.get_defined_namesD  s1   € ð 26×1EÑ1EÔ1GÔHÑ1G¡+ $¨�’˜‘Ð1GÒHÐHùÓHs   ”(c                 óB   — t        d„ | j                  «       D «       «      S )z-Mapping from alias to its corresponding name.c              3   ó.   K  — | ]  \  }}|�||f–— Œ y ­wrI   r!   )r  r>   rˆ  s      r2   r  z&ImportFrom._aliases.<locals>.<genexpr>N  s&   è ø€ ð *Ñ5K¡k d¨EØÐ(ð ˜D”MÑ5Kùs   ‚)Údictr‡  rK   s    r2   rz  zImportFrom._aliasesL  s$   € äñ *°T×5IÑ5IÔ5Kó *ó *ð 	*r4   c                 óŒ   — | j                   dd  D ]  }|dvsŒ n j                  dk(  r|j                   d d d…   S |dk(  rg S |gS )Nr,   ©Ú.z...Údotted_namer›   Úimportrn  )r/   Úns     r2   Úget_from_nameszImportFrom.get_from_namesQ  sU   € Ø—‘˜q˜rÓ"ˆAØ˜Ò$Ùð #ð �6‰6�]Ò"Ø—:‘:™c ˜c‘?Ð"Ø�(Š]ØˆIà�3ˆJr4   c                 óp   — d}| j                   dd D ]!  }|dv r|t        |j                  «      z  }Œ  |S  |S )ú&The level parameter of ``__import__``.r   r,   Nr�  ©r$   rV   r^   )r/   rá   r‘  s      r2   rá   zImportFrom.level\  sG   € ð ˆØ—‘˜q˜rÓ"ˆAØ�LÑ Øœ˜QŸW™W›Ñ%‘àØˆð #ð
 ˆr4   c              #   ó  K  — | j                   d   }|dk(  r| j                   d   }n|dk(  ry |j                  dk(  r|j                   d d d…   }n|g}|D ],  }|j                  dk(  r|d f–— Œ|j                   d d d…   –— Œ. y ­w)NrÓ   rþ   rH  r  Úimport_as_namesr›   r>   rn  )r/   ÚlastÚas_namesÚas_names       r2   r‡  zImportFrom._as_name_tuplesg  sŽ   è ø€ Ø�}‰}˜RÑ ˆØ�3Š;Ø—=‘= Ñ$‰DØ�SŠ[Øà�9‰9Ð)Ò)Ø—}‘}¡S q SÑ)‰Hà�vˆHÛˆGØ�|‰|˜vÒ%Ø˜t�mÓ#à×&Ñ&¡s¨ sÑ+Ó+ñ	  ùs   ‚BBc                 ó¦   — | j                  «       }| j                  d   dk(  r|gS | j                  «       D ��cg c]  \  }}||gz   ‘Œ c}}S c c}}w )zµ
        The import paths defined in an import statement. Typically an array
        like this: ``[<Name: datetime>, <Name: date>]``.

        :return list of list of Name:
        rÓ   r  )r’  r$   r‡  )r/   Údottedr>   rˆ  s       r2   râ   zImportFrom.get_pathsx  sW   € ð ×$Ñ$Ó&ˆà�=‰=˜Ñ Ò#Ø�8ˆOØ37×3GÑ3GÔ3IÔJÑ3I¡K D¨%�˜$˜“Ð3IÒJÐJùÓJs   ¹ANr‹   )r5   r6   r7   r"   r8   r‡   rz  r’  r_   rá   r‡  râ   r!   r4   r2   r…  r…  @  s;   „ Ø€DØ€IóIò*ò
	ð ñó ðò,ó"Kr4   r…  c                   óH   — e Zd ZdZdZdZdd„Zed„ «       Zd„ Z	d„ Z
d„ Zd	„ Zy
)Ú
ImportNamezBFor ``import_name`` nodes. Covers normal imports without ``from``.r   r!   c                 ób   — | j                  «       D ��cg c]  \  }}|xs |d   ‘Œ c}}S c c}}w )zÐ
        Returns the a list of `Name` that the import defines. The defined names
        is always the first name after `import` or in case an alias - `as` - is
        present that name is returned.
        r   ©Ú_dotted_as_names)r/   r~   rä   rˆ  s       r2   r‡   zImportName.get_defined_names‹  s7   € ð 59×4IÑ4IÔ4KÔLÑ4K¡[ T¨5�Ò ˜˜a™Ñ Ð4KÒLÐLùÓLs   ”+c                  ó   — y)r”  r   r!   rK   s    r2   rá   zImportName.level“  s   € ð r4   c                 óT   — | j                  «       D ��cg c]  \  }}|‘Œ	 c}}S c c}}w rI   r   ©r/   rä   rˆ  s      r2   râ   zImportName.get_paths˜  s)   € Ø(,×(=Ñ(=Ô(?Ô@Ñ(?™˜˜u’Ð(?Ò@Ð@ùÓ@s   ”$c              #   ó<  K  — | j                   d   }|j                  dk(  r|j                   ddd…   }n|g}|D ]_  }|j                  dk(  r|j                   d   }|j                   d   }nd}|j                  dk(  r|g|f–— ŒJ|j                   ddd…   |f–— Œa y­w)z9Generator of (list(path), alias) where alias may be None.r,   Údotted_as_namesNr›   Údotted_as_namer   r>   rn  )r/   r¦  r™  rš  rˆ  s        r2   r¡  zImportName._dotted_as_names›  s°   è ø€ àŸ-™-¨Ñ*ˆØ×ÑÐ#4Ò4Ø&×/Ñ/±°!°Ñ4‰Hà'Ð(ˆHãˆGØ�|‰|Ð/Ò/Ø×(Ñ(¨Ñ+�Ø!×*Ñ*¨1Ñ-‘à�Ø�|‰|˜vÒ%Ø�i Ð&Ó&ð ×&Ñ&¡s¨ sÑ+¨UÐ2Ó2ñ  ùs   ‚BBc           	      ó†   — t        | j                  «       D ��cg c]  \  }}|€t        |«      dkD  rd‘Œ c}}«      S c c}}w )zŽ
        This checks for the special case of nested imports, without aliases and
        from statement::

            import foo.bar
        r,   )Úboolr¡  rV   r¤  s      r2   r  zImportName.is_nested¯  sL   € ô ¨$×*?Ñ*?Ô*Aô 8Ñ*A™;˜4 Ø�}¬¨T«°Qªò Ð*Aò 8ó 9ð 	9ùó 8s   ™=
c                 óB   — t        d„ | j                  «       D «       «      S )z=
        :return list of Name: Returns all the alias
        c              3   ó4   K  — | ]  \  }}|�	||d   f–— Œ y ­w)NrÓ   r!   )r  rä   rˆ  s      r2   r  z&ImportName._aliases.<locals>.<genexpr>½  s+   è ø€ ð *Ñ9P©+¨$°ØÐ(ð ˜D ™HÔ%Ñ9Pùs   ‚)r‹  r¡  rK   s    r2   rz  zImportName._aliases¹  s&   € ô ñ *¸×9NÑ9NÔ9Pó *ó *ð 	*r4   Nr‹   )r5   r6   r7   rE   r"   r8   r‡   r_   rá   râ   r¡  r  rz  r!   r4   r2   rž  rž  †  s>   „ ÙLØ€DØ€IóMð ñó ðòAò3ò(9ó*r4   rž  c                   ó<   — e Zd ZdZdZed„ «       Zed„ «       Zdd„Zy)ÚKeywordStatementzö
    For the following statements: `assert`, `del`, `global`, `nonlocal`,
    `raise`, `return`, `yield`.

    `pass`, `continue` and `break` are not in there, because they are just
    simple keywords and the parser reduces it to a keyword.
    r!   c                 ó    — d| j                   z  S )zŠ
        Keyword statements start with the keyword and end with `_stmt`. You can
        crosscheck this with the Python grammar.
        z%s_stmt)r¹   rK   s    r2   r"   zKeywordStatement.typeË  s   € ð ˜4Ÿ<™<Ñ'Ð'r4   c                 ó4   — | j                   d   j                  S ©Nr   )r$   r^   rK   s    r2   r¹   zKeywordStatement.keywordÓ  s   € à�}‰}˜QÑ×%Ñ%Ð%r4   c                 ó†   — | j                   }|dk(  rt        | j                  d   |«      S |dv r| j                  dd d…   S g S )NÚdelr,   )ÚglobalÚnonlocalr›   )r¹   rh  r$   )r/   r~   r¹   s      r2   r‡   z"KeywordStatement.get_defined_names×  sL   € Ø—,‘,ˆØ�eÒÜ! $§-¡-°Ñ"2°OÓDÐDØÐ,Ñ,Ø—=‘=   A Ñ&Ð&Øˆ	r4   Nr‹   )	r5   r6   r7   rE   r8   r_   r"   r¹   r‡   r!   r4   r2   r­  r­  Á  s9   „ ñð €Iàñ(ó ð(ð ñ&ó ð&ôr4   r­  c                   ó    — e Zd ZdZed„ «       Zy)Ú
AssertStmtr!   c                 ó    — | j                   d   S r(  rÑ   rK   s    r2   Ú	assertionzAssertStmt.assertionã  r)  r4   N)r5   r6   r7   r8   r_   r¸  r!   r4   r2   r¶  r¶  à  s   „ Ø€Iàñ ó ñ r4   r¶  c                   ó   — e Zd ZdZd„ Zy)Ú
GlobalStmtr!   c                 ó&   — | j                   dd d…   S )Nr,   r›   rÑ   rK   s    r2   Úget_global_nameszGlobalStmt.get_global_namesë  s   € Ø�}‰}˜Q˜T ˜TÑ"Ð"r4   N)r5   r6   r7   r8   r¼  r!   r4   r2   rº  rº  è  s   „ Ø€Ió#r4   rº  c                   ó   — e Zd ZdZy)Ú
ReturnStmtr!   Nrc   r!   r4   r2   r¾  r¾  ï  rd   r4   r¾  c                   ó   — e Zd ZdZdZy)Ú	YieldExprr.  r!   Nr‘   r!   r4   r2   rÀ  rÀ  ó  r`  r4   rÀ  c                 ó²  — g }| j                   dv r(| j                  ddd…   D ]  }|t        ||«      z  }Œ |S | j                   dv r|t        | j                  d   |«      z  }|S | j                   dv rÓ| j                  d   dk7  r¿| j                  d	   }|j                  d
   dk(  r |j                  |j                  d   «       |S |j                  d
   dk(  rl|rj| j                  ddd	…   D ]U  }|j                   dk(  r!|j                  |j                  d   «        |S |j                   dk(  sŒC|j                  |«        |S  |S |j                  | «       |S )zk
    A helper function to find the defined names in statements, for loops and
    list comprehensions.
    )Útestlist_star_exprÚtestlist_compÚexprlistÚtestlistNr›   )ÚatomÚ	star_exprr,   )ÚpowerÚ	atom_exprrH  ú**rÓ   r   rŽ  Ú[Útrailerr>   )r"   r$   rh  ré   )Úcurrentr~   rÏ   rê   rÌ  r0   s         r2   rh  rh  ø  sw  € ð
 €EØ‡|�|ÐVÑVØ×%Ñ%¡c¨ cÔ*ˆEØ”^ E¨?Ó;Ñ;‰Eð +ð& €Lð# 
�‰Ð.Ñ	.Ø” × 0Ñ 0°Ñ 3°_ÓEÑEˆð  €Lð 
�‰Ð/Ñ	/Ø×Ñ˜BÑ 4Ò'Ø×&Ñ& rÑ*ˆGØ×Ñ Ñ" cÒ)Ø—‘˜W×-Ñ-¨aÑ0Ô1ð €Lð ×!Ñ! !Ñ$¨Ò+±Ø#×,Ñ,¨R¨V°¨VÔ4�DØ—y‘y IÒ-ØŸ™ T§]¡]°1Ñ%5Ô6Øð €Lð —y‘y FÓ*ØŸ™ TÔ*Øð €Lð 5ð €Lð 	�‰�WÔØ€Lr4   c                   ó(   — e Zd ZdZdZdd„Zd„ Zd„ Zy)ÚExprStmtr   r!   c                 ó`  — g }| j                   d   j                  dk(  rt        | j                   d   |«      }t        dt	        | j                   «      dz
  d«      D ��cg c]@  }d| j                   |dz      j
                  v r t        | j                   |   |«      D ]  }|‘Œ ŒB c}}|z   S c c}}w )zG
        Returns a list of `Name` defined before the `=` sign.
        r,   Ú	annassignr   r›   Ú=)r$   r"   rh  ÚrangerV   r^   )r/   r~   rÏ   r  r>   s        r2   r‡   zExprStmt.get_defined_names  s¸   € ð ˆØ�=‰=˜Ñ× Ñ  KÒ/Ü" 4§=¡=°Ñ#3°_ÓEˆEô ˜1œc $§-¡-Ó0°1Ñ4°aÔ8ô
á8�Ø�d—m‘m A¨¡EÑ*×0Ñ0Ñ0Ü& t§}¡}°QÑ'7¸ÖI�ò ð Jð Ø8ò
ð
 ñð 	ùó 
s   ÁAB*c                 ó²   — | j                   d   }|j                  dk(  r8t        |j                   «      dk(  r|j                   d   }|S |j                   d   }|S )z*Returns the right-hand-side of the equals.rÓ   rÑ  é   rd  r,   ©r$   r"   rV   ro  s     r2   Úget_rhszExprStmt.get_rhs'  sW   € à�}‰}˜RÑ ˆØ�9‰9˜Ò#Ü�4—=‘=Ó! QÒ&Ø—}‘} QÑ'�ð ˆð —}‘} QÑ'�Øˆr4   c              #   óØ   K  — | j                   d   }|j                  dk(  r(t        |j                   «      dk  ry|j                   d   }|–— | j                   ddd…   E d{  –—†  y7 Œ­w)zZ
        Returns a generator of `+=`, `=`, etc. or None if there is no operation.
        r,   rÑ  r›   Nrd  rÖ  ©r/   r  s     r2   Úyield_operatorszExprStmt.yield_operators1  sa   è ø€ ð —‘˜aÑ ˆØ�:‰:˜Ò$Ü�5—>‘>Ó" aÒ'Øà—N‘N 1Ñ%ˆEØŠà—=‘=   A Ñ&×&Ò&ús   ‚A A*Á"A(Á#A*Nr‹   )r5   r6   r7   r"   r8   r‡   r×  rÚ  r!   r4   r2   rÏ  rÏ    s   „ Ø€DØ€Ióòó'r4   rÏ  c                   ó   — e Zd ZdZdd„Zy)Ú	NamedExprr   c                 ó4   — t        | j                  d   |«      S r°  rg  r€   s     r2   r‡   zNamedExpr.get_defined_namesC  ri  r4   Nr‹   )r5   r6   r7   r"   r‡   r!   r4   r2   rÜ  rÜ  @  s   „ Ø€DôAr4   rÜ  c                   óž   ‡ — e Zd ZdZdZdˆ fd„	Zed„ «       Zed„ «       Zed„ «       Z	d„ Z
ed„ «       Zdd	„Zed
„ «       Zd„ Zdˆ fd„	Zd„ Zˆ xZS )r
  zÝ
    It's a helper class that makes business logic with params much easier. The
    Python grammar defines no ``param`` node. It defines it in a different way
    that is not really suited to working with parameters.
    r   c                 ó2   •— t         ‰| �  |«       || _        y rI   )r¾   r¿   r%   )r/   r$   r%   rÁ   s      €r2   r¿   zParam.__init__O  s   ø€ Ü‰Ñ˜Ô"Øˆ�r4   c                 óT   — | j                   d   }|dv rt        |j                  «      S y)zc
        Is `0` in case of `foo`, `1` in case of `*foo` or `2` in case of
        `**foo`.
        r   ©r  rÊ  r•  rÙ  s     r2   Ú
star_countzParam.star_countS  s,   € ð —‘˜aÑ ˆØ�KÑÜ�u—{‘{Ó#Ð#Ør4   c                 óº   — | j                   d   dk(  }	 | j                   dt        |«      z
     dk(  r| j                   dt        |«      z
     S y# t        $ r Y yw xY w)z{
        The default is the test node that appears after the `=`. Is `None` in
        case no default is present.
        rÓ   r|   rH  rÒ  N)r$   r`   r	  )r/   Ú	has_commas     r2   ÚdefaultzParam.default^  se   € ð —M‘M "Ñ%¨Ñ,ˆ	ð	Ø�}‰}˜R¤# i£.Ñ0Ñ1°SÒ8Ø—}‘} R¬#¨i«.Ñ%8Ñ9Ð9ð 9øäò 	Ùð	ús   ”8A Á	AÁAc                 óÀ   — | j                  «       }|j                  dk(  r?|j                  d   dk(  sJ ‚t        |j                  «      dk(  sJ ‚|j                  d   }|S y)zz
        The default is the test node that appears after `:`. Is `None` in case
        no annotation is present.
        r  r,   r+   rd  r›   N)Ú_tfpdefr"   r$   rV   )r/   r  rD  s      r2   rD  zParam.annotationk  s`   € ð —‘“ˆØ�;‰;˜(Ò"Ø—?‘? 1Ñ%¨Ò,Ð,Ð,Ü�v—‘Ó'¨1Ò,Ð,Ð,ØŸ™¨Ñ+ˆJØÐàr4   c                 óT   — t        | j                  d   dv «      }| j                  |   S )z1
        tfpdef: see e.g. grammar36.txt.
        r   rá  )r`   r$   )r/   Úoffsets     r2   rç  zParam._tfpdefz  s+   € ô �T—]‘] 1Ñ%¨Ð4Ó5ˆØ�}‰}˜VÑ$Ð$r4   c                 ó–   — | j                  «       j                  dk(  r| j                  «       j                  d   S | j                  «       S )z/
        The `Name` leaf of the param.
        r  r   )rç  r"   r$   rK   s    r2   r>   z
Param.name�  s;   € ð
 �<‰<‹>×Ñ (Ò*Ø—<‘<“>×*Ñ*¨1Ñ-Ð-à—<‘<“>Ð!r4   c                 ó   — | j                   gS rI   )r>   r€   s     r2   r‡   zParam.get_defined_names‹  s   € Ø—	‘	ˆ{Ðr4   c                 óZ  — | j                   j                  j                  | «      }	 | j                   j                  j                  d«      }||kD  r|dz  }	 | j                   j                  j                  d«      }||kD  r|dz  }|dz
  S # t        $ r Y Œ@w xY w# t        $ r Y |dz
  S w xY w)zB
        Property for the positional index of a paramter.
        r  r›   r  r,   )r%   r$   r.   rv  )r/   r.   Úkeyword_only_indexs      r2   Úposition_indexzParam.position_indexŽ  s¿   € ð
 —‘×$Ñ$×*Ñ*¨4Ó0ˆð	Ø!%§¡×!5Ñ!5×!;Ñ!;¸CÓ!@ÐØÐ)Ò)à˜‘
�ð	Ø!%§¡×!5Ñ!5×!;Ñ!;¸CÓ!@ÐØÐ)Ò)à˜‘
�ð �q‰yÐøô ò 	Ùð	ûô ò 	ØØ�q‰yÐð	ús#   §/B Á/B Â	BÂBÂ	B*Â)B*c                 ó&   — | j                  dd«      S )z=
        Returns the function/lambda of a parameter.
        r)   r,  )r   rK   s    r2   Úget_parent_functionzParam.get_parent_function¤  s   € ð ×#Ñ# I¨yÓ9Ð9r4   c                 ó~   •— |rt         ‰| �  |«      S | j                  }|d   dk(  r|dd }| j                  ||¬«      S )zÀ
        Like all the other get_code functions, but includes the param
        `include_comma`.

        :param include_comma bool: If enabled includes the comma in the string output.
        rÓ   r|   N)Úinclude_prefix)r¾   Úget_coder$   Ú_get_code_for_children)r/   rò  Úinclude_commar$   rÁ   s       €r2   ró  zParam.get_codeª  sV   ø€ ñ Ü‘7Ñ# NÓ3Ð3à—=‘=ˆØ�B‰<˜3ÒØ  �}ˆHØ×*Ñ*ØØ)ð +ó 
ð 	
r4   c                 óÄ   — | j                   €dnd| j                   j                  «       z  }dt        | «      j                  ›dt	        | j                  «       «      |z   ›d�S )NrÖ   z=%sro   rw   rp   )rå  ró  r"   r5   r9   rç  )r/   rå  s     r2   rr   zParam.__repr__¼  sI   € ØŸ™Ð,‘"°%¸$¿,¹,×:OÑ:OÓ:QÑ2Q‰Ü! $›Z×0Ó0´#°d·l±l³nÓ2EÈÓ2OÐPÐPr4   rI   r‹   )TT)r5   r6   r7   rE   r"   r¿   r_   râ  rå  rD  rç  r>   r‡   rî  rð  ró  rr   rÙ   rÚ   s   @r2   r
  r
  G  s’   ø„ ñð
 €Dõð ñó ðð ñ
ó ð
ð ñó ðò%ð ñ"ó ð"óð ñó ðò*:õ
ö$Qr4   r
  c                   ó   — e Zd ZdZdZdd„Zy)ÚSyncCompForr   r!   c                 ó4   — t        | j                  d   |«      S )zN
        Returns the a list of `Name` that the comprehension defines.
        r,   rg  r€   s     r2   r‡   zSyncCompFor.get_defined_namesÅ  s   € ô
 ˜dŸm™m¨AÑ.°Ó@Ð@r4   Nr‹   )r5   r6   r7   r"   r8   r‡   r!   r4   r2   rø  rø  Á  s   „ Ø€DØ€IôAr4   rø  c                   ó4   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	y)	rî   zO
    This class exists for the sole purpose of creating an immutable dict.
    c                 ó   — || _         y rI   ©Ú_dict)r/   rì   s     r2   r¿   zUsedNamesMapping.__init__Ö  s	   € Øˆ�
r4   c                 ó    — | j                   |   S rI   rü  )r/   Úkeys     r2   Ú__getitem__zUsedNamesMapping.__getitem__Ù  s   € Ø�z‰z˜#‰Ðr4   c                 ó,   — t        | j                  «      S rI   )rV   rý  rK   s    r2   Ú__len__zUsedNamesMapping.__len__Ü  s   € Ü�4—:‘:‹Ðr4   c                 ó,   — t        | j                  «      S rI   )Úiterrý  rK   s    r2   Ú__iter__zUsedNamesMapping.__iter__ß  r³   r4   c                 ó   — t        | «      S rI   )ÚidrK   s    r2   r²   zUsedNamesMapping.__hash__â  s   € Ü�$‹xˆr4   c                 ó
   — | |u S rI   r!   r­   s     r2   r¯   zUsedNamesMapping.__eq__å  s   € à�uˆ}Ðr4   N)
r5   r6   r7   rE   r¿   r   r  r  r²   r¯   r!   r4   r2   rî   rî   Ò  s%   „ ñòòòò òór4   rî   )IrE   r•   Úcollections.abcr   Útypingr   r   Ú
parso.treer   r   r   r	   r
   r   Úparso.python.prefixr   Úparso.utilsr   ÚsetÚ_FLOW_CONTAINERSr6  rÍ   r†   rˆ   r    r<   rG   rZ   rb   rf   rh   rj   rl   rt   ry   r�   r�   r“   r    r¥   r¨   r«   rµ   r¸   r»   rÜ   rñ   rô   rú   r  r  rF  rO  rQ  r_  rb  rk  rr  ry  r…  rž  r­  r¶  rº  r¾  rÀ  rh  rÏ  rÜ  r
  rø  ÚCompForrî   r!   r4   r2   Ú<module>r     só  ðñ*óX 
Ý #ß ç R× RÝ ,Ý #áò <ó =Ð á˜w¨Ð6Ó7Ð:JÑJÐ áÚ:óàñÐ ñ ò ó Ð ñ �˜}Ð-Ó.€÷ñ ÷>ñ ô.%�˜dô %ô08˜:ô 8ô�[ (ô ô�˜dô ô�k 9ô ô�i ô ô
Ð$ô 
ôDˆjô Dô1Ðô 1ôhˆjô ôˆWô ô
5ˆWô 5ô"�Jô ô�:ô ô�ô ÷ ñ  ô$Ð#Ð%;ô ô
Ð"Ð$:ô ô
4GˆN˜Nô 4Gôn3 ˆUô 3 ôl�ô ô
�%ô ô6ˆKô ò0*ôZmˆ{ô mô`*EˆXô *EôZˆ>ô ô*ˆTô *ôZ�ô ô
Aˆdô Aôˆdô ô  ˆtô  ô.Bˆ^ô Bô@CK�ô CKôL8*�ô 8*ôv�~ô ô> Ð!ô  ô#Ð!ô #ôÐ!ô ô�ô ò
ô:('ˆ~˜~ô ('ôVA�ô AôwQˆNô wQôt	A�.ô 	Að €ô�wõ r4   