관리-도구
편집 파일: fix_print.cpython-312.pyc
� �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 � � |sJ �|j d� }|r1|j t t d� g |j �� � y |j d t d� k( sJ �|j dd }t |� dk( rt j |d � ry d x}x}}|r|d t � k( r|d d }d}|rR|d t j t j d� k( r(t |� d k\ sJ �|d j � }|d d }|D �cg c] }|j � �� } }| r d| d _ |�|�|�c|�%| j | dt! t# |� � � |�%| j | d t! t# |� � � |�| j | d|� t t d� | � } |j | _ | S c c}w )N�bare�print)�prefix� � ���� z>>r � � �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� � ���w��[�[��(� �����t�D��M�2�&0�&7�&7� 9� :���}�}�Q��4��=�0�0�0��}�}�Q�R� ���t�9��>�k�/�/��Q��8� �����c�D��D��H���'����9�D��C��D��G�v�{�{�5�+;�+;�T�B�B��t�9��>�!�>���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 �G c �( � 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: