| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/lib2to3/fixes/__pycache__/ |
Upload File : |
a
a d � @ sl d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z m
Z
mZ e�d�Z
G dd � d ej�Zd
S )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 @ s$ e Zd ZdZdZdd� Zdd� ZdS )�FixPrintTzP
simple_stmt< any* bare='print' any* > | print_stmt
c
C s� |sJ �|� d�}|r4|�ttd�g |jd�� d S |jd td�ksJJ �|jdd � }t|�dkrvt�|d �rvd S d } }}|r�|d t � kr�|d d� }d}|r�|d t
�tj
d�kr�t|�d ks�J �|d �� }|d
d � }dd� |D �}|�rd
|d _|d u�s"|d u�s"|d u�rz|d u�rB| �|dtt|��� |d u�rb| �|dtt|��� |d u�rz| �|d|� ttd�|�} |j| _| S )NZbare�print)�prefix� � ���� z>>r � c S s g | ]}|� � �qS � )�clone)�.0�argr r �-/usr/lib/python3.9/lib2to3/fixes/fix_print.py�
<listcomp>? � z&FixPrint.transform.<locals>.<listcomp>� �sep�end�file)�get�replacer r r Zchildren�len�parend_expr�matchr r �Leafr �
RIGHTSHIFTr � add_kwargr �repr)
�selfZnode�resultsZ
bare_print�argsr r r Zl_argsZn_stmtr r r � transform% s@
�
zFixPrint.transformc C sN d|_ t�| jjt|�t�tjd�|f�}|r@|� t
� � d|_ |� |� d S )Nr �=r )r r ZNodeZsyms�argumentr r"