Viewing File: /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_print.cpython-35.opt-1.pyc



¯ÕYf&ã@sšdZddlmZddlmZddlmZddlmZddlmZm	Z	m
Z
mZmZej
dƒZGdd	„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ÚStringÚis_tuplez"atom< '(' [atom|STRING|NAME] ')' >c@s4eZdZdZdZdd„Zdd„ZdS)ÚFixPrintTzP
              simple_stmt< any* bare='print' any* > | print_stmt
              c
Csà|jdƒ}|r>|jttdƒgd|jƒƒdS|jdd…}t|ƒdkrztj|dƒrzdSd}}}|r·|dt	ƒkr·|dd…}d}|rü|dt
jtj
dƒkrü|djƒ}|dd…}d	d
„|Dƒ}|r"d|d_|dk	sF|dk	sF|dk	r»|dk	rq|j|dtt|ƒƒƒ|dk	rœ|j|d
tt|ƒƒƒ|dk	r»|j|d|ƒttdƒ|ƒ}	|j|	_|	S)NZbareÚprintÚprefixééú z>>écSsg|]}|jƒ‘qS©)Úclone)Ú.0Úargrrú</opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_print.pyú
<listcomp>?s	z&FixPrint.transform.<locals>.<listcomp>ÚÚsepÚendÚfileéÿÿÿÿr)ÚgetÚreplacerrr
ZchildrenÚlenÚparend_exprÚmatchrrÚLeafrÚ
RIGHTSHIFTrÚ	add_kwargr	Úrepr)
ÚselfZnodeZresultsZ
bare_printÚargsrrrZl_argsZn_stmtrrrÚ	transform%s8
%%
$zFixPrint.transformcCsod|_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$rrrrrs(rN)Ú__doc__rrrZpgen2rrZ
fixer_utilrrrr	r
Zcompile_patternr ZBaseFixrrrrrÚ<module>s(	
Back to Directory File Manager