| Server IP : 23.254.227.96 / Your IP : 216.73.216.21 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/root/usr/lib64/python3.6/lib2to3/fixes/__pycache__/ |
Upload File : |
3
\ � @ sl d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z m
Z
mZ ejd�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� |st �|jd�}|r4|jttd�g |jd�� d S |jd td�ksJt �|jdd � }t|�dkrvtj |d �rvd S d } }}|r�|d t
� kr�|d d� }d}|r�|d tjt
jd�kr�t|�dks�t �|d j� }|d d � }d
d� |D �}|�rd|d _|d k �s"|d k �s"|d k �rz|d k �rB| j|d
tt|��� |d k �rb| j|dtt|��� |d k �rz| j|d|� ttd�|�} |j| _| S )NZbare�print)�prefix� � � z>>r � c S s g | ]}|j � �qS � )�clone)�.0�argr r �//usr/lib64/python3.6/lib2to3/fixes/fix_print.py�
<listcomp>? s z&FixPrint.transform.<locals>.<listcomp>� �sep�end�file���r )�AssertionError�get�replacer r r Zchildren�len�parend_expr�matchr r �Leafr �
RIGHTSHIFTr � add_kwargr �repr)
�selfZnodeZresultsZ
bare_print�argsr r r Zl_argsZn_stmtr r r � transform% s>