| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3/dist-packages/jedi/inference/__pycache__/ |
Upload File : |
�
p�{cD � � � d Z ddlmZ ddlmZ ddlmZ dZ dZ dZ dZ
G d � d
� � Zed� � � Zefd�Z
G d
� d� � ZdS )a
Recursions are the recipe of |jedi| to conquer Python code. However, someone
must stop recursions going mad. Some settings are here to make |jedi| stop at
the right time. You can read more about them :ref:`here <settings-recursion>`.
Next to the internal ``jedi.inference.cache`` this module also makes |jedi| not
thread-safe, because ``execution_recursion_decorator`` uses class variables to
count the function calls.
.. _settings-recursion:
Settings
~~~~~~~~~~
Recursion settings are important if you don't want extremely
recursive python code to go absolutely crazy.
The default values are based on experiments while completing the |jedi| library
itself (inception!). But I don't think there's any other Python library that
uses recursion in a similarly extreme way. Completion should also be fast and
therefore the quality might not always be maximal.
.. autodata:: recursion_limit
.. autodata:: total_function_execution_limit
.. autodata:: per_function_execution_limit
.. autodata:: per_function_recursion_limit
� )�contextmanager)�debug)� NO_VALUES� �� � � c � � e Zd Zd� ZdS )�RecursionDetectorc � � g | _ d S �N)�pushed_nodes��selfs �:/usr/lib/python3/dist-packages/jedi/inference/recursion.py�__init__zRecursionDetector.__init__6 s � ������ N)�__name__�
__module__�__qualname__r � r r r r 5 s# � � � � � �� � � � r r c # � K � | j j }||v r+t j d|t |dd� � � � dV � dS |� |� � dV � |� � � dS # |� � � w xY w)z�
A decorator to detect recursions in statements. In a recursion a statement
at the same place, in the same module may not be executed two times.
zcatched stmt recursion: %s @%s� start_posNFT)�recursion_detectorr r �warning�getattr�append�pop)�inference_state�noder s r �execution_allowedr! : s� � � � � #�5�B�L��|���
�
�6���d�K��6�6� 8� 8� 8������� �����%�%�%��J�J�J����������L���������s �A. �.Bc � � � � fd�}|S )Nc � �� � �� fd�}|S )Nc �� �� | j j }|� | � � } |r�}n �| fi |��}|� � � n# |� � � w xY w|S r
)r �execution_recursion_detector�push_execution�
pop_execution)r �kwargs�detector�
limit_reached�result�default�funcs ��r �wrapperzAexecution_recursion_decorator.<locals>.decorator.<locals>.wrapperP s~ �� ��+�H�H�$�3�3�D�9�9�M�
)� � 2�$�F�F�!�T�$�1�1�&�1�1�F��&�&�(�(�(�(���&�&�(�(�(�(�����Ms �A �Ar )r- r. r, s ` �r � decoratorz0execution_recursion_decorator.<locals>.decoratorO s) ��� �
�
�
�
�
�
� �r r )r, r/ s ` r �execution_recursion_decoratorr0 N s$ �� �� � � � � �r c �$ � e Zd ZdZd� Zd� Zd� ZdS )�ExecutionRecursionDetectorz+
Catches recursions of executions.
c �L � || _ d| _ g | _ i | _ d| _ d S )Nr )�_inference_state�_recursion_level�_parent_execution_funcs�_funcdef_execution_counts�_execution_count)r r s r r z#ExecutionRecursionDetector.__init__c s0 � � /��� !���')��$�)+��&� !����r c �X � | j � � � | xj dz c_ d S )N� )r6 r r5 r s r r'