python (3.12.0)
̑e d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z m
Z
mZ ej d Z
G d d ej Zy
)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)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c e Zd ZdZdZd Zd Zy)FixPrintTzP
simple_stmt< any* bare='print' any* > | print_stmt
c |sJ |j d }|r1|j t t d g |j y |j
d t d k( sJ |j
dd }t
| dk( rt j |d ry d x}x}}|r|d t k( r|d d }d}|rR|d t j t j d k( r(t
| d k\ sJ |d j }|d
d }|D cg c] }|j } }| r
d| d _ |||c|%| j | dt! t# | |%| j | d
t! t# | || j | d| t t d | }
|j |
_ |
S c c}w )Nbareprint)prefix z>>r sependfile)getreplacer r r childrenlenparend_exprmatchr r Leafr
RIGHTSHIFTclone add_kwargr
repr)selfnoderesults
bare_printargsr r r argl_argsn_stmts K/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/lib2to3/fixes/fix_print.py transformzFixPrint.transform% s [[(
tDM2&0&7&7 9
:}}Q4=00}}QR t9>k//Q8
cDDH'9DCDGv{{5+;+;TBBt9>!7==?D8D)-.##))+..!F1I?co1AvufT#Y.?@vufT#Y.?@vvt4d7mV,
/s G c ( d|_ t j | j j t | t j t j d |f }|r |j t d|_ |j | y )Nr =r )r r Nodesymsargumentr r r EQUALappendr )r% l_nodess_kwdn_expr
n_arguments r- r# zFixPrint.add_kwargM sk
[[!3!3"&u+"(++ekk3"?"("*+
NN57# #Jz"