Your IP : 13.59.69.109
�
�Q�f � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z m
Z
mZ ej d� Z
G d� d ej � Zy
)a Fixer for print.
Change:
'print' into 'print()'
'print ...' into 'print(...)'
'print ... ,' into 'print(..., end=" ")'
'print >>x, ...' into 'print(..., file=x)'
No changes are applied if print_function is imported from __future__
� )�patcomp)�pytree)�token)�
fixer_base)�Name�Call�Comma�Stringz"atom< '(' [atom|STRING|NAME] ')' >c � � e Zd ZdZdZd� Zd� Zy)�FixPrintTzP
simple_stmt< any* bare='print' any* > | print_stmt
c �: � |j d� }|r1|j t t d� g |j �� � y |j
dd }t
|� dk( rt j |d � ry d x}x}}|r|d t � k( r|d d }d}|rB|d t j t j d� k( r|d j � }|d d }|D �cg c] }|j � �� } }| r
d
| d _ |�|�|�c|�%| j | dt! t# |� � � |�%| j | dt! t# |� � � |�| j | d
|� t t d� | � }
|j |
_ |
S c c}w )N�bare�print)�prefix� � ���� z>>� � �sep�end�file)�get�replacer r r �children�len�parend_expr�matchr r �Leafr �
RIGHTSHIFT�clone� add_kwargr
�repr)�self�node�results�
bare_print�argsr r r �arg�l_args�n_stmts �>/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_print.py� transformzFixPrint.transform% s� � � �[�[��(�
�����t�D��M�2�&0�&7�&7� 9�
:���}�}�Q�R� ���t�9��>�k�/�/��Q��8�
�����c�D��D��H���'����9�D��C��D��G�v�{�{�5�+;�+;�T�B�B���7�=�=�?�D����8�D�)-�.��#�#�)�)�+���.��!�F�1�I���?�c�o��1A������v�u�f�T�#�Y�.?�@������v�u�f�T�#�Y�.?�@������v�v�t�4��d�7�m�V�,������
��
�� /s �"Fc �( � d|_ t j | j j t |� t j t j d� |f� }|r |j t � � d|_ |j |� y )Nr �=r )r r �Node�syms�argumentr r r �EQUAL�appendr )r% �l_nodes�s_kwd�n_expr�
n_arguments r- r# zFixPrint.add_kwargM sk � ���
��[�[����!3�!3�"&�u�+�"(�+�+�e�k�k�3�"?�"(�"*�+�
� ��N�N�5�7�#� #�J�����z�"� N)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr. r# � r: r- r r s � ��M��G�&�P
#r: r N)�__doc__r r r �pgen2r r �
fixer_utilr r r r
�compile_patternr �BaseFixr r@ r: r- �<module>rF sG ��
� � � � � 2� 2� &�g�%�%�6���
:#�z�!�!� :#r: