관리-도구
편집 파일: fix_print.cpython-34.pyc
� i f& � @ 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 s8 | 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 } n | rE| d t j t j d � k rEt | � d k s"t � | d j � } | d d � } n d d � | D� } | rnd | d _ n | d k s�| d k s�| d k r| d k r�| j | d t t | � � � n | d k r�| j | d t t | � � � n | d k r| j | d | � qn t t d � | � } | j | _ | S)NZbare�print�prefix� � � z>>r � c S s g | ] } | j � � q S� )�clone)�.0�argr r �</opt/alt/python34/lib64/python3.4/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>