AlkantarClanX12

Your IP : 18.116.89.8


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/fix_operator.cpython-312.pyc

�

�Q�fb
��d�dZddlZddlmZddlmZmZmZm	Z	d�Z
Gd�dej�Zy)a�Fixer for operator functions.

operator.isCallable(obj)       -> callable(obj)
operator.sequenceIncludes(obj) -> operator.contains(obj)
operator.isSequenceType(obj)   -> isinstance(obj, collections.abc.Sequence)
operator.isMappingType(obj)    -> isinstance(obj, collections.abc.Mapping)
operator.isNumberType(obj)     -> isinstance(obj, numbers.Number)
operator.repeat(obj, n)        -> operator.mul(obj, n)
operator.irepeat(obj, n)       -> operator.imul(obj, n)
�N)�
fixer_base)�Call�Name�String�touch_importc����fd�}|S)Nc����|_|S�N)�
invocation)�f�ss ��A/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_operator.py�deczinvocation.<locals>.decs���������)r
rs` rrrs�����Jrc��eZdZdZdZdZdZdeee��zZd�Z	e
d�d	��Ze
d
�d��Ze
d�d
��Z
e
d�d��Ze
d�d��Ze
d�d��Ze
d�d��Zd�Zd�Zd�Zy)�FixOperatorT�prez�
              method=('isCallable'|'sequenceIncludes'
                     |'isSequenceType'|'isMappingType'|'isNumberType'
                     |'repeat'|'irepeat')
              z'(' obj=any ')'z�
              power< module='operator'
                trailer< '.' %(methods)s > trailer< %(obj)s > >
              |
              power< %(methods)s trailer< %(obj)s > >
              )�methods�objc�>�|j||�}|�	|||�Syr
)�
_check_method)�self�node�results�methods    r�	transformzFixOperator.transform+s,���#�#�D�'�2�����$��(�(�rzoperator.contains(%s)c�(�|j||d�S)N�contains��_handle_rename�rrrs   r�_sequenceIncludeszFixOperator._sequenceIncludes0s���"�"�4��*�=�=rzcallable(%s)c�l�|d}ttd�|j�g|j��S)Nr�callable��prefix)rr�cloner')rrrrs    r�_isCallablezFixOperator._isCallable4s+���e�n���D��$�s�y�y�{�m�D�K�K�H�Hrzoperator.mul(%s)c�(�|j||d�S)N�mulr r"s   r�_repeatzFixOperator._repeat9s���"�"�4��%�8�8rzoperator.imul(%s)c�(�|j||d�S)N�imulr r"s   r�_irepeatzFixOperator._irepeat=s���"�"�4��&�9�9rz(isinstance(%s, collections.abc.Sequence)c�*�|j||dd�S)N�collections.abc�Sequence��_handle_type2abcr"s   r�_isSequenceTypezFixOperator._isSequenceTypeAs���$�$�T�7�4E�z�R�Rrz'isinstance(%s, collections.abc.Mapping)c�*�|j||dd�S)Nr1�Mappingr3r"s   r�_isMappingTypezFixOperator._isMappingTypeEs���$�$�T�7�4E�y�Q�Qrzisinstance(%s, numbers.Number)c�*�|j||dd�S)N�numbers�Numberr3r"s   r�
_isNumberTypezFixOperator._isNumberTypeIs���$�$�T�7�I�x�H�Hrc�B�|dd}||_|j�y)Nrr)�value�changed)rrr�namers     rr!zFixOperator._handle_renameMs"����"�1�%��������rc���td||�|d}|j�tddj||g�z�g}t	td�||j��S)Nrz, �.�
isinstancer&)rr(r�joinrrr')rrr�module�abcr�argss       rr4zFixOperator._handle_type2abcRsV���T�6�4�(��e�n���	�	��V�D�3�8�8�V�S�M�+B�$B�C�D���D��&��T�[�[�A�Arc��t|d|ddjz�}t|tjj
�r9d|vr|St
|d�f}|j|z}|j|d|z�y)N�_rrrErzYou should use '%s' here.)	�getattrr>rC�collectionsrF�Callable�strr�warning)rrrr�sub�invocation_strs      rrzFixOperator._check_methodXs|����s�W�X�%6�q�%9�%?�%?�?�@���f�k�o�o�6�6�7��7�"��
��7�5�>�*�,��!'�!2�!2�S�!8�����T�#>��#O�P�rN)�__name__�
__module__�__qualname__�
BM_compatible�orderrr�dict�PATTERNrrr#r)r,r/r5r8r<r!r4rrrrrrs���M��E��G�
�C��
��c�2�3�G�)�
�'�(�>�)�>����I� �I��"�#�9�$�9��#�$�:�%�:��:�;�S�<�S��9�:�R�;�R��0�1�I�2�I��
B�	rr)
�__doc__�collections.abcrK�lib2to3r�lib2to3.fixer_utilrrrrr�BaseFixrrrr�<module>r]s3��	���?�?��G�*�$�$�Gr