Your IP : 3.149.213.116
�
��bgj���UdZddlmZddlZddlZddlmZmZmZm Z m
Z
erddlmZm
Z
ddlmZmZee
deeeeeefe dfZiZded <dd�ZGd
�d��ZGd�d��Zdd�Zdd�ZdS)zIVarious context related utilities, including inference and call contexts.�)�annotationsN)�
TYPE_CHECKING�Dict�Optional�Sequence�Tuple)�
constraint�nodes)�Keyword�NodeNGr�_InferenceCache�_INFERENCE_CACHE�return�Nonec�8�t���dS�N)r�clear���`/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/context.py�_invalidate_cachers���������rc��eZdZdZdZdZ ddd�Zedd
���Zej dd
���Zedd���Z
dd�Zdd�Ze
jd���Zdd�ZdS)�InferenceContextz�Provide context for inference.
Store already inferred nodes to save time
Account for already visited nodes to stop infinite recursion
)�path�
lookupname�callcontext� boundnode�
extra_context�constraints�_nodes_inferred�dN�nodes_inferred�list[int] | Nonec��|� dg|_n||_|p
t��|_ d|_ d|_ d|_ i|_ i|_dS�Nr)r �setrrrrrr)�selfrr"s r�__init__zInferenceContext.__init__/s{��
�!�$%�3�D� � �#1�D� ��M�C�E�E�� � �'+��� �04���D���� � ��� �SU���'�'rr�intc��|jdS)z�
Number of nodes inferred in this context and all its clones/descendents.
Wrap inner value in a mutable cell to allow for mutating a class
variable in the presence of __slots__
r�r �r's rr"zInferenceContext.nodes_inferred]s���#�A�&�&r�valuerc��||jd<dSr%r+)r'r-s rr"zInferenceContext.nodes_inferredgs��"'���Q���rr
c��tS)z�
Inferred node contexts to their mapped results.
Currently the key is ``(node, lookupname, callcontext, boundnode)``
and the value is tuple of the inferred results
)rr,s r�inferredzInferenceContext.inferredks
�� �r�boolc�f�|j}||f|jvrdS|j�||f��dS)z�Push node into inference path.
:return: Whether node is already in context path.
Allows one to see if the given node has already
been looked at for this inference context
TF)rr�add)r'�node�names r�pushzInferenceContext.pushus>������$�<�4�9�$�$��4�� �
�
�t�T�l�#�#�#��urc���t|j���|j���}|j|_|j|_|j|_|j���|_|S)z�Clone inference path.
For example, each side of a binary operation (BinOp)
starts with the same context but diverge as each side is inferred
so the InferenceContext will need be cloned
)r")rr�copyr rrrr)r'�clones rr9zInferenceContext.clone�s`��!�����!1�!1�$�BV�W�W�W�� �,����.���"�0��� �,�1�1�3�3����rc#�HK�t|j��}dV�||_dSr)r&r)r'rs r�restore_pathzInferenceContext.restore_path�s'�����4�9�~�~��
������ � � r�strc����fd��jD��}d�t���jd�|����S)Nc
3��K�|]=}|�dtjt�|��dt|��z
�����V��>dS)�=�P)�widthN)�pprint�pformat�getattr�len)�.0�fieldr's �r� <genexpr>z+InferenceContext.__str__.<locals>.<genexpr>�sh�����
�
���T�T�v�~�g�d�E�&:�&:�"�s�5�z�z�/�R�R�R�T�T�
�
�
�
�
�
rz{}({})z,
)� __slots__�format�type�__name__�join)r'�states` r�__str__zInferenceContext.__str__�sX���
�
�
�
���
�
�
�����t�D�z�z�2�I�N�N�5�4I�4I�J�J�Jr�NN)r"r#)rr))r-r)rr)rr
)rr1)rr)rr<)rL�
__module__�__qualname__�__doc__rI�max_inferredr(�propertyr"�setterr0r6r9�
contextlib�contextmanagerr;rOrrrrrs���������I��L��+/�,(�,(�,(�,(�,(�\�'�'�'��X�'���(�(�(���(�� � � ��X� �
�
�
�
�
�
�
�
��������
K�K�K�K�K�Krrc�$�eZdZdZdZ ddd
�ZdS)
�CallContextz"Holds information for a call site.��args�keywords�calleeNr\�list[NodeNG]r]�list[Keyword] | Noner^�
NodeNG | Nonec�R�||_|r
d�|D��}ng}||_||_dS)Nc�*�g|]}|j|jf��Sr)�argr-)rFrds r�
<listcomp>z(CallContext.__init__.<locals>.<listcomp>�s!��H�H�H������3�H�H�Hrr[)r'r\r]r^�arg_value_pairss rr(zCallContext.__init__�s?���� �� !�H�H�x�H�H�H�O�O� �O�'��
�����rrP)r\r_r]r`r^ra)rLrQrRrSrIr(rrrrZrZ�s@������,�,�.�I�
*.� $� ������rrZ�context�InferenceContext | Nonec�J�|�|���St��S)z4Clone a context if given, or return a fresh context.)r9r)rgs r�copy_contextrj�s"�����}�}�������rc�2�t|��}||_|S)a{Give a context a boundnode
to retrieve the correct function name or attribute value
with from further inference.
Do not use an existing context since the boundnode could then
be incorrectly propagated higher up in the call stack.
:param node: Node to do name lookups from
:type node NodeNG:
:returns: A new context
:rtype: InferenceContext
)rjr)rgr4s r�bind_context_to_noderl�s���7�#�#�G��G���Nr)rr)rgrhrr)rS�
__future__rrWrB�typingrrrrr�astroidr r
�astroid.nodes.node_classesrrr<r
r�__annotations__rrrZrjrlrrr�<module>rrs���
P�O�O�"�"�"�"�"�"�����
�
�
�
�A�A�A�A�A�A�A�A�A�A�A�A�A�A��;�)�)�)�)�)�)�)�)�:�:�:�:�:�:�:�:�� �(�H�S�M�8�C�=�(�3�-�
?�@�(�8�BT�T���%'��&�&�&�&�����BK�BK�BK�BK�BK�BK�BK�BK�J��������(���������r
?>