Your IP : 3.21.12.41


Current Path : /opt/alt/python36/lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/lib2to3/fixes/__pycache__/fix_print.cpython-36.pyc

3

� f�@sldZddlmZddlmZddlmZddlmZddlmZm	Z	m
Z
mZejd�Z
Gdd	�d	ej�Zd
S)aFixer 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$eZdZdZdZdd�Zdd�ZdS)�FixPrintTzP
              simple_stmt< any* bare='print' any* > | print_stmt
              c
Cs�|st�|jd�}|r4|jttd�g|jd��dS|jdtd�ksJt�|jdd�}t|�dkrvtj	|d�rvdSd}}}|r�|dt
�kr�|dd�}d}|r�|dtjt
jd�kr�t|�dks�t�|dj�}|d	d�}d
d�|D�}|�rd|d_|dk	�s"|dk	�s"|dk	�rz|dk	�rB|j|d
tt|���|dk	�rb|j|dtt|���|dk	�rz|j|d|�ttd�|�}	|j|	_|	S)NZbare�print)�prefix��� z>>r�cSsg|]}|j��qS�)�clone)�.0�argrr�</opt/alt/python36/lib64/python3.6/lib2to3/fixes/fix_print.py�
<listcomp>?sz&FixPrint.transform.<locals>.<listcomp>��sep�end�file���r)�AssertionError�get�replacerrrZchildren�len�parend_expr�matchrr�Leafr�
RIGHTSHIFTr�	add_kwargr	�repr)
�selfZnodeZresultsZ
bare_print�argsrrrZl_argsZn_stmtrrr�	transform%s>




zFixPrint.transformcCsNd|_tj|jjt|�tjtjd�|f�}|r@|j	t
��d|_|j	|�dS)Nr�=r)rrZNodeZsymsZargumentrr"r�EQUAL�appendr)r&Zl_nodesZs_kwdZn_exprZ
n_argumentrrrr$Ms
zFixPrint.add_kwargN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNr(r$rrrrr
s(r
N)�__doc__rrrZpgen2rrZ
fixer_utilrrrr	Zcompile_patternr ZBaseFixr
rrrr�<module>s

?>