AlkantarClanX12

Your IP : 18.224.53.246


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/astroid/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/astroid/__pycache__/inference.cpython-311.pyc

�

�܋fA��	�
�UdZddlmZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZddlm
Z
mZmZmZmZddlmZmZmZmZmZmZmZddlmZddlmZmZmZm Z dd	l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*dd
l+m,Z,ddl-m.Z.ddl/m0Z0m1Z1m2Z2e
rdd
l3m4Z4ej5d��Z6ed��Z7edej8���Z9edej:���Z;ej	e1ee1eej<ej=fe1ee1eegdfZ>	d�d�d�Z?e?ej@_Ae?ejB_Ae?ejC_Ae?ejD_Ae?ejE_A	d�d�d�ZFejG	d�d�d ���ZHeHejI_AeHejJ_AeHejK_A	d�d�d#�ZLd�d'�ZMd�d(�ZNeLejO_Ad�d+�ZP	d�d�d.�ZQejGejReQ����ejS_AeQejT_UejGejR	d�d�d1�����ZVeVejW_AejGejR		d�d�d7�����ZXeXejY_AejGejR		d�d�d9�����ZZeZej[_A	d�d�d;�Z\ejGejRe\����ej]_AejGe\��ej^_UejGejR	d�d�d=�����Z_e_ej`_Aea��Zb	d�d�d@�ZcejGejRec����ejd_AejGec��ejd_UejGejR	d�d�dB�����Zeeeejf_Ad�dG�Zg	d�d�dJ�ZhejGejR	d�d�dK�����Ziehejj_heiejj_Ad�dL�Zkd�dR�Zld�dY�Zm	d�d�d^�Zn	d�d�d_�Zod�dc�Zpdd�Zqd�de�Zrd�dk�Zsd�dm�Ztd�dq�Zu	d�d�ds�ZvejwejR	d�d�dt�����Zxevej=_vexej=_Aejyejzej{ej|ej}ej~du�dv�dw�Zdxe�dy<dzd{hZ�d�d|�Z�d�d��Z�	d�d�d��Z�e�ej�_A	d�d�d��Z�ejGejR	d�d�d������Z�e�ej<_�e�ej<_AejG	d�d�d����Z�e�ej�_AejGejR	d�d�d������Z�e�ejT_Ae�ej^_AejGejR	d�d�d������Z�e�ej�_Ad�d��Z�ejG	d�d�d����Z�e�ej�_A	d�d�d��Z�e�ej:_AdS)�zMThis module contains a set of functions to handle inference on astroid trees.�)�annotationsN)�Callable�	Generator�Iterable�Iterator)�
TYPE_CHECKING�Any�Optional�TypeVar�Union)�bases�
constraint�
decorators�helpers�nodes�	protocols�util)�
PY310_PLUS)�CallContext�InferenceContext�bind_context_to_node�copy_context)	�AstroidBuildingError�AstroidError�AstroidIndexError�AstroidTypeError�AstroidValueError�AttributeInferenceError�InferenceError�NameInferenceError�_NonDeducibleTypeHierarchy)�
dunder_lookup)�AstroidManager)�InferenceErrorInfo�InferenceResult�SuccessfulInferenceResult)�Property�objects�_T�_BaseContainerT)�bound�
_FunctionDefT�?list[functools.partial[Generator[InferenceResult, None, None]]]�self�context�InferenceContext | None�kwargsr	�return�Iterator[_T]c+�K�|V�dS)z�Inference's end for nodes that yield themselves on inference.

    These are objects for which inference does not have any semantic,
    such as Module or Consts.
    N��r.r/r1s   �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/astroid/inference.py�	infer_endr8Fs�����J�J�J�J�J��node�list[SuccessfulInferenceResult]c��g}|jD�]}t|tj��rqt	j|j|��}|st||����t|d��st||����|�	t|������t|tj��rCt	j|j|��}|st||����|�|����|�|����|S)z.Infer all values based on _BaseContainer.elts.�r:r/�elts)
r>�
isinstancer�Starredr�
safe_infer�valuer�hasattr�extend�_infer_sequence_helper�	NamedExpr�append)r:r/�values�elt�starredrBs      r7rErEZs���F��y�����c�5�=�)�)�
	��(���G�<�<�G��
A�$�$��@�@�@�@��7�F�+�+�
A�$�$��@�@�@�@��M�M�0��9�9�:�:�:�:�
��U�_�
-�
-�	��&�s�y�'�:�:�E��
A�$�$��@�@�@�@��M�M�%� � � � ��M�M�#������Mr9�Iterator[_BaseContainerT]c+�K�td�|jD����}|rUt||��}t|��|j|j|j���}|�|��|V�dS|V�dS)Nc3�bK�|]*}t|tjtjf��V��+dS�N)r?rr@rF)�.0�es  r7�	<genexpr>z!infer_sequence.<locals>.<genexpr>xsF����!�!�<=�
�1�u�}�e�o�6�7�7�!�!�!�!�!�!r9)�lineno�
col_offset�parent)�anyr>rE�typerRrSrT�postinit)r.r/r1�has_starred_named_exprrH�new_seqs      r7�infer_sequencerZrs�����!�!�!�AE��!�!�!�����	�'��g�6�6���$�t�*�*��;�4�?�4�;�
�
�
��	���� � � ��
�
�
�
�
��
�
�
�
�
r9�
nodes.Dict�Iterator[nodes.Dict]c#�4K�td�|jD����s|V�dSt||��}t|��|j|j|j��}|�t|�������|V�dS)Nc3�PK�|]!\}}t|tj��V��"dSrN)r?r�
DictUnpack)rO�k�_s   r7rQzinfer_map.<locals>.<genexpr>�s3����F�F�4�1�a�z�!�U�-�.�.�F�F�F�F�F�Fr9)	rU�items�
_infer_maprVrRrSrTrW�list)r.r/rbrYs    r7�	infer_mapre�s������F�F�4�:�F�F�F�F�F���
�
�
�
�
��4��)�)���$�t�*�*�T�[�$�/�4�;�G�G������e�k�k�m�m�,�,�-�-�-��
�
�
�
�
r9�lhs_dict�:dict[SuccessfulInferenceResult, SuccessfulInferenceResult]�rhs_dictc���tj|���|�����}d�|D��}t|�����S)aDelete nodes that equate to duplicate keys.

    Since an astroid node doesn't 'equal' another node with the same value,
    this function uses the as_string method to make sure duplicate keys
    don't get through

    Note that both the key and the value are astroid nodes

    Fixes issue with DictUnpack causing duplicate keys
    in inferred Dict items

    :param lhs_dict: Dictionary to 'merge' nodes into
    :param rhs_dict: Dictionary with nodes to pull from
    :return : merged dictionary of nodes
    c�B�i|]\}}|���||f��Sr5)�	as_string)rO�keyrBs   r7�
<dictcomp>z,_update_with_replacement.<locals>.<dictcomp>�s*��P�P�P�J�C��#�-�-�/�/�C��<�P�P�Pr9)�	itertools�chainrb�dictrH)rfrh�
combined_dict�
string_maps    r7�_update_with_replacementrs�sV��&�O�H�N�N�$4�$4�h�n�n�6F�6F�G�G�M�P�P�-�P�P�P�J��
�!�!�#�#�$�$�$r9c��i}|jD]�\}}t|tj��rjt	j||��}|st�t|tj��st
||����t||��}t||��}��t	j||���}t	j||���}td�||fD����rt
||����t|||i��}��|S)z%Infer all values based on Dict.items.r=�r/c3�K�|]}|V��dSrNr5)rO�elems  r7rQz_infer_map.<locals>.<genexpr>�s$����:�:��t�8�:�:�:�:�:�:r9)rbr?rr_rrAr�DictrcrsrU)	r:r/rH�namerB�double_starred�unpack_itemsrl�
safe_values	         r7rcrc�s��JL�F��z�I�I���e��d�E�,�-�-�	I�$�/��w�?�?�N�!�
%�$�$��n�e�j�9�9�
A�$�$��@�@�@�@�%�n�g�>�>�L�-�f�l�C�C�F�F��$�T�7�;�;�;�C� �+�E�7�C�C�C�J��:�:��j�(9�:�:�:�:�:�
A�$�$��@�@�@�@�-�f�s�J�6G�H�H�F�F��Mr9�nodes.NodeNG�nodes.FunctionDef | Nonec���|}|jrLt|jtj��s-|j}|jrt|jtj���-|r|jr|jSdS)a�Search for the first function which encloses the given
    scope. This can be used for looking up in that function's
    scope, in case looking up in a lower scope for a particular
    name fails.

    :param node: A scope node.
    :returns:
        ``None``, if no parent function scope was found,
        otherwise an instance of :class:`astroid.nodes.scoped_nodes.Function`,
        which encloses the given node.
    N)rTr?r�FunctionDef)r:�currents  r7�_higher_function_scoper��sp���G�
�.�!��G�N�E�<M�!N�!N�!��.���.�!��G�N�E�<M�!N�!N�!���7�>���~���4r9�nodes.Name | nodes.AssignName�&Generator[InferenceResult, None, None]c��|�|j��\}}|skt|�����}|r|�|j��\}}|s)t	|j|���|����t|��}|j|_tj||��|j	|j<tj|||��S)z$Infer a Name: use name lookup rules.)ry�scoper/)�lookupryr�r�r r�
lookupnamer�get_constraints�constraintsr
�_infer_stmts)r.r/r1�frame�stmts�parent_functionras       r7�
infer_namer��s����;�;�t�y�)�)�L�E�5��
�1������>�>���	9�&�-�-�d�i�8�8�H�A�u��	�$��Y�d�j�j�l�l�G����
��7�#�#�G���G��%/�%?��e�%L�%L�G���	�"���e�W�e�4�4�4r9�
nodes.Call�4Generator[InferenceResult, None, InferenceErrorInfo]c+��K�t|��}d|_|�'t||�����|_|j�|��D]�}t|tj	��r|V��!	t|d��r>t|j|j
|���|_|�||���Ed{V���q#t $rY�}wxYwt#||���S)z?Infer a Call node by trying to guess what the function returns.N�infer_call_result)�args�keywords�callee)�callerr/r=)r�	boundnode�_populate_context_lookup�clone�
extra_context�func�inferr?r�UninferableBaserCrr�r��callcontextr�rr$)r.r/r1r�r�s     r7�
infer_callr�s�����w�'�'�K� �K����$<�T�7�=�=�?�?�$S�$S��!��)�/�/�'�*�*�����f�d�2�3�3�	��L�L�L��	��v�2�3�3�
V�*5���T�]�6�+�+�+��'�"�3�3�4��3�U�U�U�U�U�U�U�U�U����	�	�	��H�	�����4��9�9�9�9s�>AC
�
C�CT�nodes.Import�asname�bool�#Generator[nodes.Module, None, None]c+�2K�|p
t��}|j}|�t||����	|r,|�|�|����V�dS|�|��V�dS#t
$r}t||���|�d}~wwxYw)z8Infer an Import node: return the imported module/object.Nr=)rr�r�do_import_module�	real_namer)r.r/r�r1ry�excs      r7�infer_importr� s������+�)�+�+�G���D��|��$��8�8�8�8�B��	.��'�'����t�(<�(<�=�=�=�=�=�=�=��'�'��-�-�-�-�-�-�-���B�B�B��$��8�8�8�c�A�����B���s�,A5�A5�5
B�?B�B�nodes.ImportFromc�X�|p
t��}|j}|�t||����|r;	|�|��}n$#t$r}t||���|�d}~wwxYw	|���}n$#t$r}t||���|�d}~wwxYw	t|��}||_|�|||�	��u���}tj||��S#t$r&}tt|��|||���|�d}~wwxYw)z;Infer a ImportFrom node: return the imported module/object.Nr=)�
ignore_locals��target�	attributer/)
rr�rr�rr�rr�getattr�rootr
r��str)	r.r/r�r1ryr��moduler��errors	         r7�infer_import_fromr�:sw���+�)�+�+�G���D��|��$��8�8�8�8�
�F�	F��>�>�$�'�'�D�D��&�	F�	F�	F� �d�G�<�<�<�#�E�����	F����B��&�&�(�(�����B�B�B��$��8�8�8�c�A�����B������w�'�'��!������t�6�T�Y�Y�[�[�3H��I�I���!�%��1�1�1��"�������J�J�t�t�W�
�
�
��	��������sH�A�
A%�A � A%�)A>�>
B�B�B�#AC9�9
D)�!D$�$D)�"nodes.Attribute | nodes.AssignAttrc+�XK�|j�|��D]�}t|tj��r|V��!t|��}|j}	||_t|tjtj
f��rFt|tj��r|n|j}tj
||���|j|j<|�|j|��Ed{V��n#t"t$t&f$rYnwxYw||_��#||_wxYwt)||���S)zBInfer an Attribute node by using getattr on the associated object.)r�Nr=)�exprr�r?rr�rr�r�ClassDefr
�Instance�_proxiedrr�r��attrname�igetattrrr�AttributeErrorr$)r.r/r1�owner�
old_boundnoder�s      r7�infer_attributer�`sS���������)�)�.�.���e�T�1�2�2�	��K�K�K���w�'�'���)�
�	.� %�G���%�%�.�%�.�!A�B�B�
�!+�E�5�>�!B�!B�V������5?�5O���6�6�6��#�D�M�2��~�~�d�m�W�=�=�=�=�=�=�=�=�=�=��#���
�	�	�	�

�D�	����!.�G����
�G��-�-�-�-��4��9�9�9�9s+�BC*�)D�*D�D�D�D�	D�nodes.Globalc�&�|�|j�t||����	tj|����|j��|��S#t$r+}tt|��||j|���|�d}~wwxYw)Nr=r�)r�rr
r�r�r�rr�)r.r/r1r�s    r7�infer_globalr��s���
��'�,�4��$��8�8�8�8���!�$�)�)�+�+�"5�"5�g�6H�"I�"I�7�S�S�S��"�������J�J�t�w�/A�7�
�
�
��	��������s�>A�
B�%&B�B�nodes.Subscript�;Generator[InferenceResult, None, InferenceErrorInfo | None]c	+�tK�d}|j�|��D�]�}t|tj��rtjV�dS|j�|��D�]:}t|tj��rtjV�dSt}|jtj
kr|}n0|jtj
krtj|��}|r|}n|}|turt||����	|�||��}n=#tt t"t$t&f$r}	t||���|	�d}	~	wwxYw||ust|tj��rtjV�dS|�|��Ed{V��d}��<���|rt)||���SdS)z�Inference for subscripts.

    We're understanding if the index is a Const
    or a slice, passing the result of inference
    to the value's `getitem` method, which should
    handle each supported index type accordingly.
    FNr=T)rBr�r?rr��Uninferable�slice�_SUBSCRIPT_SENTINEL�	__class__r
r�r�class_instance_as_indexr�getitemrrrrr�r$)
r.r/r1�	found_onerB�index�index_value�instance_as_index�assignedr�s
          r7�infer_subscriptr��s�����I���!�!�'�*�*�(�(���e�T�1�2�2�	��"�"�"�"��4�4��Z�%�%�g�.�.�$	�$	�E��%��!5�6�6�
��&�&�&�&��t�t�t�.�K���%�.�0�0�#�����E�N�2�2�$+�$C�E�$J�$J�!�$�4�"3�K��#���1�1�1�$�$��@�@�@�@�	
J� �=�=��g�>�>���� �!�!�'���
J�
J�
J�%�$��@�@�@�c�I�����
J�����x���:�h��8L�#M�#M���&�&�&�&��t�t�t��~�~�g�.�.�.�.�.�.�.�.�.��I�I�I$	�L�>�!�t�W�=�=�=�=��4s�D�#E�:E�E�nodes.BoolOpc+�&�K�|j}|jdkr
tj}ntj}	�fd�|D��}n#t
$rtjV�YdSwxYwtj	|�D]�}td�|D����rtjV��*d�|D��}td�|D����rtjV��^tj}t||��D]\}}	||	��r|V�n�|V���t|����S)z�Infer a boolean operation (and / or / not).

    The function will calculate the boolean operation
    for all pairs generated through inference for each component
    node.
    �orc�<��g|]}|�������S)ru)r�)rOrBr/s  �r7�
<listcomp>z!_infer_boolop.<locals>.<listcomp>�s'���L�L�L�E�5�;�;�w�;�7�7�L�L�Lr9Nc3�JK�|]}t|tj��V��dSrN�r?rr��rO�items  r7rQz _infer_boolop.<locals>.<genexpr>�s/����G�G�$�z�$�� 4�5�5�G�G�G�G�G�Gr9c�6�g|]}|�����Sr5)�
bool_valuer�s  r7r�z!_infer_boolop.<locals>.<listcomp>�s"��:�:�:�T�t���(�(�:�:�:r9c3�JK�|]}t|tj��V��dSrNr�r�s  r7rQz _infer_boolop.<locals>.<genexpr>�s/����N�N�$�z�$�� 4�5�5�N�N�N�N�N�Nr9r=)
rH�op�operator�truth�not_rrr�rn�productrU�zipr$)
r.r/r1rH�	predicate�inferred_values�pair�bool_valuesrBr�s
 `        r7�
_infer_boolopr��sv������[�F��w�$����N�	�	��M�	��L�L�L�L�V�L�L�L��������������t�t������!�?�3�����G�G�$�G�G�G�G�G�	��"�"�"�"��:�:�T�:�:�:���N�N�+�N�N�N�N�N�	��"�"�"�"��� ��!$�T�;�!7�!7�	�	��E�:��y��$�$�
�������
��K�K�K���4��9�9�9�9s�?�A�A�infer_callable�jCallable[[_T, InferenceContext | None], Generator[InferenceResult | util.BadOperationMessage, None, None]]r��type[util.BadOperationMessage]c#�nK�|||��D]%}t||��rtjV��!|V��&dSrN)r?rr�)r.r�r/r��results     r7�_filter_operation_errorsr�s^����!�.��w�/�/�����f�e�$�$�	��"�"�"�"�"��L�L�L�L��r9�
nodes.UnaryOp�FGenerator[InferenceResult | util.BadUnaryOperationMessage, None, None]c#�.K�|j�|��D�]v}	|�|j��V��!#t$r'}tj||j|��V�Yd}~�Md}~wt$�r}tj	|j}|�W|�
��}t|t
j��stj|��V��n�t
jV��n�t|t jtjf��s#tj||j|��V�Yd}~��		t'j||��}n2#t*$r%tj||j|��V�YYd}~��ZwxYw|d}t-|�|���d��}t|t
j��s|���sYd}~���t1|��}||_t5g|���|_|�||���}t-|d��}	|	�|V�n|	V�nM#t*$r'}
tj||j|
��V�Yd}
~
n!d}
~
wt:$rt
jV�YnwxYwYd}~��pd}~wwxYwdS)�3Infer what an UnaryOp should return when evaluated.Nrru)r�r�)�operandr��infer_unary_opr��	TypeErrorr�BadUnaryOperationMessager�r�UNARY_OP_METHODr�r?r�r�
const_factoryr�r
r�r�r"r�r�next�callablerr�rr�r�r)r.r/r�r��methr��methods�inferred�call_resultsr��	inner_excs           r7�_infer_unaryopr1s�����<�%�%�g�.�.�6+�6+��5	+��(�(���1�1�1�1�1�1���	G�	G�	G��/����#�F�F�F�F�F�F�F�F�F�F������0	+�0	+�0	+��,�T�W�5�D��|�%�/�/�1�1�
�!�*�d�.B�C�C�+��-�*�n�=�=�=�=�=�=��*�*�*�*�*�!�'�E�N�E�N�+K�L�L���7����#�N�N�N�N�N��H�H�H�H�+�!�"/�"6�w��"E�"E����2�!�!�!�"�;�G�T�W�c�R�R�R�R�R� ������!����#�1�:�D�#�D�J�J�w�J�$?�$?��F�F�H�"�8�T�-A�B�B�!�'�0�0�2�2�!�!�����*�7�3�3�G�(/�G�%�*5�2�h�*O�*O�*O�G�'�#+�#=�#=�d�G�#=�#T�#T�L�!�,��5�5�F��~�%�
�
�
�
�$������.�U�U�U��7����)�T�T�T�T�T�T�T�T�T�T�����%�+�+�+��*�*�*�*�*�*�+�������������_0	+����
6+�6+s~�>�
J�A*�*J�8B3J
�3E	�H:�	'E8�0H:�7E8�8AH:�AH:�9J
�:
J�I&�!J
�&J�J
�J�J
�
Jc+�vK�t|t|tj��Ed{V��t	||���S)r�Nr=)r�rrr�r$r6s   r7�
infer_unaryoprnsY����(��n�g�t�'D�����������4��9�9�9�9r9c�R�t|tj��o
|jtuS)z0Check if the given const node is NotImplemented.)r?r�ConstrB�NotImplemented)�consts r7�_is_not_implementedr	~s ���e�U�[�)�)�K�e�k�^�.K�Kr9�instance�nodes.Const�otherr�)tuple[util.UninferableBase | nodes.Const]c�t��t|tj��ritj|jvr
tjfS�fd�|jD��}t
d�|D����rtd�|D����}n�d}n�t|tj��r�i}|j	D]�}tj|d���}t|tj��stjfcStj|d���}t|tj��stjfcS|j
||j
<��n/t|tj��r|j
}n
tjfS	tj|j
|z��fS#tt t"f$rtjfcYSwxYw)z�Infer the result of '"string" % ...'.

    TODO: Instead of returning Uninferable we should rely
    on the call to '%' to see if the result is actually uninferable.
    c�:��g|]}tj|�����Sr5)rrA)rO�ir/s  �r7r�z6_infer_old_style_string_formatting.<locals>.<listcomp>�s&���R�R�R�!�w�1�!�W�=�=�R�R�Rr9c3�JK�|]}t|tj��V��dSrN)r?rr�rOrs  r7rQz5_infer_old_style_string_formatting.<locals>.<genexpr>�s.����G�G�a�z�!�U�[�)�)�G�G�G�G�G�Gr9c3�$K�|]}|jV��dSrN)rBrs  r7rQz5_infer_old_style_string_formatting.<locals>.<genexpr>�s$����@�@�q�1�7�@�@�@�@�@�@r9Nr�)r?r�Tuplerr�r>�all�tuplerxrbrrArrBr�r��KeyError�
ValueError)r
rr/�inferred_positionalrHr�rlrBs  `     r7�"_infer_old_style_string_formattingr�s�����%���%�%�#���u�z�)�)��$�&�&�R�R�R�R�u�z�R�R�R���G�G�3F�G�G�G�G�G�	��@�@�,?�@�@�@�@�@�F�F��F�F�	�E�5�:�	&�	&�
#�!#���K�	,�	,�D��$�T�!�W�g�6�6�C��c�5�;�/�/�
+��(�*�*�*�*��&�t�A�w��8�8�E��e�U�[�1�1�
+��(�*�*�*�*� %��F�3�9���	,�
�E�5�;�	'�	'�#������ �"�"�#��#�H�N�V�$;�<�<�>�>���x��,�#�#�#�� �"�"�"�"�#���s�3F�$F7�6F7r%�opnode�nodes.AugAssign | nodes.BinOpr�r��method_namec���tj||��}t||��}|d}||j_t|tj��r>t|jt��r$|dkrtt|||����S	t|�
|�����}n$#t$r}	t||���|	�d}	~	wwxYwt|t j��rt�t|tjtjtjtjt*jf��st�|�|||||��S)z8Invoke binary operation inference on the given instance.r�%rur=N)r"r�rr�r�r?rrrBr��iterrr�r��
StopIterationrrr�r�Listr�r
r��infer_binary_op)
r
rr�rr/rr��methodr�rPs
          r7�_invoke_binop_inferencer&�sQ���"�8�[�9�9�G�"�7�H�5�5�G�
�Q�Z�F�!'�G���	�8�U�[�)�)�R��x�~�s�+�+�R�
�#�I�I��6�x���P�P�Q�Q�Q�B�����W��5�5�6�6�����B�B�B��&�'�:�:�:��A�����B�����(�D�0�1�1������5�;���U�Z�����X�������#�#�F�B��w��I�I�Is�#B7�7
C�C�CF�nodes.AugAssign�reverse�9functools.partial[Generator[InferenceResult, None, None]]c	�f�tj|}tjt||||||���S)z<Get an inference callable for an augmented binary operation.�r
r�rrr/r)r�AUGMENTED_OP_METHOD�	functools�partialr&�r
rr�rr/r(rs       r7�_aug_opr0�s@���/��3�K�����
��������r9c	��|rtj|}ntj|}tjt
||||||���S)z�Get an inference callable for a normal binary operation.

    If *reverse* is True, then the reflected method will be used instead.
    r+)r�REFLECTED_BIN_OP_METHOD�
BIN_OP_METHODr-r.r&r/s       r7�_bin_opr4�sW���2��7��;����-�b�1������
��������r9�left�.bases.UnionType | nodes.ClassDef | nodes.Const�rightc#�8K�tj||��V�dS)z>Create a new UnionType instance for binary or, e.g. int | str.N)r
�	UnionType)r5r7s  r7�_bin_op_or_union_typer:�s&����
�/�$��
&�
&�&�&�&�&�&r9c#�K�||fD]7}|���}t|g���|_d|_|V��8dS)z�Get contexts for binary operations.

    This will return two inference contexts, the first one
    for x.__op__(y), the other one for y.__rop__(x), where
    only the arguments are inversed.
    )r�N)r�rr�r�)r/r5r7�arg�new_contexts     r7�_get_binop_contextsr>s^�����t�}�����m�m�o�o��"-�C�5�"9�"9�"9��� $��������	�r9c�V�|���|���kS)z$Check if type1 is the same as type2.)�qname)�type1�type2s  r7�
_same_typerCs���;�;�=�=�E�K�K�M�M�)�)r9�	left_type�InferenceResult | None�
binary_opnode�
right_type�reverse_contextc	��|j}t||��rt|||||��g}n�tj||��rt|||||��g}nftj||��r)t|||||d���t|||||��g}n(t|||||��t|||||d���g}tr�|dkr�t|tj	tjf��s!t|tj��r}|j
�vt|tj	tjf��s!t|tj��r6|j
�/|�tjt"||��g��|S)aVGet the flow for binary operations.

    The rules are a bit messy:

        * if left and right have the same type, then only one
          method will be called, left.__op__(right)
        * if left and right are unrelated typewise, then first
          left.__op__(right) is tried and if this does not exist
          or returns NotImplemented, then right.__rop__(left) is tried.
        * if left is a subtype of right, then only left.__op__(right)
          is tried.
        * if left is a supertype of right, then right.__rop__(left)
          is first tried and then left.__op__(right)
    T�r(�|)r�rCr4r�
is_subtype�is_supertyperr?r
r9rr�rrBrDr-r.r:)	r5rDrFr7rGr/rHr�r�s	         r7�_get_binop_flowrNs���.
�	�B��)�Z�(�(�

��4���E�7�C�C�D���	�	�I�z�	2�	2�
��4���E�7�C�C�D���	�	�i��	4�	4�	
��E�=�"�d�O�T�R�R�R��D�-��U�G�<�<�
���
�D�-��U�G�<�<��E�=�"�d�O�T�R�R�R�
��	�P��#�I�I��t�e�o�u�~�>�?�?�
��$���,�,�
��
�"�
�u�u����?�@�@�#��%���-�-�	#�
��#�	���	�)�*?��u�M�M�N�O�O�O��Nr9�
aug_opnodec
�B�|j�d��}|j}t||��r't|||||��t	|||||��g}	n�tj||��r't|||||��t	|||||��g}	n�tj||��r;t|||||��t	|||||d���t	|||||��g}	n:t|||||��t	|||||��t	|||||d���g}	|	S)a�Get the flow for augmented binary operations.

    The rules are a bit messy:

        * if left and right have the same type, then left.__augop__(right)
          is first tried and then left.__op__(right).
        * if left and right are unrelated typewise, then
          left.__augop__(right) is tried, then left.__op__(right)
          is tried and then right.__rop__(left) is tried.
        * if left is a subtype of right, then left.__augop__(right)
          is tried and then left.__op__(right).
        * if left is a supertype of right, then left.__augop__(right)
          is tried, then right.__rop__(left) and then
          left.__op__(right)
    �=TrJ)r��striprCr0r4rrLrM)
r5rDrOr7rGr/rH�bin_op�aug_opr�s
          r7�
_get_aug_flowrUPsS��0�]�
 �
 ��
%�
%�F�
�]�F��)�Z�(�(�
��D�*�f�e�W�=�=��D�*�f�e�W�=�=�
���
�	�I�z�	2�	2�
��D�*�f�e�W�=�=��D�*�f�e�W�=�=�
���
�	�i��	4�	4�
��D�*�f�e�W�=�=��E�:�v�t�_�d�S�S�S��D�*�f�e�W�=�=�
���
�D�*�f�e�W�=�=��D�*�f�e�W�=�=��E�:�v�t�_�d�S�S�S�
��
�Nr9�flow_factory�GetFlowFactory�GGenerator[InferenceResult | util.BadBinaryOperationMessage, None, None]c	#�K�t|||��\}}tj|��}tj|��}||||||||��}|D]�}		t|	����}
t	d�|
D����rt
jV�dSttt|
����r�gtd�|
D����}|r$|t|
��krt
jV�dS|
Ed{V��dS#t$rY��t$rY��t$rt
jV�YdSwxYwtj||j|��V�dS)z�Infer a binary operation between a left operand and a right operand.

    This is used by both normal binary operations and augmented binary
    operations, the only difference is the flow factory used.
    c3�JK�|]}t|tj��V��dSrNr��rOr�s  r7rQz*_infer_binary_operation.<locals>.<genexpr>�s/����R�R��:�f�d�&:�;�;�R�R�R�R�R�Rr9Nc3�8K�|]}t|���dV��dS)rN)r	r[s  r7rQz*_infer_binary_operation.<locals>.<genexpr>�sD����"�"��+>�v�+F�+F�"��"�"�"�"�"�"r9)r>r�object_typerdrUrr�r�mapr	�sum�lenr�rr�BadBinaryOperationMessager�)r5r7rFr/rVrHrDrGr�r%�results�not_implementeds            r7�_infer_binary_operationrd�s����� 3�7�D�%�H�H��G�_��#�D�)�)�I��$�U�+�+�J��l��i���z�7�O���G�����	��6�6�8�8�n�n�G��R�R�'�R�R�R�R�R�
��&�&�&�&�����3�*�G�4�4�5�5�
��!�"�"� '�"�"�"���O��
�?�c�'�l�l�#B�#B��&�&�&�&�������������F�F��/�	�	�	��H�&�	�	�	��H��	�	�	��"�"�"�"��F�F�F�	����*�
(��M�4D�j�
Q�
Q�Q�Q�Q�Q�Qs�D�
D6�	D6�D6�5D6�nodes.BinOpc#��K�|j}|j}|p
t��}t|��}t|��}|�|���}|�|���}tj||��D]n\}}	td�|	|fD����rtj	V�dS	t||	||t��Ed{V���Q#t$rtj	V�Y�kwxYwdS)z!Binary operation inference logic.ruc3�JK�|]}t|tj��V��dSrNr��rOrBs  r7rQz_infer_binop.<locals>.<genexpr>��/����O�O�5�z�%��!5�6�6�O�O�O�O�O�Or9N)
r5r7rrr�rnr�rUrr�rdrNr!)
r.r/r5r7�lhs_context�rhs_context�lhs_iter�rhs_iter�lhs�rhss
          r7�_infer_binoprp�s,�����9�D��J�E�
�+�)�+�+�G��w�'�'�K��w�'�'�K��z�z�+�z�.�.�H��{�{�;�{�/�/�H��%�h��9�9�	#�	#���S��O�O�S�#�J�O�O�O�O�O�	��"�"�"�"��F�F�	#�.�s�C��w��X�X�X�X�X�X�X�X�X�X��)�	#�	#�	#��"�"�"�"�"�"�	#����	#�	#s�2C�C,�+C,c�D�t|t|tj��SrN)r�rprrar6s   r7�infer_binoprr�s"��
$��l�G�T�%C���r9c�
�||vSrNr5��a�bs  r7�<lambda>rw�s
��q�A�v�r9c�
�||vSrNr5rts  r7rwrw�s
��1�A�:�r9)z==z!=�<z<=�>z>=�inznot inz%dict[str, Callable[[Any, Any], bool]]�COMPARE_OPS�iszis notc�N�tj|�����SrN)�ast�literal_evalrk)r:s r7�_to_literalr��s����D�N�N�,�,�-�-�-r9�	left_iter�Iterable[nodes.NodeNG]�
right_iter�bool | util.UninferableBasec�(�d}|tvrtjSt|}t	j||��D]�\}}t
|tj��st
|tj��rtjcS	t|��t|��}}n+#tttf$rtjcYcSwxYw	|||��}n#t$r
}t|�d}~wwxYw|�|}��||krtjcS��|�J�|S)aa
    If all possible combinations are either True or False, return that:
    >>> _do_compare([1, 2], '<=', [3, 4])
    True
    >>> _do_compare([1, 2], '==', [3, 4])
    False

    If any item is uninferable, or if some combinations are True and some
    are False, return Uninferable:
    >>> _do_compare([1, 3], '<=', [2, 4])
    util.Uninferable
    N)�UNINFERABLE_OPSrr�r|rnr�r?r�r��SyntaxErrorrr�r�r)	r�r�r��retval�op_funcr5r7r�r�s	         r7�_do_comparer��sY���F�	�_�������"�o�G� �(��J�?�?�$�$���e��d�D�0�1�1�	$�Z��4�'�6
�6
�	$��#�#�#�#�	$�%�d�+�+�[��-?�-?�%�D�D���Z��8�	$�	$�	$��#�#�#�#�#�#�	$����	,��7�4��'�'�D�D���	,�	,�	,�"��+�����	,�����>��F�F�
�t�^�^��#�#�#�#�������Ms*�B!�!#C	�C	�
C�
C1�$C,�,C1�
nodes.Compare�9Generator[nodes.Const | util.UninferableBase, None, None]c+�K�d}|j}|j}t|�|�����}|D]`\}}t|�|�����}		t	|||	��}n#t
$rtj}Yn
wxYw|durn|	}�a|tjur|V�dStj	|��V�dS)z#Chained comparison inference logic.TruN)
�opsr5rdr�r�rrr�rr)
r.r/r1r�r��	left_nodernr��
right_noderos
          r7�_infer_comparer�"s�����+/�F�
�(�C��	�I�
�y���w��/�/�
0�
0�C��
�
���J��:�#�#�G�#�4�4�5�5��	� ��b�#�.�.�F�F���	�	�	��%�F��E�E�	���������E����
��!�!�!��������k�&�!�!�!�!�!�!�!s�!A3�3B
�B
c#��K�|p
t��}|���}|j�|���}|j�|���}t
j||��D]o\}}td�||fD����rtj
V�dS	t||||t���Ed{V���R#t$rtj
V�Y�lwxYwdS)z0Inference logic for augmented binary operations.ruc3�JK�|]}t|tj��V��dSrNr�rhs  r7rQz#_infer_augassign.<locals>.<genexpr>Krir9N)r5r7rFr/rV)rr�r��	infer_lhsrBr�rnr�rUrr�rdrUr!)r.r/rkrlrmrnros       r7�_infer_augassignr�@s9�����+�)�+�+�G��-�-�/�/�K��{�$�$�W�$�5�5�H��z�����4�4�H��%�h��9�9�#�#���S��O�O�S�#�J�O�O�O�O�O�	��"�"�"�"��F�F�		#�.���"��*����
�
�
�
�
�
�
�
��*�	#�	#�	#��"�"�"�"�"�"�	#����#�#s�$C�C�Cc�D�t|t|tj��SrN)r�r�rrar6s   r7�infer_augassignr�\s#��
$�����)G���r9�nodes.Argumentsc�l�|�|j�t||����tj||j|��S)Nr=)r�rr�_arguments_infer_argnamer6s   r7�infer_argumentsr�ls<����'�,�4��$��8�8�8�8��-�d�G�4F��P�P�Pr9�#nodes.AssignName | nodes.AssignAttrc���t|jtj��r|j�|��St|�|�����}tj||��S)zXInfer a AssignName/AssignAttr: need to inspect the RHS part of the
    assign node.
    ru)	r?rTr�	AugAssignr�rd�assigned_stmtsr
r�)r.r/r1r�s    r7�infer_assignr�xsa���$�+�u��/�/�*��{� � ��)�)�)���$�$�W�$�5�5�6�6�E���e�W�-�-�-r9�nodes.EmptyNodec+��K�|���stjV�dS	t���|j|���Ed{V��dS#t$rtjV�YdSwxYw)Nru)�has_underlying_objectrr�r#�infer_ast_from_something�objectrr6s   r7�infer_empty_noder��s�����
�%�%�'�'�#��������	#�%�'�'�@�@���W�A���
�
�
�
�
�
�
�
�
���	#�	#�	#��"�"�"�"�"�"�"�	#���s�.A�A4�3A4�callc��i}|�|S|jD],}t|tj��r|||j<�'|||<�-|j�|jng}|D]}|||j<�
|SrN)r�r?rr@rBr�)r�r/�context_lookupr<r��keywords      r7r�r��s���?A�N������y�*�*���c�5�=�)�)�	*�(/�N�3�9�%�%�")�N�3��� $�
� 9�t�}�}�r�H��0�0��(/��w�}�%�%��r9�nodes.IfExpc+�K�d}|p
t��}t|��}t|��}	t|j�|��������}t
|tj��sX|�	��r"|j
�|���Ed{V��n>|j�|���Ed{V��nd}n#ttf$rd}YnwxYw|rD|j
�|���Ed{V��|j�|���Ed{V��dSdS)z�Support IfExp inference.

    If we can't infer the truthiness of the condition, we default
    to inferring both branches. Otherwise, we infer either branch
    depending on the condition.
    FruNT)rrr��testr�r�r?rr�r��body�orelserr")r.r/r1�
both_branchesrjrkr�s       r7�infer_ifexpr��s������M�
�+�)�+�+�G��w�'�'�K��w�'�'�K�!��D�I�O�O�G�M�M�O�O�O�<�<�=�=���$�� 4�5�5�	!���� � �
B��9�?�?�;�?�?�?�?�?�?�?�?�?�?�?��;�,�,�[�,�A�A�A�A�A�A�A�A�A�A� �M�M��
�M�*�����
�
�
������:��9�?�?�;�?�7�7�7�7�7�7�7�7�7��;�$�$�[�$�9�9�9�9�9�9�9�9�9�9�9�:�:s�:C#�#C9�8C9�=Generator[Property | _FunctionDefT, None, InferenceErrorInfo]c+�rK�|jrtj|��s|V�t||���S|j�d���}|j|jvo(td�|j|jD����}t|jtjtjtj
f��rd}t�||j|j|s|jnd|j���}|r|j|_|�g|j|j���|V�t||���S)Nr=T)�futurec3�JK�|]}t|tj��V��dSrN)r?r(r')rO�vals  r7rQz$infer_functiondef.<locals>.<genexpr>�sH����Q�Q�.1�
�3��(�)�)�Q�Q�Q�Q�Q�Qr9)�functionryrRrTrS)r�r��doc_node)rr
�_is_propertyr$rTr�ry�localsrUr?r�	TryExcept�
TryFinally�Ifr(r'rRrSrWr�r�)r.r/r1�parent_frame�!property_already_in_parent_locals�	prop_funcs      r7�infer_functiondefr��s[�����?�>�%�"4�T�":�":�>��
�
�
�!�t�W�=�=�=�=��;�$�$�D�$�1�1�L�(,�	�\�5H�(H�)�S�Q�Q�5A�5H���5S�Q�Q�Q�N�N�%��$�+����1A�5�8�L�M�M�1�,0�)�� � ��
�Y��{�"C�M�t�{�{���?�!���I�)�'��;�	��
���B�T�Y����G�G�G�
�O�O�O��4��9�9�9�9r9rN)r.r)r/r0r1r	r2r3)r:r*r/r0r2r;)r.r*r/r0r1r	r2rK)r.r[r/r0r2r\)rfrgrhrgr2rg)r:r[r/r0r2rg)r:r}r2r~)r.r�r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)NT)
r.r�r/r0r�r�r1r	r2r�)
r.r�r/r0r�r�r1r	r2r�)r.r�r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)
r.r)r�r�r/r0r�r�r2r�)r.r�r/r0r2r�)r.r�r/r0r1r	r2r�)r2r�)r
rrr}r/rr2r
)r
r%rrr�r�rr%r/rrr�r2r�)F)r
r%rr'r�r�rr%r/rr(r�r2r))r
r%rrr�r�rr%r/rr(r�r2r))r5r6r7r6r2r�)r5r%rDrErFrr7r%rGrEr/rrHrr2r-)r5r%rDrErOr'r7r%rGrEr/rrHrr2r-)r5r%r7r%rFrr/rrVrWr2rX)r.rer/r0r2rX)r.rer/r0r1r	r2r�)r:r}r2r	)r�r�r�r�r�r�r2r�)r.r�r/r0r1r	r2r�)r.r'r/r0r2rX)r.r'r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)r.r�r/r0r1r	r2r�)r�r�r/r0)r.r�r/r0r1r	r2r�)r.r,r/r0r1r	r2r�)��__doc__�
__future__rrr-rnr��typing�collections.abcrrrrrr	r
rr�astroidr
rrrrrr�
astroid.constr�astroid.contextrrrr�astroid.exceptionsrrrrrrrr r!�astroid.interpreterr"�astroid.managerr#�astroid.typingr$r%r&�astroid.objectsr'�lazy_importr(r)�
BaseContainerr*r�r,r��BinOprWr8�Module�_inferr��Lambdar�SlicerE�raise_if_nothing_inferredrZr#r�Setrersrcrxr�r��path_wrapper�Name�
AssignNamer�r��Callr��Importr��
ImportFromr��	Attribute�
AssignAttrr��Globalr�r�r��	Subscriptr��BoolOpr�rr�UnaryOpr	rr&r0r4r:r>rCrNrUrdrp�yes_if_nothing_inferredrr�eq�ne�lt�le�gt�ger|�__annotations__r�r�r�r��Comparer�r�r��	Argumentsr�r��	EmptyNoder�r��IfExpr�r5r9r7�<module>r�s�
��
T�S�S�"�"�"�"�"�"�
�
�
�
�������������
�
�
�
�C�C�C�C�C�C�C�C�C�C�C�C�?�?�?�?�?�?�?�?�?�?�?�?�?�?�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�$�$�$�$�$�$�������������
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�.�-�-�-�-�-�*�*�*�*�*�*������������)�(�(�(�(�(�(��$�
�9�
%�
%���W�T�]�]���'�+�5�3F�G�G�G�����u�/@�A�A�A�
������!�
�e�o�u�{�*�+����!����F�	G���"26������ ����!����������������?C������0�%�(,�����&�%��(#��
��#����!��	��:>�	�	�	�	�	�%�%�%�%�4����0��
������,(,�5�5�5�5�5�89�J�8��J��J�'�'����
��(�����%���9=�:�:�:�:���&�%�:�0��
���%���(,��B�B�B�B���&�%�B�*#�����%���(,��������&�%��B,����
(,�:�:�:�:�:�D>��=��J��O�,�,������B�Z�A�/�R�R�����%���;?�
�
�
�
���&�%�
�#�����f�h�h��?C�8�8�8�8�8�z>��=��J��O�,�,������A�J�@��Q�Q�����%���;?�2:�2:�2:�2:���&�%�2:�j$��������(=A�:+�:+�:+�:+�:+�z�%���<@�:�:�:�:���&�%�:� .��
��$��
��L�L�L�L�
"#�"#�"#�"#�JJ�J�J�J�P�
�����6�
�����6'�'�'�'�
�
�
� *�*�*�*�
6�6�6�6�r0�0�0�0�f/R�/R�/R�/R�f;?�#�#�#�#�#�6�#���:>�������$�#��(���� �����+�
�+�	��
�+�	��
�+�
�
�%�%�	6�	6��	�	�	�	�	����.�.�.�.�+�+�+�+�^=A�"�"�"�"�"�6&��
��?C�#�#�#�#�#�8�%���>B�������&�%��$4��� �(����
�%�>B�Q�Q�Q�Q�&�%�Q�)�����%���(,�.�.�.�.���&�%�.�'����&�����%���>B�#�#�#�#���&�%�#�*��������"�%�:>�:�:�:�:�&�%�:�D!����=A�:�:�:�:�:�D-�����r9