Your IP : 18.223.210.196


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_xrange.cpython-312.opt-1.pyc

�

�Q�f�
��^�dZddlmZddlmZmZmZddlmZGd�dej�Z	y)z/Fixer that changes xrange(...) into range(...).�)�
fixer_base)�Name�Call�consuming_calls)�patcompc���eZdZdZdZ�fd�Zd�Zd�Zd�Zd�Z	dZ
eje
�Z
d	Zeje�Zd
�Z�xZS)�	FixXrangeTz�
              power<
                 (name='range'|name='xrange') trailer< '(' args=any ')' >
              rest=any* >
              c�L��tt|�||�t�|_y�N)�superr	�
start_tree�set�transformed_xranges)�self�tree�filename�	__class__s   ��?/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_xrange.pyr
zFixXrange.start_trees���
�i��)�$��9�#&�5�� �c��d|_yr)r)rrrs   r�finish_treezFixXrange.finish_trees
��#'�� rc��|d}|jdk(r|j||�S|jdk(r|j||�Stt	|���)N�name�xrange�range)�value�transform_xrange�transform_range�
ValueError�repr�r�node�resultsrs    r�	transformzFixXrange.transformsX���v����:�:��!��(�(��w�7�7�
�Z�Z�7�
"��'�'��g�6�6��T�$�Z�(�(rc��|d}|jtd|j���|jj	t|��y)Nrr��prefix)�replacerr'r�add�idr!s    rrzFixXrange.transform_xrange$s:���v������T�'�$�+�+�6�7�� � �$�$�R��X�.rc�"�t|�|jvrx|j|�sftt	d�|dj�g�}tt	d�|g|j��}|dD]}|j|��|Syy)Nr�args�listr&�rest)r*r�in_special_contextrr�cloner'�append_child)rr"r#�
range_call�	list_call�ns      rrzFixXrange.transform_range*s����t�H�D�4�4�4��'�'��-��d�7�m�g�f�o�.C�.C�.E�-F�G�J��T�&�\�J�<�$(�K�K�1�I��V�_���&�&�q�)�%���.�
5rz3power< func=NAME trailer< '(' node=any ')' > any* >z�for_stmt< 'for' any 'in' node=any ':' any* >
            | comp_for< 'for' any 'in' node=any any* >
            | comparison< any 'in' node=any any*>
         c�B�|j�yi}|jj�L|jj|jj|�r|d|ur|djtvS|j
j|j|�xr|d|uS)NFr"�func)�parent�p1�matchrr�p2)rr"r#s   rr/zFixXrange.in_special_context?s����;�;������K�K���*��w�w�}�}�T�[�[�/�/��9��v��$�&��6�?�(�(�O�;�;��w�w�}�}�T�[�[�'�2�N�w�v��$�7N�Nr)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr
rr$rr�P1r�compile_patternr8�P2r:r/�
__classcell__)rs@rr	r	sb����M��G�)�(�)�/�
�
?�B�	 ��	 �	 ��	$�B�

�B�
!��	 �	 ��	$�B�
Orr	N)
�__doc__�r�
fixer_utilrrrr�BaseFixr	�rr�<module>rIs,��6��4�4��=O�
�"�"�=Or

?>