Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/fix_map.cpython-312.pyc

�

�Q�f8��~�dZddlmZddlmZddlmZmZmZm	Z	m
Z
ddlmZ
ddlmZGd�dej �Zy	)
aFixer 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��eZdZdZdZdZd�Zy)�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*]
    >
    zfuture_builtins.mapc�
�|j|�ryg}d|vr)|dD]!}|j|j���#|jjt
jk(rA|j|d�|j�}d|_ttd�|g�}�n�d|vrbt|dj�|dj�|dj��}tt
j|g|zd�	�}�nbd
|vr|dj�}d|_�n	d|vr�|d}|jt
jk(r�|jd
jt
j k(rs|jd
jdjt"j$k(r<|jd
jdj&dk(r|j|d�ytt
jtd�|j�g�}d|_t)|�rytt
jtd�t+g�g|z�}d|_|j|_|S)N�extra_trailerszYou should use a for loop here��list�
map_lambda�xp�fp�it)�prefix�map_none�arg�args���Nonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequence�map)�should_skip�append�clone�parent�type�syms�simple_stmt�warningrrrrr�power�trailer�children�arglistr�NAME�valuer	r)�self�node�results�trailers�t�newrs       �</opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_map.py�	transformzFixMap.transform@s�����D�!�����w�&��-�.��������	�*�/��;�;���t�/�/�/��L�L��?�@��*�*�,�C��C�J��t�F�|�c�U�+�C�
�W�
$��7�4�=�.�.�0�"�4�=�.�.�0�"�4�=�.�.�0�2�C��t�z�z�C�5�8�#3�B�?�C��W�$��e�n�*�*�,����
��W�$�"�6�?�D��y�y�D�L�L�0��}�}�Q�'�,�,����<��}�}�Q�'�0�0��3�8�8�E�J�J�F��}�}�Q�'�0�0��3�9�9�V�C����T�,N�O���t�z�z�D��K�����+F�G�C�!#�C�J�%�d�+���t�z�z�D��L�'�3�%�.�#A�H�#L�M�C��C�J��[�[��
��
�N)�__name__�
__module__�__qualname__�
BM_compatible�PATTERN�skip_onr3�r4r2r
r
s���M��G�:$�G�.r4r
N)�__doc__�pgen2rrr�
fixer_utilrrrrr	�pygramr
r#�pytreer�ConditionalFixr
r;r4r2�<module>rBs2���&��J�J�+��P�Z�
&�
&�Pr4

Hacked By AnonymousFox1.0, Coded By AnonymousFox