o
    Š�bc	  ã                   @   sR   d Z ddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZ G dd„ dejƒZdS )	a7  
Fixer that changes zip(seq0, seq1, ...) into list(zip(seq0, seq1, ...)
unless there exists a 'from future_builtins import zip' statement in the
top-level namespace.

We avoid the transformation if the zip() call is directly contained in
iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:.
é   )Ú
fixer_base)ÚNode)Úpython_symbols)ÚNameÚArgListÚin_special_contextc                   @   s    e Zd ZdZdZdZdd„ ZdS )ÚFixZipTzN
    power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*]
    >
    zfuture_builtins.zipc                 C   sœ   |   |¡rd S t|ƒrd S |d  ¡ }d|_g }d|v r-dd„ |d D ƒ}|D ]}d|_q'ttjtdƒ|gdd�}ttjtdƒt|gƒg| ƒ}|j|_|S )	NÚargsÚ Útrailersc                 S   s   g | ]}|  ¡ ‘qS © )Úclone)Ú.0Únr   r   ú,/usr/lib/python3.10/lib2to3/fixes/fix_zip.pyÚ
<listcomp>'   s    z$FixZip.transform.<locals>.<listcomp>Úzip)ÚprefixÚlist)	Úshould_skipr   r   r   r   ÚsymsÚpowerr   r   )ÚselfÚnodeÚresultsr	   r   r   Únewr   r   r   Ú	transform   s   
zFixZip.transformN)Ú__name__Ú
__module__Ú__qualname__ÚBM_compatibleÚPATTERNÚskip_onr   r   r   r   r   r      s
    r   N)Ú__doc__r
   r   Úpytreer   Úpygramr   r   Ú
fixer_utilr   r   r   ÚConditionalFixr   r   r   r   r   Ú<module>   s    
