a
i @ sV d Z ddlmZ ddlmZmZmZmZmZm Z m
Z
mZmZm
Z
G dd dejZdS )zoFixer for execfile.
This converts usages of the execfile function into calls to the built-in
exec() function.
)
fixer_base)
CommaNameCallLParenRParenDotNodeArgListStringsymsc @ s e Zd ZdZdZdd ZdS )FixExecfileTz
power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > >
|
power< 'execfile' trailer< '(' filename=any ')' > >
c C s. |sJ |d }| d}| d}|jd jd }t| t tddg|d}ttjt d|g}ttj
t t d gttj
t t
gg} |g| }
| }d|_td
d}|
t |t |g }
tt d|
d}|g}|d ur|t | g |d ur|t | g tt d
||jdS )Nfilenameglobalslocalsz"rb" )Zrparenopenreadz'exec'compile exec)prefix)getZchildrenZcloner
r r r r Zpowerr Ztrailerr r r r r extend)selfZnoderesultsr r r Zexecfile_parenZ open_argsZ open_callr Z open_exprZfilename_argZexec_strZcompile_argsZcompile_callargs r 2/usr/lib64/python3.9/lib2to3/fixes/fix_execfile.py transform s0
zFixExecfile.transformN)__name__
__module____qualname__Z
BM_compatibleZPATTERNr r r r r r
s r
N)__doc__r r Z
fixer_utilr r r r r r r r
r r ZBaseFixr
r r r r