Viewing File: /opt/alt/python35/lib64/python3.5/lib2to3/fixes/__pycache__/fix_print.cpython-35.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#|st‚|jdƒ}|rJ|jttdƒgd|jƒƒdS|jdtdƒksit‚|jdd…}t|ƒdkr¥tj	|dƒr¥dSd}}}|râ|dt
ƒkrâ|dd…}d}|r?|dtjt
jdƒkr?t|ƒdkst‚|djƒ}|d	d…}d
d„|Dƒ}|red|d_|dk	s‰|dk	s‰|dk	rþ|dk	r´|j|d
tt|ƒƒƒ|dk	rß|j|dtt|ƒƒƒ|dk	rþ|j|d|ƒttdƒ|ƒ}	|j|	_|	S)NZbareÚprintÚprefixééú z>>ré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)ÚAssertionErrorÚgetÚreplacerrr
ZchildrenÚlenÚparend_exprÚmatchrrÚLeafrÚ
RIGHTSHIFTrÚ	add_kwargr	Úrepr)
ÚselfZnodeZresultsZ
bare_printÚargsrrrZl_argsZn_stmtrrrÚ	transform%s>
%%
$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