B
    18\                  @   sV   d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
mZmZmZ G dd dejZdS )zoFixer for execfile.

This converts usages of the execfile function into calls to the built-in
exec() function.
   )
fixer_base)
CommaNameCallLParenRParenDotNodeArgListStringsymsc               @   s   e Zd ZdZdZdd ZdS )FixExecfileTz
    power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > >
    |
    power< 'execfile' trailer< '(' filename=any ')' > >
    c             C   s.  |st |d }|d}|d}|jd jd  }t| t tddg|d}ttj	t
d|g}ttjt t
d	gttjt t gg}	|g|	 }
| }d|_td
d}|
t |t |g }tt
d|d}|g}|d k	r|t | g |d k	r|t | g tt
d||jdS )Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compile exec)prefix)AssertionErrorgetchildrencloner
   r   r   r	   r   powerr   trailerr   r   r   r   r   extend)selfnoderesultsr   r   r   Zexecfile_parenZ	open_argsZ	open_callr   Z	open_exprZfilename_argZexec_strZcompile_argsZcompile_callargs r%   ^/oak/stanford/groups/akundaje/marinovg/programs/Python-3.7.3/Lib/lib2to3/fixes/fix_execfile.py	transform   s,    




zFixExecfile.transformN)__name__
__module____qualname__BM_compatiblePATTERNr'   r%   r%   r%   r&   r      s   r   N)__doc__r   r   
fixer_utilr   r   r   r   r   r   r	   r
   r   r   BaseFixr   r%   r%   r%   r&   <module>   s   0