
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    ¡ê,a8  ã                   @   sf   d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZ ddlmZ G dd„ dejƒZd	S )
a  Fixer that changes map(F, ...) into list(map(F, ...)) unless there
exists a 'from future_builtins import map' statement in the top-level
namespace.

As a special case, map(None, X) is changed into list(X).  (This is
necessary because the semantics are changed in this case -- the new
map(None, X) is equivalent to [(x,) for x in X].)

We avoid the transformation (except for the special case mentioned
above) if the map() call is directly contained in iter(<>), list(<>),
tuple(<>), sorted(<>), ...join(<>), or for V in <>:.

NOTE: This is still not correct if the original code was depending on
map(F, X, Y, ...) to go on until the longest argument is exhausted,
substituting None for missing values -- like zip(), it now stops as
soon as the shortest argument is exhausted.
é   )Útoken)Ú
fixer_base)ÚNameÚArgListÚCallÚListCompÚin_special_context)Úpython_symbols)ÚNodec                   @   s    e Zd ZdZdZdZdd„ ZdS )ÚFixMapTaL  
    map_none=power<
        'map'
        trailer< '(' arglist< 'None' ',' arg=any [','] > ')' >
        [extra_trailers=trailer*]
    >
    |
    map_lambda=power<
        'map'
        trailer<
            '('
            arglist<
                lambdef< 'lambda'
                         (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any
                >
                ','
                it=any
            >
            ')'
        >
        [extra_trailers=trailer*]
    >
    |
    power<
        'map' args=trailer< '(' [any] ')' >
        [extra_trailers=trailer*]
    >
    zfuture_builtins.mapc                 C   s¤  |   |¡rd S g }d|kr6|d D ]}| | ¡ ¡ q"|jjtjkrr|  |d¡ | ¡ }d|_t	t
dƒ|gƒ}�n&d|kr¶t|d  ¡ |d  ¡ |d  ¡ ƒ}ttj|g| dd	�}nâd
|krÒ|d  ¡ }d|_n¢d|k�rf|d }|jtjk�rH|jd jtjk�rH|jd jd jtjk�rH|jd jd jdk�rH|  |d¡ d S ttjt
dƒ| ¡ gƒ}d|_t|ƒ�rtd S ttjt
dƒt|gƒg| ƒ}d|_|j|_|S )NZextra_trailerszYou should use a for loop hereÚ ÚlistZ
map_lambdaZxpÚfpÚit)ÚprefixZmap_noneÚargÚargsé   é    ÚNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequenceÚmap)Zshould_skipÚappendZcloneÚparentÚtypeÚsymsZsimple_stmtZwarningr   r   r   r   r
   ZpowerZtrailerZchildrenZarglistr   ÚNAMEÚvaluer   r   )ÚselfZnodeZresultsZtrailersÚtÚnewr   © r    ú:/opt/alt/python38/lib64/python3.8/lib2to3/fixes/fix_map.pyÚ	transform@   sN    


þ
ÿþý
zFixMap.transformN)Ú__name__Ú
__module__Ú__qualname__ZBM_compatibleZPATTERNZskip_onr"   r    r    r    r!   r      s   r   N)Ú__doc__Zpgen2r   r   r   Z
fixer_utilr   r   r   r   r   Zpygramr	   r   Zpytreer
   ZConditionalFixr   r    r    r    r!   Ú<module>   s   