+
    i(                        R t ^ RIHt ^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHtHtHt ^ RIHtHtHt ^ RIHt ]P*                  R8  d   ^ R	I	Ht M^ R	IHt ]
'       d   ^ R
IHt ]P2                  ]P4                  ,          ]P6                  ,          ]P8                  ,          t ! R R]4      t ! R R]4      t ! R R]4      t  ! R R]4      t! ! R R]4      t"R R lt#]$! ]] ]!]"34      t% R R lt&RR R llt'R# )zHClasses representing different types of constraints on inference values.)annotationsN)ABCabstractmethod)Iterator)TYPE_CHECKING)helpersnodesutil)AstroidTypeErrorInferenceErrorMroError)InferenceResult)Self)basesc                  `    ] tR t^tRtR R lt]]R
R R ll4       4       t]R R l4       t	Rt
R	# )
Constraintz-Represents a single constraint on a variable.c               $    V ^8  d   QhRRRRRR/# )   nodenodes.NodeNGnegateboolreturnNone )formats   "4/usr/lib/python3/dist-packages/astroid/constraint.py__annotate__Constraint.__annotate__    s&     R R\ R4 RD R    c                	     Wn          W n        R # )Nr   r   )selfr   r   s   &&&r   __init__Constraint.__init__    s    	7Qr   c               (    V ^8  d   QhRRRRRRRR/# 	r   r   
_NameNodesexprr   r   r   r   zSelf | Noner   )r   s   "r   r   r   (   s,      %1;?	r   c                    R# )zReturn a new constraint for node matched from expr, if expr matches
the constraint pattern.

If negate is True, negate the constraint.
Nr   clsr   r(   r   s   &&&&r   matchConstraint.match&       r   c                    V ^8  d   QhRRRR/# r   inferredr   r   r   r   )r   s   "r   r   r   2   s     W W_ W Wr   c                    R# )HReturn True if this constraint is satisfied by the given inferred value.Nr   r"   r1   s   &&r   satisfied_byConstraint.satisfied_by1   r.   r   )r   r   NF)__name__
__module____qualname____firstlineno____doc__r#   classmethodr   r,   r5   __static_attributes__r   r   r   r   r      s=    7R    W Wr   r   c                  p    ] tR t^6t$ Rt]P                  ! R4      tR]R&   ]	R
R R ll4       t
R R ltR	tR# )NoneConstraintz4Represents an "is None" or "is not None" constraint.Nznodes.Const
CONST_NONEc               (    V ^8  d   QhRRRRRRRR/# r&   r   )r   s   "r   r   NoneConstraint.__annotate__<   s,      %1;?	r   c                   \        V\        P                  4      '       d   \        VP                  4      ^8X  d   VP
                  pVP                  ^ ,          w  rVVR9   da   \        WA4      '       dP   \        W`P                  4      '       d5   VR8H  ;'       d    T;'       g    VR8H  ;'       d    V'       * pV ! WR7      # R# )zReturn a new constraint for node matched from expr, if expr matches
the constraint pattern.

Negate the constraint based on the value of negate.
isis notr!   N>   rE   rF   )
isinstancer   Comparelenopsleft_matchesrA   )r+   r   r(   r   rK   oprights   &&&&   r   r,   NoneConstraint.match;   s     dEMM**s488}/A99DIB%%$$%)H)H*//SSR8^5R5RF
44r   c                    V ^8  d   QhRRRR/# r0   r   )r   s   "r   r   rC   O   s     A A_ A Ar   c                z    V\         P                  J d   R# V P                  \        WP                  4      ,          # )r3   T)r	   Uninferabler   rL   rA   r4   s   &&r   r5   NoneConstraint.satisfied_byO   s/     t''' {{Xh@@@r   r   r7   )r8   r9   r:   r;   r<   r   ConstrA   __annotations__r=   r,   r5   r>   r   r   r   r@   r@   6   s6    >#kk$/J/ &A Ar   r@   c                  @    ] tR t^YtRt]RR R ll4       tR R ltRtR# )	BooleanConstraintz(Represents an "x" or "not x" constraint.c               (    V ^8  d   QhRRRRRRRR/# r&   r   )r   s   "r   r   BooleanConstraint.__annotate__]   ,      %1;?	r   c                    \        W!4      '       d
   V ! WR7      # \        V\        P                  4      '       d<   VP                  R8X  d+   \        VP
                  V4      '       d   V ! W'       * R7      # R# )zReturn a new constraint for node if expr matches one of these patterns:

- direct match (expr == node): use given negate value
- negated match (expr == `not node`): flip negate value

Return None if no pattern matches.
r!   notN)rL   rG   r   UnaryOprM   operandr*   s   &&&&r   r,   BooleanConstraint.match\   sZ     DD00 tU]]++5 t,,D44r   c                    V ^8  d   QhRRRR/# r0   r   )r   s   "r   r   rY   s   s     
1 
1_ 
1 
1r   c                    VP                  4       pV\        P                  J g   V\        P                  J d   R# V P                  V,          # )zReturn True for uninferable results, or depending on negate flag:

- negate=False: satisfied if boolean value is True
- negate=True: satisfied if boolean value is False
T)
bool_valuer	   rR   r   )r"   r1   inferred_booleanesss   && r   r5   BooleanConstraint.satisfied_bys   sB     '113t'''+>$BRBR+R{{000r   r   Nr7   )	r8   r9   r:   r;   r<   r=   r,   r5   r>   r   r   r   rW   rW   Y   s!    2 ,
1 
1r   rW   c                  X   a  ] tR t^tRtR V 3R llt]R	R R ll4       tR R ltRt	V ;t
# )
TypeConstraintz,Represents an "isinstance(x, y)" constraint.c               (    V ^8  d   QhRRRRRRRR/# )r   r   r   	classinfor   r   r   r   r   )r   s   "r   r   TypeConstraint.__annotate__   s,     # # #-9#CG#	#r   c                	4   < \         SV `  WR 7       W n        R# r!   N)superr#   rh   )r"   r   rh   r   	__class__s   &&&&r   r#   TypeConstraint.__init__   s     	d2"r   c               (    V ^8  d   QhRRRRRRRR/# r&   r   )r   s   "r   r   ri      s,      %1;?	r   c                   \        V\        P                  4      ;'       d    \        VP                  \        P                  4      ;'       dS    VP                  P
                  R8H  ;'       d2    VP                  '       * ;'       d    \        VP                  4      ^8H  pV'       d?   \        VP                  ^ ,          V4      '       d   V ! WP                  ^,          VR7      # R# )zdReturn a new constraint for node if expr matches the
"isinstance(x, y)" pattern. Else, return None.
rG   )r   rh   r   N)
rG   r   CallfuncNamenamekeywordsrI   argsrL   )r+   r   r(   r   is_instance_calls   &&&& r   r,   TypeConstraint.match   s     tUZZ( $ $499ejj1$ $		,.$ $ MM!$ $ DII!# 	 1t < <DIIaLHHr   c                    V ^8  d   QhRRRR/# r0   r   )r   s   "r   r   ri      s      _  r   c                (   V\         P                  J d   R#  \        P                  ! V P                  4      p\        P
                  ! W4      pV\         P                  J d   R# V P                  V,          #   \        \        \        3 d     R# i ; i)zReturn True for uninferable results, or depending on negate flag:

- negate=False: satisfied when inferred is an instance of the checked types.
- negate=True: satisfied when inferred is not an instance of the checked types.
T)
r	   rR   r   class_or_tuple_to_containerrh   object_isinstancer   r   r
   r   )r"   r1   typesmatches_checked_typess   &&  r   r5   TypeConstraint.satisfied_by   sz     t'''		77GE$+$=$=h$N!$(8(88;;!666 0(; 		s   A
A7 $A7 7BB)rh   r7   r8   r9   r:   r;   r<   r#   r=   r,   r5   r>   __classcell__rm   s   @r   rf   rf      s.    6# #  $ r   rf   c                  X   a  ] tR t^tRtR V 3R llt]R	R R ll4       tR R ltRt	V ;t
# )
EqualityConstraintz%Represents a "==" or "!=" constraint.c               (    V ^8  d   QhRRRRRRRR/# )r   r   r   r^   r   r   r   r   r   )r   s   "r   r   EqualityConstraint.__annotate__   s)      \ L $ SW r   c                	4   < \         SV `  WR 7       W n        R# rk   )rl   r#   r^   )r"   r   r^   r   rm   s   &&&&r   r#   EqualityConstraint.__init__   s    d2r   c               (    V ^8  d   QhRRRRRRRR/# r&   r   )r   s   "r   r   r      rZ   r   c                   \        V\        P                  4      '       d   \        VP                  4      ^8X  d   VP
                  pVP                  ^ ,          w  rV\        WA4      pVR9   d[   V'       g   \        Wa4      '       dB   V'       d   TMTpVR8H  ;'       d    T;'       g    VR8H  ;'       d    V'       * pV ! WVR7      # R# )zReturn a new constraint for node if expr matches one of these patterns:

- "node == operand" or "operand == node": use given negate value
- "node != operand" or "operand != node": flip negate value

Return None if no pattern matches.
==!=)r   r^   r   N>   r   r   )rG   r   rH   rI   rJ   rK   rL   )	r+   r   r(   r   rK   rM   rN   matches_leftr^   s	   &&&&     r   r,   EqualityConstraint.match   s     dEMM**s488}/A99DIB#D/L\!|x7L7L#/%T*//OOR4Z5N5NJfEEr   c                    V ^8  d   QhRRRR/# r0   r   )r   s   "r   r   r      s      _  r   c                   V\         P                  J d   R# \         P                  ! V P                  4      pV\         P                  J g   Vf   R# \	        V\
        P                  4      '       dK   \	        V\
        P                  4      '       d+   V P                  VP                  VP                  8H  ,          # VP                  4       '       d+   VP                  4       '       d   V P                  WJ ,          # R# )a  Return True for uninferable/ambiguous results, or depending on negate flag:

- negate=False: satisfied when both operands are equal.
- negate=True: satisfied when both operands are not equal.

Only comparisons between constants and callables are supported.
T)
r	   rR   
safe_inferr^   rG   r   rT   r   valuecallable)r"   r1   operand_inferreds   && r   r5   EqualityConstraint.satisfied_by   s     t'''??4<<8t///3C3Kh,,ekk2
 2
 ;;(..4D4J4J"JKK#3#<#<#>#>;;(">??r   )r^   r7   r   r   s   @r   r   r      s.    /   , r   r   c               $    V ^8  d   QhRRRRRR/# )r   r(   r'   frameznodes.LocalsDictNodeNGr   z-dict[nodes.If | nodes.IfExp, set[Constraint]]r   )r   s   "r   r   r      s$      
32r   c                |   T p/ pVe   W!Jd   VP                   p\        V\        P                  \        P                  34      '       do   VP                  V4      w  rVRpVR8X  d    \        \        WP                  4      4      pM'VR8X  d!   \        \        WP                  RR7      4      pV'       d   WsV&   TpK  V# )a4  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)	parentrG   r   IfIfExplocate_childset_match_constrainttest)r(   r   current_nodeconstraints_mappingr   branch_constraintss   &&      r   get_constraintsr      s     )-LIK

"|'@$$fuxx566++L9IF26K!"3D++"FG8#!"3D++d"ST.9F+r   c               $    V ^8  d   QhRRRRRR/# )r   node1znodes.NodeNG | bases.Proxynode2r   r   r   r   )r   s   "r   r   r     s"     	 	. 	| 	 	r   c                l   \        V \        P                  4      '       d:   \        V\        P                  4      '       d   V P                  VP                  8H  # \        V \        P                  4      '       db   \        V\        P                  4      '       dB   V P
                  VP
                  8H  ;'       d!    \        V P                  VP                  4      # \        V \        P                  4      '       d:   \        V\        P                  4      '       d   V P                  VP                  8H  # R# )z$Returns True if the two nodes match.F)
rG   r   rs   rt   	AttributeattrnamerL   r(   rT   r   )r   r   s   &&r   rL   rL     s    %$$E5::)F)FzzUZZ''%))j.P.P~~/TTHUZZ4TT%%%*UEKK*H*H{{ekk))r   c               (    V ^8  d   QhRRRRRRRR/# )	r   r   r'   r(   r   r   r   r   zIterator[Constraint]r   )r   s   "r   r   r     s,      
(26r   c              #  h   "   \          F#  pVP                  WV4      pV'       g   K  Vx  K%  	  R# 5i)z3Yields all constraint patterns for node that match.N)ALL_CONSTRAINT_CLASSESr,   )r   r(   r   constraint_cls
constraints   &&&  r   r   r     s.      1#))$f=
: 1s   !2
2)      r7   )(r<   
__future__r   sysabcr   r   collections.abcr   typingr   astroidr   r   r	   astroid.exceptionsr
   r   r   astroid.typingr   version_infor   typing_extensionsr   
AssignAttrr   
AssignNamers   r'   r   r@   rW   rf   r   r   	frozensetr   rL   r   r   r   r   <module>r      s   
 O " 
 # $   ( ( I I *w&/%2B2BBUZZO
W W2 AZ  AF$1
 $1N.Z .b5 5p< #	  &	 r   