Viewing File: /opt/alt/python38/lib64/python3.8/lib2to3/fixes/__pycache__/fix_print.cpython-38.pyc

U

,a@sldZddlmZddlmZddlmZddlmZddlmZm	Z	m
Z
mZedZ
Gdd	d	ejZd
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)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c@s$eZdZdZdZddZddZdS)FixPrintTzP
              simple_stmt< any* bare='print' any* > | print_stmt
              c
Cs|st|d}|r4|ttdg|jddS|jdtdksJt|jdd}t|dkrvt	|drvdSd}}}|r|dt
kr|dd}d}|r|dtt
jdkrt|d	kst|d}|d
d}dd|D}|rd
|d_|dk	s"|dk	s"|dk	rz|dk	rB||dtt||dk	rb||dtt||dk	rz||d|ttd|}	|j|	_|	S)NZbareprint)prefix z>>rcSsg|]}|qS)clone).0argrr</opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_print.py
<listcomp>?sz&FixPrint.transform.<locals>.<listcomp>sependfile)AssertionErrorgetreplacerrrZchildrenlenparend_exprmatchrrLeafr
RIGHTSHIFTr	add_kwargr	repr)
selfZnodeZresultsZ
bare_printargsrrrZl_argsZn_stmtrrr	transform%s@




zFixPrint.transformcCsNd|_t|jjt|ttjd|f}|r@|	t
d|_|	|dS)Nr=r)rrZNodeZsymsZargumentrr"rEQUALappendr)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

Back to Directory File Manager