Viewing File: /usr/lib64/python3.6/lib2to3/fixes/__pycache__/fix_execfile.cpython-36.pyc
3
\ @ 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 s0 |st |d }|jd}|jd}|jd jd j }t|j t tddg|d}ttj t
d|g}ttjt t
d gttjt
t gg} |g| }
|j }d|_td
d}|
t |t |g }
tt
d|
d}|g}|d k r|jt |j g |d k r|jt |j g tt
d
||jdS )Nfilenameglobalslocals z"rb" )Zrparenopenreadz'exec'compile exec)prefixr )AssertionErrorgetZchildrenZcloner
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 $/usr/lib64/python3.6/fix_execfile.py transform s,
zFixExecfile.transformN)__name__
__module____qualname__Z
BM_compatibleZPATTERNr"