Your IP : 3.139.80.194


Current Path : /opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/fixes/__pycache__/fix_operator.cpython-311.pyc

�

c��fb
��b�dZddlZddlmZddlmZmZmZm	Z	d�Z
Gd�dej��ZdS)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/python311/lib64/python3.11/lib2to3/fixes/fix_operator.py�deczinvocation.<locals>.decs���������)r
rs` rrrs#���������Jrc�n�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�ZdS)�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�N�|�||��}|�|||��SdSr
)�
_check_method)�self�node�results�methods    r�	transformzFixOperator.transform+s7���#�#�D�'�2�2�����6�$��(�(�(��rzoperator.contains(%s)c�0�|�||d��S)N�contains��_handle_rename�rrrs   r�_sequenceIncludeszFixOperator._sequenceIncludes0s���"�"�4��*�=�=�=rzcallable(%s)c��|d}ttd��|���g|j���S)Nr�callable��prefix)rr�cloner')rrrrs    r�_isCallablezFixOperator._isCallable4s4���e�n���D��$�$�s�y�y�{�{�m�D�K�H�H�H�Hrzoperator.mul(%s)c�0�|�||d��S)N�mulr r"s   r�_repeatzFixOperator._repeat9s���"�"�4��%�8�8�8rzoperator.imul(%s)c�0�|�||d��S)N�imulr r"s   r�_irepeatzFixOperator._irepeat=s���"�"�4��&�9�9�9rz(isinstance(%s, collections.abc.Sequence)c�2�|�||dd��S)N�collections.abc�Sequence��_handle_type2abcr"s   r�_isSequenceTypezFixOperator._isSequenceTypeAs���$�$�T�7�4E�z�R�R�Rrz'isinstance(%s, collections.abc.Mapping)c�2�|�||dd��S)Nr1�Mappingr3r"s   r�_isMappingTypezFixOperator._isMappingTypeEs���$�$�T�7�4E�y�Q�Q�Qrzisinstance(%s, numbers.Number)c�2�|�||dd��S)N�numbers�Numberr3r"s   r�
_isNumberTypezFixOperator._isNumberTypeIs���$�$�T�7�I�x�H�H�Hrc�X�|dd}||_|���dS)Nrr)�value�changed)rrr�namers     rr!zFixOperator._handle_renameMs.����"�1�%������������rc���td||��|d}|���tdd�||g��z��g}t	td��||j���S)Nrz, �.�
isinstancer&)rr(r�joinrrr')rrr�module�abcr�argss       rr4zFixOperator._handle_type2abcRsk���T�6�4�(�(�(��e�n���	�	���V�D�3�8�8�V�S�M�+B�+B�$B�C�C�D���D��&�&��T�[�A�A�A�Arc�
�t|d|ddjz��}t|tjj��r?d|vr|St
|d��f}|j|z}|�|d|z��dS)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�6�7�7�	Q��7�"�"��
��7�5�>�*�*�,��!'�!2�S�!8�����T�#>��#O�P�P�P��trN)�__name__�
__module__�__qualname__�
BM_compatible�orderrr�dict�PATTERNrrr#r)r,r/r5r8r<r!r4rrrrrrs��������M��E��G�
�C��
�D��c�2�2�2�3�G�)�)�)�
�Z�'�(�(�>�>�)�(�>��Z����I�I� ��I��Z�"�#�#�9�9�$�#�9��Z�#�$�$�:�:�%�$�:��Z�:�;�;�S�S�<�;�S��Z�9�:�:�R�R�;�:�R��Z�0�1�1�I�I�2�1�I����
B�B�B�	�	�	�	�	rr)
�__doc__�collections.abcrK�lib2to3r�lib2to3.fixer_utilrrrrr�BaseFixrrrr�<module>r]s���	�	�����������?�?�?�?�?�?�?�?�?�?�?�?����G�G�G�G�G�*�$�G�G�G�G�Gr

?>