ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/astroid/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/astroid/__pycache__/constraint.cpython-311.pyc

�

�܋f���D�dZddlmZddlZddlmZmZddlmZddl	m
Z
ddlm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   �c/builddir/build/BUILD/cloudlinux-venv-1.0.6/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�inferredrc��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&rrr)	�__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.Nznodes.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&rc�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#tt
||j����}n*|dkr$tt
||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�<module>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

Zerion Mini Shell 1.0