§
    ñyIfï  ã                  óÖ   — d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ ddlmZmZ erdd	lmZ  ed
¦  «        Z G d„ dej        ¦  «        Z G d„ de¦  «        ZdS )z4This module contains mixin classes for scoped nodes.é    )Úannotations)ÚTYPE_CHECKINGÚTypeVarÚoverload)ÚParentMissingError)Ú_filter_stmts)Ú_base_nodesÚscoped_nodes)Úbuiltin_lookup)ÚInferenceResultÚSuccessfulInferenceResult)ÚnodesÚ_Tc                  óÂ   — e Zd ZU dZded<   	 d*d„Zd+d	„Z	 d,d-d„Z	 d,d-d„Zd.d„Z	e	Z
d/d„Ze	 d0d1d„¦   «         Zed2d„¦   «         Zd3d4d „Zd5d#„Zd$„ Zd%„ Zd&„ Zd'„ Zd6d)„ZdS )7ÚLocalsDictNodeNGzªthis class provides locals handling common to Module, FunctionDef
    and ClassDef nodes, including a dict like interface for direct access
    to locals information
    z dict[str, list[InferenceResult]]ÚlocalsÚreturnÚstrc                ó¸   — | j         €| j        S 	 | j                              ¦   «                              ¦   «         › d| j        › �S # t          $ r
 | j        cY S w xY w)z¢Get the 'qualified' name of the node.

        For example: module.name, module.class.name ...

        :returns: The qualified name.
        :rtype: str
        Nú.)ÚparentÚnameÚframeÚqnamer   ©Úselfs    úT/var/www/piapp/venv/lib/python3.11/site-packages/astroid/nodes/scoped_nodes/mixin.pyr   zLocalsDictNodeNG.qname!   sr   € ð Œ;ÐØ”9Ðð	Ø”k×'Ò'Ñ)Ô)×/Ò/Ñ1Ô1Ð?Ð?°D´IÐ?Ð?Ð?øÝ!ð 	ð 	ð 	Ø”9ÐÐÐð	øøøs   �4A ÁAÁAr   r   c                ó   — | 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   s    r   ÚscopezLocalsDictNodeNG.scope1   s	   € ð ˆó    r   Únodeú_base_nodes.LookupMixInr   ÚoffsetÚintú+tuple[LocalsDictNodeNG, list[nodes.NodeNG]]c                ó   — t           ‚)aþ  Lookup where the given variable is assigned.

        :param node: The node to look for assignments up to.
            Any assignments after the given node are ignored.

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

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

        :returns: This 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).
        )ÚNotImplementedError)r   r"   r   r$   s       r   Úscope_lookupzLocalsDictNodeNG.scope_lookup9   s
   € õ  "Ð!r!   c                óv  — 	 t          || j        |         | |¦  «        }n# t          $ r d}Y nw xY w|r| |fS | j        o| j                             ¦   «         }|�Rt          |t          j        ¦  «        s|                     ||¦  «        S |j        o|j                             ¦   «         }|­Rt          |¦  «        S )z+XXX method for interfacing the scope lookupr   )
r   r   ÚKeyErrorr   r    Ú
isinstancer
   ÚClassDefr)   r   )r   r"   r   r$   ÚstmtsÚpscopes         r   Ú_scope_lookupzLocalsDictNodeNG._scope_lookupK   sØ   € ð	Ý! $¨¬°DÔ(9¸4ÀÑHÔHˆEˆEøÝð 	ð 	ð 	ØˆEˆEˆEð	øøøàð 	Ø˜�;Ðð ”Ð4 ¤×!2Ò!2Ñ!4Ô!4ˆØÐ Ý˜f¥lÔ&;Ñ<Ô<ð 7Ø×*Ò*¨4°Ñ6Ô6Ð6Ø”]Ð< v¤}×':Ò':Ñ'<Ô'<ˆFð Ð õ ˜dÑ#Ô#Ð#s   ‚   /®/Ústmtúnodes.NodeNGÚNonec                ób   — | j                              |g ¦  «                             |¦  «         dS )zçDefine that the given name is declared in the given statement node.

        .. seealso:: :meth:`scope`

        :param name: The name that is being defined.

        :param stmt: The statement that defines the given name.
        N)r   Ú
setdefaultÚappend)r   r   r1   s      r   Ú	set_localzLocalsDictNodeNG.set_locala   s0   € ð 	Œ×Ò˜t RÑ(Ô(×/Ò/°Ñ5Ô5Ð5Ð5Ð5r!   Úchildc                óH   — | j                              |¦  «         | |_        dS )z&append a child, linking it in the treeN)Úbodyr6   r   )r   r8   s     r   Ú_append_nodezLocalsDictNodeNG._append_nodeo   s%   € ð 	Œ	×Ò˜ÑÔÐØˆŒˆˆr!   .Ú
child_nodeúnodes.ClassDefú
str | Nonec                ó   — d S ©Nr   ©r   r<   r   s      r   Úadd_local_nodezLocalsDictNodeNG.add_local_nodex   s	   € ð ˆsr!   c                ó   — d S r@   r   rA   s      r   rB   zLocalsDictNodeNG.add_local_node}   s   € ØKNÈ3r!   Nc                óv   — |dk    r|                       |¦  «         |                      |p|j        |¦  «         dS )zñAppend a child that should alter the locals of this scope node.

        :param child_node: The child node that will alter locals.

        :param name: The name of the local that will be altered by
            the given child node.
        Ú	__class__N)r;   r7   r   rA   s      r   rB   zLocalsDictNodeNG.add_local_node€   sD   € ð �;ÒÐà×Ò˜jÑ)Ô)Ð)Ø�Š�tÐ.˜zœ°
Ñ;Ô;Ð;Ð;Ð;r!   Úitemr   c                ó(   — | j         |         d         S )z©The first node the defines the given local.

        :param item: The name of the locally defined object.

        :raises KeyError: If the name is not defined.
        r   ©r   )r   rF   s     r   Ú__getitem__zLocalsDictNodeNG.__getitem__�   s   € ð Œ{˜4Ô  Ô#Ð#r!   c                óD   — t          |                      ¦   «         ¦  «        S )z˜Iterate over the names of locals defined in this scoped node.

        :returns: The names of the defined locals.
        :rtype: iterable(str)
        )ÚiterÚkeysr   s    r   Ú__iter__zLocalsDictNodeNG.__iter__–   s   € õ �D—I’I‘K”KÑ Ô Ð r!   c                óN   — t          | j                             ¦   «         ¦  «        S )z‡The names of locals defined in this scoped node.

        :returns: The names of the defined locals.
        :rtype: list(str)
        )Úlistr   rL   r   s    r   rL   zLocalsDictNodeNG.keysž   s    € õ �D”K×$Ò$Ñ&Ô&Ñ'Ô'Ð'r!   c                óD   ‡ — ˆ fd„‰                       ¦   «         D ¦   «         S )zŒThe nodes that define the locals in this scoped node.

        :returns: The nodes that define locals.
        :rtype: list(NodeNG)
        c                ó    •— g | ]
}‰|         ‘ŒS r   r   )Ú.0Úkeyr   s     €r   ú
<listcomp>z+LocalsDictNodeNG.values.<locals>.<listcomp>¯   s   ø€ Ð1Ð1Ð1˜c��S”	Ð1Ð1Ð1r!   )rL   r   s   `r   ÚvalueszLocalsDictNodeNG.values¦   s'   ø€ ð 2Ð1Ð1Ð1 T§Y¢Y¡[¤[Ð1Ñ1Ô1Ð1r!   c                ó„   — t          t          |                      ¦   «         |                      ¦   «         ¦  «        ¦  «        S )z´Get the names of the locals and the node that defines the local.

        :returns: The names of locals and their associated node.
        :rtype: list(tuple(str, NodeNG))
        )rO   ÚziprL   rU   r   s    r   ÚitemszLocalsDictNodeNG.items±   s,   € õ •C˜Ÿ	š	™œ T§[¢[¡]¤]Ñ3Ô3Ñ4Ô4Ð4r!   Úboolc                ó   — || j         v S )zÉCheck if a local is defined in this scope.

        :param name: The name of the local to check for.
        :type name: str

        :returns: Whether this node has a local of the given name,
        rH   )r   r   s     r   Ú__contains__zLocalsDictNodeNG.__contains__¹   s   € ð �t”{Ð"Ð"r!   )r   r   )r   r   r   r   )r   )r"   r#   r   r   r$   r%   r   r&   )r   r   r1   r2   r   r3   )r8   r2   r   r3   ).)r<   r=   r   r>   r   r3   )r<   r2   r   r   r   r3   r@   )r<   r2   r   r>   r   r3   )rF   r   r   r   )r   rY   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r    r)   r0   r7   Ú__setitem__r;   r   rB   rI   rM   rL   rU   rX   r[   r   r!   r   r   r      s…  € € € € € € ðð ð -Ð,Ð,Ñ,ØOðð ð ð ð ð ð ð ð GHð"ð "ð "ð "ð "ð& GHð$ð $ð $ð $ð $ð,
6ð 
6ð 
6ð 
6ð €Kðð ð ð ð à=@ðð ð ð ñ „Xðð ØNÐNÐNñ „XØNð<ð <ð <ð <ð <ð$ð $ð $ð $ð!ð !ð !ð(ð (ð (ð	2ð 	2ð 	2ð5ð 5ð 5ð#ð #ð #ð #ð #ð #r!   r   c                  ó,   — e Zd ZU dZej        Zded<   dS )ÚComprehensionScopez.Scoping for different types of comprehensions.zlist[nodes.Comprehension]Ú
generatorsN)r\   r]   r^   r_   r   r0   r)   r`   r   r!   r   rc   rc   Ä   s,   € € € € € € Ø8Ð8à#Ô1€Là)Ð)Ð)Ñ)Ø1Ð1r!   rc   N)r_   Ú
__future__r   Útypingr   r   r   Úastroid.exceptionsr   Úastroid.filter_statementsr   Úastroid.nodesr	   r
   Ú astroid.nodes.scoped_nodes.utilsr   Úastroid.typingr   r   Úastroidr   r   ÚLookupMixInr   rc   r   r!   r   ú<module>rn      s5  ðð
 ;Ð :à "Ð "Ð "Ð "Ð "Ð "à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3à 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø EÐ EÐ EÐ EÐ EÐ EÐ EÐ Eàð ØÐÐÐÐÐà€WˆT�]„]€ðj#ð j#ð j#ð j#ð j#�{Ô.ñ j#ô j#ð j#ðZ2ð 2ð 2ð 2ð 2Ð)ñ 2ô 2ð 2ð 2ð 2r!   