§
    ñyIfÞ  ã                  óT  — d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZ ddlmZmZ ddlmZ ej        d	k    rdd
l	mZ ndd
lmZ e
rddlmZ eej        ej        ej        ej        f         Z G d„ de¦  «        Z G d„ de¦  «        Zd"d„Z eef¦  «        Z	 d#d„Z	 d$d%d!„Z dS )&zHClasses representing different types of constraints on inference values.é    )ÚannotationsN)ÚABCÚabstractmethod)ÚIterator)ÚTYPE_CHECKINGÚUnion)ÚnodesÚutil)ÚInferenceResult)é   é   )ÚSelf)Úbasesc                  ó^   — e Zd ZdZdd„Zee	 ddd„¦   «         ¦   «         Zedd„¦   «         ZdS )Ú
Constraintz-Represents a single constraint on a variable.Únodeúnodes.NodeNGÚnegateÚboolÚreturnÚNonec                ó$   — || _         	 || _        d S )N©r   r   )Úselfr   r   s      úF/var/www/piapp/venv/lib/python3.11/site-packages/astroid/constraint.pyÚ__init__zConstraint.__init__   s   € ØˆŒ	Ø7ØˆŒØQÐQó    FÚ
_NameNodesÚexprúSelf | Nonec                ó   — dS )zŸReturn a new constraint for node matched from expr, if expr matches
        the constraint pattern.

        If negate is True, negate the constraint.
        N© )Úclsr   r   r   s       r   ÚmatchzConstraint.match$   ó   € € € r   Úinferredr   c                ó   — dS )úHReturn True if this constraint is satisfied by the given inferred value.Nr"   ©r   r&   s     r   Úsatisfied_byzConstraint.satisfied_by/   r%   r   N)r   r   r   r   r   r   ©F©r   r   r   r   r   r   r   r    ©r&   r   r   r   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úclassmethodr   r$   r*   r"   r   r   r   r      sŠ   € € € € € Ø7Ð7ðRð Rð Rð Rð ØàBGðð ð ð ñ „^ñ „[ðð ðWð Wð Wñ „^ðWð Wð Wr   r   c                  ób   — e Zd ZU dZ ej        d¦  «        Zded<   e	 ddd„¦   «         Z	dd„Z
dS )ÚNoneConstraintz4Represents an "is None" or "is not None" constraint.Nznodes.ConstÚ
CONST_NONEFr   r   r   r   r   r   r   r    c                ó&  — t          |t          j        ¦  «        rvt          |j        ¦  «        dk    r^|j        }|j        d         \  }}|dv rCt          ||¦  «        r3t          || j        ¦  «        r|dk    r|p|dk    o| } | ||¬¦  «        S dS )z©Return a new constraint for node matched from expr, if expr matches
        the constraint pattern.

        Negate the constraint based on the value of negate.
        é   r   >   Úisúis notr8   r9   r   N)Ú
isinstancer	   ÚCompareÚlenÚopsÚleftÚ_matchesr5   )r#   r   r   r   r>   ÚopÚrights          r   r$   zNoneConstraint.match9   s¬   € õ �d�EœMÑ*Ô*ð 	5­s°4´8©}¬}ÀÒ/AÐ/AØ”9ˆDØœ œ‰IˆB�ØÐ%Ð%Ð%Ý˜˜tÑ$Ô$ð &Ý)1°%¸¼Ñ)HÔ)Hð &ð  š*Ð/¨ÐS°R¸8²^Ð5RÈFÈ
�Ø�s ¨VÐ4Ñ4Ô4Ð4àˆtr   r&   r   c                ót   — t          |t          j        ¦  «        rdS | j        t	          || j        ¦  «        z  S )r(   T)r:   r
   ÚUninferableBaser   r?   r5   r)   s     r   r*   zNoneConstraint.satisfied_byM   s9   € õ �h¥Ô 4Ñ5Ô5ð 	Ø�4ð Œ{�X h°´Ñ@Ô@Ñ@Ð@r   r+   r,   r-   )r.   r/   r0   r1   r	   ÚConstr5   Ú__annotations__r2   r$   r*   r"   r   r   r4   r4   4   sy   € € € € € € Ø>Ð>à)˜eœk¨$Ñ/Ô/€JÐ/Ð/Ð/Ñ/ààBGðð ð ð ñ „[ðð&Að Að Að Að Að Ar   r4   r   r   Úframeúnodes.LocalsDictNodeNGr   údict[nodes.If, set[Constraint]]c                óT  — | }i }|�¡||ur�|j         }t          |t          j        ¦  «        rt|                     |¦  «        \  }}d}|dk    r#t          t          | |j        ¦  «        ¦  «        }n*|dk    r$t          t          | |j        d¬¦  «        ¦  «        }|r|||<   |}|�||u°�|S )aH  Returns the constraints for the given expression.

    The returned dictionary maps the node where the constraint was generated to the
    corresponding constraint(s).

    Constraints are computed statically by analysing the code surrounding expr.
    Currently this only supports constraints generated from if conditions.
    NÚbodyÚorelseT)Úinvert)Úparentr:   r	   ÚIfÚlocate_childÚsetÚ_match_constraintÚtest)r   rF   Úcurrent_nodeÚconstraints_mappingrM   ÚbranchÚ_Úconstraintss           r   Úget_constraintsrX   W   sÚ   € ð )-€LØ;=ÐØ
Ð
" |¸5Ð'@Ð'@ØÔ$ˆÝ�f�eœhÑ'Ô'ð 		:Ø×+Ò+¨LÑ9Ô9‰IˆF�AØ26ˆKØ˜ÒÐÝ!Õ"3°D¸&¼+Ñ"FÔ"FÑGÔG��Ø˜8Ò#Ð#Ý!Õ"3°D¸&¼+ÈdÐ"SÑ"SÔ"SÑTÔT�àð :Ø.9Ð# FÑ+Øˆð Ð
" |¸5Ð'@Ð'@ð Ðr   Únode1únodes.NodeNG | bases.ProxyÚnode2r   r   c                óÒ  — t          | t          j        ¦  «        r*t          |t          j        ¦  «        r| j        |j        k    S t          | t          j        ¦  «        rDt          |t          j        ¦  «        r*| j        |j        k    ot          | j        |j        ¦  «        S t          | t          j        ¦  «        r*t          |t          j        ¦  «        r| j	        |j	        k    S dS )z$Returns True if the two nodes match.F)
r:   r	   ÚNameÚnameÚ	AttributeÚattrnamer?   r   rD   Úvalue)rY   r[   s     r   r?   r?   y   s¾   € å�%�œÑ$Ô$ð (­°E½5¼:Ñ)FÔ)Fð (ØŒz˜UœZÒ'Ð'Ý�%�œÑ)Ô)ð U­j¸ÅÄÑ.PÔ.Pð UØŒ~ ¤Ò/ÐTµH¸U¼ZÈÌÑ4TÔ4TÐTÝ�%�œÑ%Ô%ð *­*°U½E¼KÑ*HÔ*Hð *ØŒ{˜eœkÒ)Ð)àˆ5r   Fr   rL   úIterator[Constraint]c              #  óX   K  — t           D ]}|                     | ||¦  «        }|r|V — Œ dS )z3Yields all constraint patterns for node that match.N)ÚALL_CONSTRAINT_CLASSESr$   )r   r   rL   Úconstraint_clsÚ
constraints        r   rQ   rQ   …   sM   è è € õ 1ð ð ˆØ#×)Ò)¨$°°fÑ=Ô=ˆ
Øð 	ØÐÐÐøðð r   )r   r   rF   rG   r   rH   )rY   rZ   r[   r   r   r   r+   )r   r   r   r   rL   r   r   rb   )!r1   Ú
__future__r   ÚsysÚabcr   r   Úcollections.abcr   Útypingr   r   Úastroidr	   r
   Úastroid.typingr   Úversion_infor   Útyping_extensionsr   Ú
AssignAttrr_   Ú
AssignNamer]   r   r   r4   rX   Ú	frozensetrd   r?   rQ   r"   r   r   ú<module>rs      sÎ  ðð
 OÐ NØ "Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø $Ð $Ð $Ð $Ð $Ð $Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'Ð 'à Ð Ð Ð Ð Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *àÔ�wÒÐØÐÐÐÐÐÐà&Ð&Ð&Ð&Ð&Ð&àð ØÐÐÐÐÐà�5Ô# U¤_°eÔ6FÈÌ
ÐRÔS€
ðWð Wð Wð Wð W�ñ Wô Wð Wð2 Að  Að  Að  Að  A�Zñ  Aô  Að  AðFð ð ð ð< #˜ NÐ#4Ñ5Ô5Ð Ø %ð	ð 	ð 	ð 	ð :?ðð ð ð ð ð ð r   