Hacked By AnonymousFox
��Yf& � @ s� d Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z m Z m
Z
m Z m Z e j
d � Z Gd d � d e j � Z d
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�String�is_tuplez"atom< '(' [atom|STRING|NAME] ')' >c @ s4 e Z d Z d Z d Z d d � Z d d � Z d S)�FixPrintTzP
simple_stmt< any* bare='print' any* > | print_stmt
c
C s# | s t � | j d � } | rJ | j t t d � g d | j �� d S| j d t d � k si t � | j d d � } t | � d k r� t j | d � r� d Sd } } } | r� | d t
� k r� | d d � } d } | r?| d t j t
j d � k r?t | � d k st � | d j � } | d d � } d
d � | D� } | red | d _ | d k s�| d k s�| d k r�| d k r�| j | d
t t | � � � | d k r�| j | d t t | � � � | d k r�| j | d | � t t d � | � } | j | _ | S)NZbare�print�prefix� � � z>>r � c S s g | ] } | j � � q S� )�clone)�.0�argr r �</opt/alt/python35/lib64/python3.5/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>