§ |<ˆj³ãóD—dZddlmZddlZddlmZmZddlmZddl m Z ddl m Z m Z mZddlmZejd krdd l mZndd lmZe e je je je jfZGd „d e¦«ZGd „de¦«Zd!d„Zeef¦«Z d"d„Z d#d$d „ZdS)%zHClasses representing different types of constraints on inference values.é)Ú annotationsN)ÚABCÚabstractmethod)ÚIterator)ÚUnion)ÚbasesÚnodesÚutil)ÚInferenceResult)éé )ÚSelfcó^—eZdZdZdd„Zee ddd„¦«¦«Zedd„¦«ZdS)Ú Constraintz-Represents a single constraint on a variable.Únodeú nodes.NodeNGÚnegateÚboolÚreturnÚNonecó$—||_ ||_dS)N©rr)Úselfrrs úd/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/astroid/constraint.pyÚ__init__zConstraint.__init__s€ØˆŒ Ø7؈Œ ØQÐQóFÚclsú type[Self]Ú _NameNodesÚexprú Self | Nonecó—dS)zŸReturn a new constraint for node matched from expr, if expr matches the constraint pattern. If negate is True, negate the constraint. N©)rrr rs rÚmatchzConstraint.match!ó€€€rÚinferredr có—dS)úHReturn True if this constraint is satisfied by the given inferred value.Nr#©rr&s rÚ satisfied_byzConstraint.satisfied_by,r%rN)rrrrrr©F© rrrrr rrrrr!©r&r rr) Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚ classmethodrr$r*r#rrrrsŠ€€€€€Ø7Ð7ðRðRðRðRð ØàNSð ð ð ð ñ„^ñ„[ð ððWðWðWñ„^ðWðWðWrrcób—eZdZUdZejd¦«Zded<e ddd„¦«Z dd„Z dS)ÚNoneConstraintz4Represents an "is None" or "is not None" constraint.Nz nodes.ConstÚ CONST_NONEFrrrrr rrrrr!có&—t|tj¦«rvt|j¦«dkr^|j}|jd\}}|dvrCt ||¦«r3t ||j¦«r|dkr|p|dko| }|||¬¦«SdS)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 notr8r9rN)Ú isinstancer ÚCompareÚlenÚopsÚleftÚ_matchesr5)rrr rr>ÚopÚrights rr$zNoneConstraint.match6s¬€õ �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àˆtrr&r cót—t|tj¦«rdS|jt ||j¦«z S)r(T)r:r ÚUninferableBaserr?r5r)s rr*zNoneConstraint.satisfied_byJs9€õ �h¥Ô 4Ñ 5Ô 5ð Ø�4ðŒ{�X h°´Ñ@Ô@Ñ@Ð@rr+r,r-) r.r/r0r1r ÚConstr5Ú__annotations__r2r$r*r#rrr4r41sy€€€€€€Ø>Ð>à)˜eœk¨$Ñ/Ô/€JÐ/Ð/Ð/Ñ/ààNSððððñ„[ðð&AðAðAðAðAðArr4r rÚframeúnodes.LocalsDictNodeNGrúdict[nodes.If, set[Constraint]]cóT—|}i}|�¡||ur�|j}t|tj¦«rt| |¦«\}}d}|dkr#t t ||j¦«¦«}n*|dkr$t t ||jd¬¦«¦«}|r|||<|}|�||u°�|S)aHReturns 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_constraintsrXTsÚ€ð)-€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Únode2rrcóÒ—t|tj¦«r*t|tj¦«r|j|jkSt|tj¦«rDt|tj¦«r*|j|jkot |j|j¦«St|tj¦«r*t|tj¦«r|j |j kSdS)z$Returns True if the two nodes match.F) r:r ÚNameÚnameÚ AttributeÚattrnamer?r rDÚvalue)rYr[s rr?r?vs¾€å�%�œÑ$Ô$ð(­°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Ò)Ð)à ˆ5rFrrLúIterator[Constraint]c#óXK—tD]}| |||¦«}|r|V—Œ dS)z3Yields all constraint patterns for node that match.N)ÚALL_CONSTRAINT_CLASSESr$)rr rLÚconstraint_clsÚ constraints rrQrQ‚sMèè€õ1ððˆØ#×)Ò)¨$°°fÑ=Ô=ˆ Ø ð ØÐ Ð Ð øððr)r rrFrGrrH)rYrZr[rrrr+)rrr rrLrrrb) r1Ú __future__rÚsysÚabcrrÚcollections.abcrÚtypingrÚastroidrr r Úastroid.typingr Ú version_inforÚtyping_extensionsÚ AssignAttrr_Ú AssignNamer]rrr4rXÚ frozensetrdr?rQr#rrúrss´ðð 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