Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint/checkers/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pylint/checkers/__pycache__/deprecated.cpython-311.pyc

�

�܋f�%����dZddlmZddlmZmZddlmZddlZddlm	Z	ddl
mZddlm
Z
dd	lmZmZmZdd
lmZejeje	je	jfZGd�de
��ZdS)
z+Checker mixin for deprecated functionality.�)�annotations)�	Container�Iterable)�chainN)�nodes)�utils)�BaseChecker)�get_import_name�	infer_all�
safe_infer)�MessageDefinitionTuplec���eZdZUdZdddddgdd�fiZd	ed
<ddd
ddgdd�fiZd	ed<dddddgdd�fiZd	ed<dddddgdd�fiZd	ed<dddd d!gdd�fiZ	d	ed"<e
jd
dd��dDd'���Ze
jdd��dEd)���Z
dFd+�Ze
jd��dGd-���Ze
jdd��dHd/���ZdId1�ZdJd5�ZdFd6�ZdKd8�ZdLd;�ZdMd>�ZdNdA�ZdDdB�ZdCS)O�DeprecatedMixinz�A mixin implementing logic for checking deprecated symbols.

    A class implementing mixin must define "deprecated-method" Message.
    �W4901zDeprecated module %r�deprecated-modulez*A module marked as deprecated is imported.)�W0402zold-deprecated-moduleT)�	old_names�sharedz!dict[str, MessageDefinitionTuple]�DEPRECATED_MODULE_MESSAGE�W4902zUsing deprecated method %s()�deprecated-methodzEThe method is marked as deprecated and will be removed in the future.)�W1505zold-deprecated-method�DEPRECATED_METHOD_MESSAGE�W4903z+Using deprecated argument %s of method %s()�deprecated-argumentzGThe argument is marked as deprecated and will be removed in the future.)�W1511zold-deprecated-argument�DEPRECATED_ARGUMENT_MESSAGE�W4904z&Using deprecated class %s of module %s�deprecated-classzDThe class is marked as deprecated and will be removed in the future.)�W1512zold-deprecated-class�DEPRECATED_CLASS_MESSAGE�W4905zUsing deprecated decorator %s()�deprecated-decoratorzHThe decorator is marked as deprecated and will be removed in the future.)�W1513zold-deprecated-decorator�DEPRECATED_DECORATOR_MESSAGE�node�
nodes.Call�return�Nonec��|�|��t|j��D]}|�||���dS)z2Called when a :class:`nodes.Call` node is visited.N)�check_deprecated_class_in_callr�func�check_deprecated_method)�selfr&�inferreds   �k/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint/checkers/deprecated.py�
visit_callzDeprecatedMixin.visit_callOsT��	
�+�+�D�1�1�1�!�$�)�,�,�	9�	9�H��(�(��x�8�8�8�8�	9�	9��nodes.Importc���d�|jD��D]M}|�||��d|vr1|�dd��\}}|�|||f���NdS)z+Triggered when an import statement is seen.c3� K�|]	\}}|V��
dS�N���.0�name�_s   r0�	<genexpr>z/DeprecatedMixin.visit_import.<locals>.<genexpr>as&����4�4�g�d�A�T�4�4�4�4�4�4r2�.�N)�names�check_deprecated_module�split�check_deprecated_class)r.r&r:�mod_name�
class_names     r0�visit_importzDeprecatedMixin.visit_import[s���5�4���4�4�4�	K�	K�D��(�(��t�4�4�4��d�{�{�'+�z�z�#�q�'9�'9�$��*��+�+�D�(�Z�M�J�J�J��	K�	Kr2�
Iterable[str]c��dS)z�Callback returning the deprecated decorators.

        Returns:
            collections.abc.Container of deprecated decorator names.
        r7r7�r.s r0�deprecated_decoratorsz%DeprecatedMixin.deprecated_decoratorsh�	���rr2�nodes.Decoratorsc��t|�����}|sdSt|dtj��rt|dj��}nt|d��}|r|���nd}||���vr|�	d||���dSdS)z-Triggered when a decorator statement is seen.Nrr#�r&�args)
�list�get_children�
isinstancer�Callrr,�qnamerI�add_message)r.r&�children�infrSs     r0�visit_decoratorsz DeprecatedMixin.visit_decoratorsps�����)�)�+�+�,�,���	��F��h�q�k�5�:�.�.�	*��X�a�[�-�.�.�C�C��X�a�[�)�)�C�"�,��	�	�������D�.�.�0�0�0�0����3�$�U��K�K�K�K�K�1�0r2�nodes.ImportFromc��|j}t||��}|�||��d�|jD��}|�|||��dS)z(Triggered when a from statement is seen.c3� K�|]	\}}|V��
dSr6r7r8s   r0r<z3DeprecatedMixin.visit_importfrom.<locals>.<genexpr>�s&����6�6���a�t�6�6�6�6�6�6r2N)�modnamer
r@r?rB)r.r&�basename�class_namess    r0�visit_importfromz DeprecatedMixin.visit_importfrom~sc���<��"�4��2�2���$�$�T�8�4�4�4�6�6�4�:�6�6�6���#�#�D�(�K�@�@�@�@�@r2�Container[str]c��dS)z�Callback returning the deprecated methods/functions.

        Returns:
            collections.abc.Container of deprecated function/method names.
        r7r7rHs r0�deprecated_methodsz"DeprecatedMixin.deprecated_methods�rJr2�method�str� Iterable[tuple[int | None, str]]c��dS)aPCallback returning the deprecated arguments of method/function.

        Args:
            method (str): name of function/method checked for deprecated arguments

        Returns:
            collections.abc.Iterable in form:
                ((POSITION1, PARAM1), (POSITION2: PARAM2) ...)
            where
                * POSITIONX - position of deprecated argument PARAMX in function definition.
                  If argument is keyword-only, POSITIONX should be None.
                * PARAMX - name of the deprecated argument.
            E.g. suppose function:

            .. code-block:: python
                def bar(arg1, arg2, arg3, arg4, arg5='spam')

            with deprecated arguments `arg2` and `arg4`. `deprecated_arguments` should return:

            .. code-block:: python
                ((1, 'arg2'), (3, 'arg4'))
        r7r7)r.rbs  r0�deprecated_argumentsz$DeprecatedMixin.deprecated_arguments�s	��0�rr2c��dS)z�Callback returning the deprecated modules.

        Returns:
            collections.abc.Container of deprecated module names.
        r7r7rHs r0�deprecated_modulesz"DeprecatedMixin.deprecated_modules�rJr2�modulec��dS)z�Callback returning the deprecated classes of module.

        Args:
            module (str): name of module checked for deprecated classes

        Returns:
            collections.abc.Container of deprecated class names.
        r7r7)r.ris  r0�deprecated_classesz"DeprecatedMixin.deprecated_classes�s	���rr2�mod_path�
str | Nonec��|���D]:}||ks|r0|�|dz��r|�d||����;dS)z#Checks if the module is deprecated.r=rrMN)rh�
startswithrT)r.r&rlrCs    r0r@z'DeprecatedMixin.check_deprecated_module�sp���/�/�1�1�	P�	P�H��8�#�#�x�#�H�4G�4G��SV��4W�4W�#�� � �!4�4�h� �O�O�O��	P�	Pr2r/�nodes.NodeNGc���t|t��sdSt|jtj��r
|jj}n.t|jtj��r
|jj}ndS|���|h}t�fd�|D����r��
d||f���dSt|j��}|j
rd�|j
D��ni}�fd�|D��}t|�D]F\}}	|	|vr��
d||	|f����$|� ||kr��
d||	|f����GdS)z�Executes the checker for the given node.

        This method should be called from the checker implementing this mixin.
        Nc3�D�K�|]}|����vV��dSr6)ra)r9r:r.s  �r0r<z:DeprecatedMixin.check_deprecated_method.<locals>.<genexpr>�s4�����D�D�T�t�t�.�.�0�0�0�D�D�D�D�D�Dr2rrMc��h|]	}|j��
Sr7)�arg)r9�kws  r0�	<setcomp>z:DeprecatedMixin.check_deprecated_method.<locals>.<setcomp>�s��1�1�1�R�"�&�1�1�1r2c3�B�K�|]}��|��V��dSr6)rf)r9�qnr.s  �r0r<z:DeprecatedMixin.check_deprecated_method.<locals>.<genexpr>�s1�����O�O�"�� 9� 9�"� =� =�O�O�O�O�O�Or2r)rQ�ACCEPTABLE_NODESr,r�	Attribute�attrname�Namer:rS�anyrT�lenrN�keywordsr)
r.r&r/�	func_name�qnames�num_of_args�kwargsrf�position�arg_names
`         r0r-z'DeprecatedMixin.check_deprecated_method�s�����(�$4�5�5�	��F��d�i���1�1�	��	�*�I�I�
��	�5�:�
.�
.�	��	��I�I�
�F��.�.�"�"�I�.���D�D�D�D�V�D�D�D�D�D�	����0�t�9�,��O�O�O��F��$�)�n�n��59�]�J�1�1�4�=�1�1�1�1���O�O�O�O��O�O�O��"'�)=�">�
	�
	��H�h��6�!�!�� � �)��H�i�;P�!������%�(�[�*@�*@�� � �)��H�i�;P�!�����
	�
	r2rCr]c�r�|D]3}||�|��vr|�d|||f����4dS)z"Checks if the class is deprecated.rrMN)rkrT)r.r&rCr]rDs     r0rBz&DeprecatedMixin.check_deprecated_class�s`��
&�	�	�J��T�4�4�X�>�>�>�>�� � �&�T��X�8N�!�����	�	r2c��t|jtj��r[t|jjtj��r9|jjj}|jj}|�|||f��dSdSdS)z$Checks if call the deprecated class.N)	rQr,rrz�exprr|r:r{rB)r.r&rCrDs    r0r+z.DeprecatedMixin.check_deprecated_class_in_call�s����d�i���1�1�	G�j��I�N�E�J�7
�7
�	G��y�~�*�H���+�J��'�'��h��
�F�F�F�F�F�	G�	G�	G�	Gr2N)r&r'r(r))r&r3r(r))r(rF)r&rKr(r))r&rXr(r))r(r_)rbrcr(rd)rircr(rF)r&r3rlrmr(r))r&r'r/rpr(r))r&rprCrcr]rFr(r))�__name__�
__module__�__qualname__�__doc__r�__annotations__rrr!r%r�only_required_for_messagesr1rErIrWr^rarfrhrkr@r-rBr+r7r2r0rrs����������	�"��8�=�>�$�O�O�	
�D������	�*��S�=�>�$�O�O�	
�D������	�9�!�U�?�@�D�Q�Q�	
�F������	�4��R�<�=��N�N�	
�C������	�-�"�V�@�A�T�R�R�	
�G� �����&�U�%������
9�9�9���
9�&�U�%�����K�K�K�	��K�����&�U�%�&<�=�=�L�L�L�>�=�L�&�U�%�����A�A�A�	��A���������4����
�
�
�
�P�P�P�P�#�#�#�#�J	�	�	�	�G�G�G�G�G�Gr2r)r��
__future__r�collections.abcrr�	itertoolsr�astroidr�pylint.checkersr�pylint.checkers.base_checkerr	�pylint.checkers.utilsr
rr�
pylint.typingr
�BoundMethod�
UnboundMethod�FunctionDef�ClassDefryrr7r2r0�<module>r�s!��
2�1�"�"�"�"�"�"�/�/�/�/�/�/�/�/�����������������!�!�!�!�!�!�4�4�4�4�4�4�H�H�H�H�H�H�H�H�H�H�0�0�0�0�0�0�����	��	�N�	��bG�bG�bG�bG�bG�k�bG�bG�bG�bG�bGr2

Hacked By AnonymousFox1.0, Coded By AnonymousFox