????

Your IP : 13.59.219.20


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__/decorators.cpython-311.pyc

�

�܋fj'���dZddlmZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlZddl
mZmZddlmZddlmZejd	krdd
l
mZndd
lmZed��Zed��Zejd
���ZGd�d��Zd�Zejd���Zejd���Zej��r	ddd�Z 	ddd�Z!dS	ddd�Z 	ddd�Z!dS)z(A few useful function/method decorators.�)�annotationsN)�Callable�	Generator)�TypeVar)�_cache�util)�InferenceContext)�InferenceError)��
)�	ParamSpec�_R�_Pc���t|dd��}|�(ix|_}tj�|��	||S#t
$r||i|��x||<}|cYSwxYw)z>Simple decorator to cache result of method calls without args.�__cacheN)�getattrrr�
CACHE_MANAGER�add_dict_cache�KeyError)�func�instance�args�kwargs�cache�results      �c/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/astroid/decorators.py�cachedrs���
�H�i��.�.�E��}�#%�%���5���+�+�E�2�2�2���T�{�������#�t�T�4�V�4�4�4��d��f��
�
�
����s�A�A!� A!c�:�eZdZdZdZd�Zed���Zdd�ZdS)�cachedpropertya�Provides a cached property equivalent to the stacking of
    @cached and @property, but more efficient.

    After first usage, the <property_name> becomes part of the object's
    __dict__. Doing:

      del obj.<property_name> empties the cache.

    Idea taken from the pyramid_ framework and the mercurial_ project.

    .. _pyramid: http://pypi.python.org/pypi/pyramid
    .. _mercurial: http://pypi.python.org/pypi/Mercurial
    )�wrappedc���tjdkrtjdtd���	|jn%#t$r}t|�d���|�d}~wwxYw||_dS)N)r�z}cachedproperty has been deprecated and will be removed in astroid 3.0 for Python 3.8+. Use functools.cached_property instead.���
stacklevelz must have a __name__ attribute)	�sys�version_info�warnings�warn�DeprecationWarning�__name__�AttributeError�	TypeErrorr )�selfr �excs   r�__init__zcachedproperty.__init__@s�����v�%�%��M�9�"��	
�
�
�
�	R�������	R�	R�	R��w�G�G�G�H�H�c�Q�����	R��������s�6�
A�A�Ac�F�t|jdd��}d|rd|zndzS)N�__doc__z+<wrapped by the cachedproperty decorator>%sz
%s�)rr )r.�docs  rr2zcachedproperty.__doc__Ns2���d�l�I�t�4�4��<��'�F�S�L�L�R�
�	
�Nc�n�|�|S|�|��}t||jj|��|S�N)r �setattrr+)r.�inst�objtype�vals    r�__get__zcachedproperty.__get__Us9���<��K��l�l�4� � ����d�l�+�S�1�1�1��
r5r7)r+�
__module__�__qualname__r2�	__slots__r0�propertyr<�r5rrr/sc���������I�����
�
��X�
������r5rc�H�tj|��d|fdd���}|S)z�Return the given infer function wrapped to handle the path.

    Used to stop inference if the node has already been looked
    at for a given `InferenceContext` to prevent infinite recursion
    N�context�InferenceContext | None�returnrc;�K�|�t��}|�|��rdSt��}|||fi|��D]9}|jjdkr|j}n|}||vr|V�|�|���:dS)z"Wrapper function handling context.N�Instance)r	�push�set�	__class__r+�_proxied�add)�noderC�_funcr�yielded�res�aress       rr zpath_wrapper.<locals>.wrappedds�����
�?�&�(�(�G��<�<����	��F��%�%���5��w�1�1�&�1�1�	"�	"�C��}�%��3�3��|������7�"�"��	�	�	����D�!�!�!��	"�	"r5)rCrDrEr��	functools�wraps)rr s  r�path_wrapperrU]s>���_�T���15�T�"�"�"�"���"�*�Nr5c#�K�||i|��}	t|��V�n#t$rtjV�YdSwxYw|Ed{V��dSr7)�next�
StopIterationr�Uninferable)rrrr�	generators     r�yes_if_nothing_inferredr[}s�������d�%�f�%�%�I���9�o�o����������������������
���������s��:�:c#�6K�||i|��}	t|��V�ns#t$r4}|jrtdi|jd��|�td��|�d}~wt$r*}tdtj���d���|�d}~wwxYw|Ed{V��dS)Nrz3StopIteration raised without any error information.z!RecursionError raised with limit �.rA)rWrXrr
�RecursionErrorr&�getrecursionlimit)rrrrrZ�errors      r�raise_if_nothing_inferredra�s�������d�%�f�%�%�I�
��9�o�o�����������:�	=� �1�1�5�:�a�=�1�1�u�<��A�
�
��	����������J��0E�0G�0G�J�J�J�
�
��	���������
���������s ��
B�/A�
B�$%B	�	B�3.0�astroid_version�str�	argumentsrE�.Callable[[Callable[_P, _R]], Callable[_P, _R]]c����d��fd�}|S)a�Decorator which emits a DeprecationWarning if any arguments specified
        are None or not passed at all.

        Arguments should be a key-value mapping, with the key being the argument to check
        and the value being a type annotation as string for the value of the argument.

        To improve performance, only used when DeprecationWarnings other than
        the default one are enabled.
        r�Callable[_P, _R]rEc�N���tj���d���fd���}|S)	�Decorator function.r�_P.argsr�	_P.kwargsrErc�`��ttj���j�����}����D]�\}}	|�|��}n5#t$r(td|�d|djj	�d���d�wxYw||vr||�8||vrx|dks.t|��|kst|��|krL||�Dtjd|�d|djj	�d�j
�d	��d
|�d|�d�
td
������|i|��S)z/Emit DeprecationWarnings if conditions are met.�Can't find argument '�' for 'r�'N���z#' will be a required argument for 'r]z
' in astroid z ('z' should be of type: 'z')r#r$��list�inspect�	signature�
parameters�keys�items�index�
ValueErrorrJr>�lenr(r)r+r*)	rrrw�arg�type_annotationryrercrs	      ���r�wrapperz@deprecate_default_argument_values.<locals>.deco.<locals>.wrapper�s�����G�-�d�3�3�>�C�C�E�E�F�F��,5�O�O�,=�,=���(�C��$� $�
�
�3������%�$�$�$�(�a�C�a�a��Q��@Q�@^�a�a�a���#�$�$��������6�#�;�+>��f�,�,�!�R�K�K�"�4�y�y�E�1�1� #�D�	�	�E� 1� 1�d�5�k�6I�!�
�P��P�P� $�Q�� 1� >�P�P�AE��P�P�+:�P�P�"%�P�P�=L�P�P�P�/�'(�
������t�T�,�V�,�,�,��A*�*2B�rrkrrlrErrR�rr~rercs` ��r�decoz/deprecate_default_argument_values.<locals>.deco�sK�����_�T�
"�
"�#
-�#
-�#
-�#
-�#
-�#
-�#
-�#�
"�#
-�J�Nr5�rrhrErhrA�rcrer�s`` r�!deprecate_default_argument_valuesr��s/���� )	�)	�)	�)	�)	�)	�)	�V�r5c����d��fd�}|S)a�Decorator which emits a DeprecationWarning if any arguments specified
        are passed.

        Arguments should be a key-value mapping, with the key being the argument to check
        and the value being a string that explains what to do instead of passing the argument.

        To improve performance, only used when DeprecationWarnings other than
        the default one are enabled.
        rrhrEc�N���tj���d���fd���}|S)	NrrkrrlrErc���ttj���j�����}����D]�\}}	|�|��}n5#t$r(td|�d|djj	�d���d�wxYw||vst|��|krAtjd|�d|djj	�d�j
�d��d|�d	�td
������|i|��S)NrnrorrpzThe argument 'r]z/' is deprecated and will be removed in astroid z (�)r#r$rr)	rrrwr|�noteryrercrs	      ���rr~z2deprecate_arguments.<locals>.deco.<locals>.wrapper�sc����G�-�d�3�3�>�C�C�E�E�F�F��!*���!2�!2���I�C��$� $�
�
�3������%�$�$�$�(�a�C�a�a��Q��@Q�@^�a�a�a���#�$�$�����f�}�}��D�	�	�E�(9�(9� �
�Y�S�Y�Y� $�Q�� 1� >�Y�Y�AE��Y�Y�>M�Y�Y�QU�Y�Y�Y�/�'(�������t�T�,�V�,�,�,rr�rRr�s` ��rr�z!deprecate_arguments.<locals>.deco�sH����
�_�T�
"�
"�
-�
-�
-�
-�
-�
-�
-�#�
"�
-�&�Nr5r�rAr�s`` r�deprecate_argumentsr��s.����	�	�	�	�	�	�	�.�r5c��dd�}|S)�bPassthrough decorator to improve performance if DeprecationWarnings are
        disabled.
        rrhrEc��|S�rjrA�rs rr�z/deprecate_default_argument_values.<locals>.deco����Kr5r�rAr�s   rr�r�
���	�	�	�	��r5c��dd�}|S)r�rrhrEc��|Sr�rAr�s rr�z!deprecate_arguments.<locals>.decor�r5r�rAr�s   rr�r�r�r5)rb)rcrdrerdrErf)"r2�
__future__rrSrtr&r(�collections.abcrr�typingr�wrapt�astroidrr�astroid.contextr	�astroid.exceptionsr
r'r
�typing_extensionsrr�	decoratorrrrUr[ra�check_warnings_filterr�r�rAr5r�<module>r�s8��
/�.�"�"�"�"�"�"���������
�
�
�
�����/�/�/�/�/�/�/�/����������� � � � � � � � �,�,�,�,�,�,�-�-�-�-�-�-���w��� � � � � � � �+�+�+�+�+�+��W�T�]�]���Y�t�_�_����
�
���
�+�+�+�+�+�+�+�+�\���@��
�
���
��������.�4����� %�;�;�;�;�;�| %�$�$�$�$�$�$�$�R %������ %�������r5