Your IP : 3.15.10.117
3
��2a � @ sh d dl mZ d dl mZ d dlmZ d dl mZ d dlmZmZm Z m
Z
ejd�ZG dd� dej
�Zd S )
� )�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` |j d�}|r,|jttd�g |jd�� d S |jdd � }t|�dkrXtj|d �rXd S d } }}|r�|d t � kr�|d d� }d}|r�|d t
jtj
d�kr�|d j� }|dd � }d d
� |D �}|r�d|d _|d k s�|d k s�|d k �rF|d k �r| j|dtt|��� |d k �r.| j|d
tt|��� |d k �rF| j|d|� ttd�|�} |j| _| S )NZbare�print)�prefix� � � z>>� c S s g | ]}|j � �qS � )�clone)�.0�argr r �./opt/alt/python36/lib64/python3.6/fix_print.py�
<listcomp>? s z&FixPrint.transform.<locals>.<listcomp>� �sep�end�file���r )�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% s8
zFixPrint.transformc C sN d|_ tj| jjt|�tjtjd�|f�}|r@|j t
� � d|_ |j |� d S )Nr �=r )r r ZNodeZsyms�argumentr r! r �EQUAL�appendr )r% Zl_nodesZs_kwdZn_exprZ
n_argumentr r r r# M s
zFixPrint.add_kwargN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr( r# r r r r r
s (r
N)r r r Zpgen2r r Z
fixer_utilr r r r Zcompile_patternr ZBaseFixr
r r r r �<module> s