OwlCyberSecurity - MANAGER
Edit File: context.cpython-311.pyc
� ������hj��������������������������U�d�Z�ddlmZ�ddlZddlZddlmZmZmZm Z m Z �erddlmZm Z �ddlmZmZ�ee dee���������ee���������ee���������f���������e d���������f���������Zi�Zded <���dd�Z�G�d ��d������������Z�G�d��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�����������������������������������������������d�S��N)r����clear��������`/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib/python3.11/site-packages/astroid/context.py�_invalidate_cacher������s�������������r���c������������������������e�Zd�ZdZdZdZ � �ddd�Zedd ���������������Zej ��������dd ���������������Zedd���������������Z dd�Zdd�Ze j��������d����������������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�d���N�nodes_inferred�list[int] | Nonec����������������������|� dg|�_���������n||�_���������|p t������������������������|�_�������� �d�|�_�������� �d�|�_�������� �d�|�_�������� �i�|�_�������� �i�|�_��������d�S��Nr���)r ����setr���r���r���r���r���r���)�selfr���r"���s��� r����__init__zInferenceContext.__init__/���s{������ ��!�$%�3�D� � �#1�D� ��M�C�E�E�� � ��'+��� ��04���D���� �� ��� ��SU���'�'r���r����intc����������������������|�j���������d���������S�)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��� r���r"���zInferenceContext.nodes_inferred]���s��������#�A�&�&r����valuer���c����������������������||�j���������d<���d�S�r%���r+���)r'���r-���s��� r���r"���zInferenceContext.nodes_inferredg���s������"'���Q���r���r ���c����������������������t�����������S�)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 )r���r,���s��� r����inferredzInferenceContext.inferredk���s ������� �r����boolc�����������������f�����|�j���������}||f|�j��������v�rdS�|�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)r���r����add)r'����node�names��� r����pushzInferenceContext.pushu���s>�����������$�<�4�9�$�$��4�� � � �t�T�l�#�#�#��ur���c�����������������������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"���)r���r����copyr ���r���r���r���r���)r'����clones��� r���r9���zInferenceContext.clone����s`�������!�����!1�!1�$�BV�W�W�W�� �,����.���"�0��� �,�1�1�3�3����r���c��������������#���H���K����t����������|�j��������������������}d�V���||�_��������d�S�r���)r&���r���)r'���r���s��� r����restore_pathzInferenceContext.restore_path����s'�����������4�9�~�~�� ������ � � r����strc��������������������������fd���j���������D���������������}d���������������������t������������������������j��������d���������������������|������������������������S�)Nc����������� ���3�������K����|�]=}|��d�t����������j��������t�����������|������������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� �� �� �� �� �� r���z{}({})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#���)r���r)���)r-���r)���r���r���)r���r ���)r���r1���)r���r���)r���r<���)rL���� __module__�__qualname__�__doc__rI����max_inferredr(����propertyr"����setterr0���r6���r9���� contextlib�contextmanagerr;���rO���r���r���r���r���r������s�����������������I���L���+/�,(��,(��,(��,(��,(�\��'��'��'���X�'����(��(��(����(��� �� �� ���X� � �� �� �� � �� �� �� ����������� K��K��K��K��K��Kr���r���c�������������������$�����e�Zd�ZdZdZ � �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�}||�_��������||�_��������d�S�)Nc�����������������*�����g�|�]}|j���������|j��������f��S�r���)�argr-���)rF���rd���s��� r���� <listcomp>z(CallContext.__init__.<locals>.<listcomp>����s!������H�H�H������3�H�H�Hr���r[���)r'���r\���r]���r^����arg_value_pairss��� r���r(���zCallContext.__init__����s?��������� ��� !�H�H�x�H�H�H�O�O� �O�'�� �����r���rP���)r\���r_���r]���r`���r^���ra���)rL���rQ���rR���rS���rI���r(���r���r���r���rZ���rZ�������s@��������������,�,�.�I� �*.� $� ������������r���rZ����context�InferenceContext | Nonec�����������������J�����|��|�������������������������������������S�t������������������������S�)z4Clone a context if given, or return a fresh context.)r9���r���)rg���s��� r����copy_contextrj�������s"���������}�}�������r���c�����������������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 )rj���r���)rg���r4���s��� r����bind_context_to_noderl�������s��������7�#�#�G��G���Nr���)r���r���)rg���rh���r���r���)rS���� __future__r���rW���rB����typingr���r���r���r���r����astroidr ���r ����astroid.nodes.node_classesr���r���r<���r ���r����__annotations__r���r���rZ���rj���rl���r���r���r����<module>rr������s����� �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���