Your IP : 18.216.6.100


Current Path : /lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //lib64/python3.6/lib2to3/fixes/__pycache__/fix_filter.cpython-36.opt-1.pyc

3


 \[
�@sVdZddlmZddlmZddlmZddlm	Z	m
Z
mZmZGdd�dej
�ZdS)	a�Fixer that changes filter(F, X) into list(filter(F, X)).

We avoid the transformation if the filter() 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
filter(F, X) to return a string if X is a string and a tuple if X is a
tuple.  That would require type inference, which we don't do.  Let
Python 2.6 figure it out.
�)�
fixer_base)�Node)�python_symbols)�Name�ArgList�ListComp�in_special_contextc@s eZdZdZdZdZdd�ZdS)�	FixFilterTaV
    filter_lambda=power<
        'filter'
        trailer<
            '('
            arglist<
                lambdef< 'lambda'
                         (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any
                >
                ','
                it=any
            >
            ')'
        >
        [extra_trailers=trailer*]
    >
    |
    power<
        'filter'
        trailer< '(' arglist< none='None' ',' seq=any > ')' >
        [extra_trailers=trailer*]
    >
    |
    power<
        'filter'
        args=trailer< '(' [any] ')' >
        [extra_trailers=trailer*]
    >
    zfuture_builtins.filtercCs2|j|�rdSg}d|kr:x|dD]}|j|j��q$Wd|kr�t|jd�j�|jd�j�|jd�j�|jd�j��}ttj|g|dd�}n�d|kr�ttd	�td	�|d
j�td	��}ttj|g|dd�}nTt	|�r�dS|dj�}ttjtd�|gdd�}ttjtd
�t
|g�g|�}d|_|j|_|S)NZextra_trailersZ
filter_lambda�fp�itZxp�)�prefixZnoneZ_f�seq�args�filter�list)Zshould_skip�appendZcloner�getr�symsZpowerrrrr
)�selfZnode�resultsZtrailers�t�newr�r�"/usr/lib64/python3.6/fix_filter.py�	transform:s4


zFixFilter.transformN)�__name__�
__module__�__qualname__Z
BM_compatibleZPATTERNZskip_onrrrrrr	sr	N)�__doc__rrZpytreerZpygramrrZ
fixer_utilrrrrZConditionalFixr	rrrr�<module>s